Merge pull request #5855 from fredj/rename_dragbox_event
Rename ol.DragBoxEvent* to ol.interaction.DragBox.Event*
This commit is contained in:
@@ -10,6 +10,8 @@ A number of internal types have been renamed. This will not affect those who us
|
|||||||
|
|
||||||
* rename `ol.CollectionProperty` to `ol.Collection.Property`
|
* rename `ol.CollectionProperty` to `ol.Collection.Property`
|
||||||
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
|
* rename `ol.DeviceOrientationProperty` to `ol.DeviceOrientation.Property`
|
||||||
|
* rename `ol.DragBoxEvent` to `ol.interaction.DragBox.Event`
|
||||||
|
* rename `ol.DragBoxEventType` to `ol.interaction.DragBox.EventType`
|
||||||
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
|
* rename `ol.GeolocationProperty` to `ol.Geolocation.Property`
|
||||||
* rename `ol.OverlayPositioning` to `ol.Overlay.Positioning`
|
* rename `ol.OverlayPositioning` to `ol.Overlay.Positioning`
|
||||||
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
|
* rename `ol.OverlayProperty` to `ol.Overlay.Property`
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
// FIXME draw drag box
|
// FIXME draw drag box
|
||||||
goog.provide('ol.interaction.DragBox');
|
goog.provide('ol.interaction.DragBox');
|
||||||
goog.provide('ol.DragBoxEvent');
|
|
||||||
|
|
||||||
goog.require('ol.events.Event');
|
goog.require('ol.events.Event');
|
||||||
goog.require('ol');
|
goog.require('ol');
|
||||||
@@ -18,67 +17,6 @@ ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED =
|
|||||||
ol.DRAG_BOX_HYSTERESIS_PIXELS;
|
ol.DRAG_BOX_HYSTERESIS_PIXELS;
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @enum {string}
|
|
||||||
*/
|
|
||||||
ol.DragBoxEventType = {
|
|
||||||
/**
|
|
||||||
* Triggered upon drag box start.
|
|
||||||
* @event ol.DragBoxEvent#boxstart
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
BOXSTART: 'boxstart',
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Triggered on drag when box is active.
|
|
||||||
* @event ol.DragBoxEvent#boxdrag
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
BOXDRAG: 'boxdrag',
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Triggered upon drag box end.
|
|
||||||
* @event ol.DragBoxEvent#boxend
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
BOXEND: 'boxend'
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @classdesc
|
|
||||||
* Events emitted by {@link ol.interaction.DragBox} instances are instances of
|
|
||||||
* this type.
|
|
||||||
*
|
|
||||||
* @param {string} type The event type.
|
|
||||||
* @param {ol.Coordinate} coordinate The event coordinate.
|
|
||||||
* @param {ol.MapBrowserEvent} mapBrowserEvent Originating event.
|
|
||||||
* @extends {ol.events.Event}
|
|
||||||
* @constructor
|
|
||||||
* @implements {oli.DragBoxEvent}
|
|
||||||
*/
|
|
||||||
ol.DragBoxEvent = function(type, coordinate, mapBrowserEvent) {
|
|
||||||
ol.events.Event.call(this, type);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The coordinate of the drag event.
|
|
||||||
* @const
|
|
||||||
* @type {ol.Coordinate}
|
|
||||||
* @api stable
|
|
||||||
*/
|
|
||||||
this.coordinate = coordinate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @const
|
|
||||||
* @type {ol.MapBrowserEvent}
|
|
||||||
* @api
|
|
||||||
*/
|
|
||||||
this.mapBrowserEvent = mapBrowserEvent;
|
|
||||||
|
|
||||||
};
|
|
||||||
ol.inherits(ol.DragBoxEvent, ol.events.Event);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @classdesc
|
* @classdesc
|
||||||
* Allows the user to draw a vector box by clicking and dragging on the map,
|
* Allows the user to draw a vector box by clicking and dragging on the map,
|
||||||
@@ -92,7 +30,7 @@ ol.inherits(ol.DragBoxEvent, ol.events.Event);
|
|||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends {ol.interaction.Pointer}
|
* @extends {ol.interaction.Pointer}
|
||||||
* @fires ol.DragBoxEvent
|
* @fires ol.interaction.DragBox.Event
|
||||||
* @param {olx.interaction.DragBoxOptions=} opt_options Options.
|
* @param {olx.interaction.DragBoxOptions=} opt_options Options.
|
||||||
* @api stable
|
* @api stable
|
||||||
*/
|
*/
|
||||||
@@ -165,7 +103,7 @@ ol.interaction.DragBox.handleDragEvent_ = function(mapBrowserEvent) {
|
|||||||
|
|
||||||
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel);
|
||||||
|
|
||||||
this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXDRAG,
|
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXDRAG,
|
||||||
mapBrowserEvent.coordinate, mapBrowserEvent));
|
mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -205,7 +143,7 @@ ol.interaction.DragBox.handleUpEvent_ = function(mapBrowserEvent) {
|
|||||||
if (this.boxEndCondition_(mapBrowserEvent,
|
if (this.boxEndCondition_(mapBrowserEvent,
|
||||||
this.startPixel_, mapBrowserEvent.pixel)) {
|
this.startPixel_, mapBrowserEvent.pixel)) {
|
||||||
this.onBoxEnd(mapBrowserEvent);
|
this.onBoxEnd(mapBrowserEvent);
|
||||||
this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXEND,
|
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXEND,
|
||||||
mapBrowserEvent.coordinate, mapBrowserEvent));
|
mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -228,10 +166,71 @@ ol.interaction.DragBox.handleDownEvent_ = function(mapBrowserEvent) {
|
|||||||
this.startPixel_ = mapBrowserEvent.pixel;
|
this.startPixel_ = mapBrowserEvent.pixel;
|
||||||
this.box_.setMap(mapBrowserEvent.map);
|
this.box_.setMap(mapBrowserEvent.map);
|
||||||
this.box_.setPixels(this.startPixel_, this.startPixel_);
|
this.box_.setPixels(this.startPixel_, this.startPixel_);
|
||||||
this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXSTART,
|
this.dispatchEvent(new ol.interaction.DragBox.Event(ol.interaction.DragBox.EventType.BOXSTART,
|
||||||
mapBrowserEvent.coordinate, mapBrowserEvent));
|
mapBrowserEvent.coordinate, mapBrowserEvent));
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @enum {string}
|
||||||
|
*/
|
||||||
|
ol.interaction.DragBox.EventType = {
|
||||||
|
/**
|
||||||
|
* Triggered upon drag box start.
|
||||||
|
* @event ol.interaction.DragBox.Event#boxstart
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
BOXSTART: 'boxstart',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered on drag when box is active.
|
||||||
|
* @event ol.interaction.DragBox.Event#boxdrag
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
BOXDRAG: 'boxdrag',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Triggered upon drag box end.
|
||||||
|
* @event ol.interaction.DragBox.Event#boxend
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
BOXEND: 'boxend'
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @classdesc
|
||||||
|
* Events emitted by {@link ol.interaction.DragBox} instances are instances of
|
||||||
|
* this type.
|
||||||
|
*
|
||||||
|
* @param {string} type The event type.
|
||||||
|
* @param {ol.Coordinate} coordinate The event coordinate.
|
||||||
|
* @param {ol.MapBrowserEvent} mapBrowserEvent Originating event.
|
||||||
|
* @extends {ol.events.Event}
|
||||||
|
* @constructor
|
||||||
|
* @implements {oli.DragBoxEvent}
|
||||||
|
*/
|
||||||
|
ol.interaction.DragBox.Event = function(type, coordinate, mapBrowserEvent) {
|
||||||
|
ol.events.Event.call(this, type);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The coordinate of the drag event.
|
||||||
|
* @const
|
||||||
|
* @type {ol.Coordinate}
|
||||||
|
* @api stable
|
||||||
|
*/
|
||||||
|
this.coordinate = coordinate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @const
|
||||||
|
* @type {ol.MapBrowserEvent}
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
this.mapBrowserEvent = mapBrowserEvent;
|
||||||
|
|
||||||
|
};
|
||||||
|
ol.inherits(ol.interaction.DragBox.Event, ol.events.Event);
|
||||||
|
|||||||
Reference in New Issue
Block a user