Add a frameState property to ol.MapBrowserEvent
so that we will be able to retrieve the current center of the view2d from the framestate in the dragpan interaction.
This commit is contained in:
@@ -542,6 +542,7 @@ ol.Map.prototype.handleControlsRemove_ = function(collectionEvent) {
|
||||
* @param {ol.MapBrowserEvent} mapBrowserEvent The event to handle.
|
||||
*/
|
||||
ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) {
|
||||
mapBrowserEvent.frameState = this.frameState_;
|
||||
var interactions = this.getInteractions();
|
||||
var interactionsArray = /** @type {Array.<ol.interaction.Interaction>} */
|
||||
(interactions.getArray());
|
||||
|
||||
@@ -21,10 +21,11 @@ goog.require('ol.Pixel');
|
||||
* @param {string} type Event type.
|
||||
* @param {ol.Map} map Map.
|
||||
* @param {goog.events.BrowserEvent} browserEvent Browser event.
|
||||
* @param {?ol.FrameState=} opt_frameState Frame state.
|
||||
*/
|
||||
ol.MapBrowserEvent = function(type, map, browserEvent) {
|
||||
ol.MapBrowserEvent = function(type, map, browserEvent, opt_frameState) {
|
||||
|
||||
goog.base(this, type, map);
|
||||
goog.base(this, type, map, opt_frameState);
|
||||
|
||||
/**
|
||||
* @type {goog.events.BrowserEvent}
|
||||
@@ -230,6 +231,9 @@ ol.MapBrowserEventHandler.prototype.handleUp_ = function(browserEvent) {
|
||||
* @private
|
||||
*/
|
||||
ol.MapBrowserEventHandler.prototype.handleDown_ = function(browserEvent) {
|
||||
var newEvent = new ol.MapBrowserEvent(
|
||||
ol.MapBrowserEvent.EventType.DOWN, this.map_, browserEvent);
|
||||
this.dispatchEvent(newEvent);
|
||||
if (!this.previous_) {
|
||||
this.touchEnableBrowserEvent_(browserEvent);
|
||||
this.down_ = browserEvent;
|
||||
@@ -306,5 +310,6 @@ ol.MapBrowserEvent.EventType = {
|
||||
DBLCLICK: goog.events.EventType.DBLCLICK,
|
||||
DRAGSTART: 'dragstart',
|
||||
DRAG: 'drag',
|
||||
DRAGEND: 'dragend'
|
||||
DRAGEND: 'dragend',
|
||||
DOWN: 'down'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user