From 36b50ab4911df79887231900a8691141b29e70e7 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 7 Sep 2016 10:14:11 +0200 Subject: [PATCH] Rename ol.interaction.TranslateEventType to ol.interaction.Translate.EventType --- changelog/upgrade-notes.md | 1 + src/ol/interaction/translate.js | 58 ++++++++++++++++----------------- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/changelog/upgrade-notes.md b/changelog/upgrade-notes.md index cc6755a304..5e8040cd1f 100644 --- a/changelog/upgrade-notes.md +++ b/changelog/upgrade-notes.md @@ -20,6 +20,7 @@ A number of internal types have been renamed. This will not affect those who us * rename `ol.interaction.DragAndDropEvent` to `ol.interaction.DragAndDrop.Event` * rename `ol.interaction.DragAndDropEventType` to `ol.interaction.DragAndDrop.EventType` * rename `ol.interaction.TranslateEvent` to `ol.interaction.Translate.Event` + * rename `ol.interaction.TranslateEventType` to `ol.interaction.Translate.EventType` * rename `ol.layer.GroupProperty` to `ol.layer.Group.Property` * rename `ol.layer.HeatmapLayerProperty` to `ol.layer.Heatmap.Property` * rename `ol.layer.VectorTileRenderType` to `ol.layer.VectorTile.RenderType` diff --git a/src/ol/interaction/translate.js b/src/ol/interaction/translate.js index 9578f31252..555c65432c 100644 --- a/src/ol/interaction/translate.js +++ b/src/ol/interaction/translate.js @@ -7,31 +7,6 @@ goog.require('ol.array'); goog.require('ol.interaction.Pointer'); -/** - * @enum {string} - */ -ol.interaction.TranslateEventType = { - /** - * 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' -}; - - /** * @classdesc * Interaction for translating (moving) features. @@ -115,7 +90,7 @@ ol.interaction.Translate.handleDownEvent_ = function(event) { ol.interaction.Translate.handleMoveEvent_.call(this, event); this.dispatchEvent( new ol.interaction.Translate.Event( - ol.interaction.TranslateEventType.TRANSLATESTART, this.features_, + ol.interaction.Translate.EventType.TRANSLATESTART, this.features_, event.coordinate)); return true; } @@ -135,7 +110,7 @@ ol.interaction.Translate.handleUpEvent_ = function(event) { ol.interaction.Translate.handleMoveEvent_.call(this, event); this.dispatchEvent( new ol.interaction.Translate.Event( - ol.interaction.TranslateEventType.TRANSLATEEND, this.features_, + ol.interaction.Translate.EventType.TRANSLATEEND, this.features_, event.coordinate)); return true; } @@ -169,7 +144,7 @@ ol.interaction.Translate.handleDragEvent_ = function(event) { this.lastCoordinate_ = newCoordinate; this.dispatchEvent( new ol.interaction.Translate.Event( - ol.interaction.TranslateEventType.TRANSLATING, this.features_, + ol.interaction.Translate.EventType.TRANSLATING, this.features_, newCoordinate)); } }; @@ -236,7 +211,7 @@ ol.interaction.Translate.prototype.featuresAtPixel_ = function(pixel, map) { * @constructor * @extends {ol.events.Event} * @implements {oli.interaction.TranslateEvent} - * @param {ol.interaction.TranslateEventType} type Type. + * @param {ol.interaction.Translate.EventType} type Type. * @param {ol.Collection.} features The features translated. * @param {ol.Coordinate} coordinate The event coordinate. */ @@ -260,3 +235,28 @@ ol.interaction.Translate.Event = function(type, features, coordinate) { this.coordinate = coordinate; }; ol.inherits(ol.interaction.Translate.Event, ol.events.Event); + + +/** + * @enum {string} + */ +ol.interaction.Translate.EventType = { + /** + * 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' +};