Remove static members from Translate
This commit is contained in:
@@ -10,7 +10,67 @@ import {TRUE} from '../functions.js';
|
||||
import {includes} from '../array.js';
|
||||
import PointerInteraction from '../interaction/Pointer.js';
|
||||
import InteractionProperty from '../interaction/Property.js';
|
||||
import TranslateEventType from '../interaction/TranslateEventType.js';
|
||||
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
const TranslateEventType = {
|
||||
/**
|
||||
* Triggered upon feature translation start.
|
||||
* @event TranslateEvent#translatestart
|
||||
* @api
|
||||
*/
|
||||
TRANSLATESTART: 'translatestart',
|
||||
/**
|
||||
* Triggered upon feature translation.
|
||||
* @event TranslateEvent#translating
|
||||
* @api
|
||||
*/
|
||||
TRANSLATING: 'translating',
|
||||
/**
|
||||
* Triggered upon feature translation end.
|
||||
* @event TranslateEvent#translateend
|
||||
* @api
|
||||
*/
|
||||
TRANSLATEEND: 'translateend'
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link ol.interaction.Translate} instances are instances of
|
||||
* this type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.interaction.TranslateEvent}
|
||||
* @param {ol.interaction.TranslateEventType} type Type.
|
||||
* @param {ol.Collection.<ol.Feature>} features The features translated.
|
||||
* @param {ol.Coordinate} coordinate The event coordinate.
|
||||
*/
|
||||
export const TranslateEvent = function(type, features, coordinate) {
|
||||
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {ol.Collection.<ol.Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {ol.Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
};
|
||||
|
||||
inherits(TranslateEvent, Event);
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -18,7 +78,7 @@ import TranslateEventType from '../interaction/TranslateEventType.js';
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.interaction.Pointer}
|
||||
* @fires ol.interaction.Translate.Event
|
||||
* @fires ol.interaction.TranslateEvent
|
||||
* @param {olx.interaction.TranslateOptions=} opt_options Options.
|
||||
* @api
|
||||
*/
|
||||
@@ -102,7 +162,7 @@ function handleDownEvent(event) {
|
||||
const features = this.features_ || new Collection([this.lastFeature_]);
|
||||
|
||||
this.dispatchEvent(
|
||||
new Translate.Event(
|
||||
new TranslateEvent(
|
||||
TranslateEventType.TRANSLATESTART, features,
|
||||
event.coordinate));
|
||||
return true;
|
||||
@@ -124,7 +184,7 @@ function handleUpEvent(event) {
|
||||
const features = this.features_ || new Collection([this.lastFeature_]);
|
||||
|
||||
this.dispatchEvent(
|
||||
new Translate.Event(
|
||||
new TranslateEvent(
|
||||
TranslateEventType.TRANSLATEEND, features,
|
||||
event.coordinate));
|
||||
return true;
|
||||
@@ -153,7 +213,7 @@ function handleDragEvent(event) {
|
||||
|
||||
this.lastCoordinate_ = newCoordinate;
|
||||
this.dispatchEvent(
|
||||
new Translate.Event(
|
||||
new TranslateEvent(
|
||||
TranslateEventType.TRANSLATING, features,
|
||||
newCoordinate));
|
||||
}
|
||||
@@ -257,38 +317,4 @@ Translate.prototype.updateState_ = function(oldMap) {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
* Events emitted by {@link ol.interaction.Translate} instances are instances of
|
||||
* this type.
|
||||
*
|
||||
* @constructor
|
||||
* @extends {ol.events.Event}
|
||||
* @implements {oli.interaction.TranslateEvent}
|
||||
* @param {ol.interaction.TranslateEventType} type Type.
|
||||
* @param {ol.Collection.<ol.Feature>} features The features translated.
|
||||
* @param {ol.Coordinate} coordinate The event coordinate.
|
||||
*/
|
||||
Translate.Event = function(type, features, coordinate) {
|
||||
|
||||
Event.call(this, type);
|
||||
|
||||
/**
|
||||
* The features being translated.
|
||||
* @type {ol.Collection.<ol.Feature>}
|
||||
* @api
|
||||
*/
|
||||
this.features = features;
|
||||
|
||||
/**
|
||||
* The coordinate of the drag event.
|
||||
* @const
|
||||
* @type {ol.Coordinate}
|
||||
* @api
|
||||
*/
|
||||
this.coordinate = coordinate;
|
||||
};
|
||||
|
||||
inherits(Translate.Event, Event);
|
||||
|
||||
export default Translate;
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
/**
|
||||
* @module ol/interaction/TranslateEventType
|
||||
*/
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
export default {
|
||||
/**
|
||||
* Triggered upon feature translation start.
|
||||
* @event ol.interaction.Translate.Event#translatestart
|
||||
* @api
|
||||
*/
|
||||
TRANSLATESTART: 'translatestart',
|
||||
/**
|
||||
* Triggered upon feature translation.
|
||||
* @event ol.interaction.Translate.Event#translating
|
||||
* @api
|
||||
*/
|
||||
TRANSLATING: 'translating',
|
||||
/**
|
||||
* Triggered upon feature translation end.
|
||||
* @event ol.interaction.Translate.Event#translateend
|
||||
* @api
|
||||
*/
|
||||
TRANSLATEEND: 'translateend'
|
||||
};
|
||||
Reference in New Issue
Block a user