diff --git a/examples/drag-and-drop-image-vector.js b/examples/drag-and-drop-image-vector.js index 390771c1be..be3d6833d5 100644 --- a/examples/drag-and-drop-image-vector.js +++ b/examples/drag-and-drop-image-vector.js @@ -151,6 +151,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/drag-and-drop.js b/examples/drag-and-drop.js index b870d4efd7..5b123f0e82 100644 --- a/examples/drag-and-drop.js +++ b/examples/drag-and-drop.js @@ -148,6 +148,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/gpx.js b/examples/gpx.js index 181f5b56a7..6e31964e30 100644 --- a/examples/gpx.js +++ b/examples/gpx.js @@ -89,6 +89,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/icon.js b/examples/icon.js index 35b4da967f..7d1b3b4dfb 100644 --- a/examples/icon.js +++ b/examples/icon.js @@ -70,7 +70,7 @@ map.addOverlay(popup); // display popup on click map.on('singleclick', function(evt) { - var feature = map.forEachFeatureAtPixel(evt.getPixel(), + var feature = map.forEachFeatureAtPixel(evt.pixel, function(feature, layer) { return feature; }); diff --git a/examples/igc.js b/examples/igc.js index e503cf2298..e8a2b049dd 100644 --- a/examples/igc.js +++ b/examples/igc.js @@ -111,8 +111,7 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var coordinate = evt.getCoordinate(); - displaySnap(coordinate); + displaySnap(evt.coordinate); }); var imageStyle = new ol.style.Circle({ diff --git a/examples/image-vector-layer.js b/examples/image-vector-layer.js index fbba2eb416..28bb6f2d32 100644 --- a/examples/image-vector-layer.js +++ b/examples/image-vector-layer.js @@ -95,6 +95,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/kml-earthquakes.js b/examples/kml-earthquakes.js index 4098cc6de5..93668e6494 100644 --- a/examples/kml-earthquakes.js +++ b/examples/kml-earthquakes.js @@ -91,5 +91,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - displayFeatureInfo(evt.getPixel()); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/kml-timezones.js b/examples/kml-timezones.js index 6ce3ad4228..d6e81dd025 100644 --- a/examples/kml-timezones.js +++ b/examples/kml-timezones.js @@ -97,5 +97,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - displayFeatureInfo(evt.getPixel()); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/kml.js b/examples/kml.js index 0afc19cb22..3c43704bb0 100644 --- a/examples/kml.js +++ b/examples/kml.js @@ -55,6 +55,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/examples/overlay.js b/examples/overlay.js index fb62b58a55..17ccba9035 100644 --- a/examples/overlay.js +++ b/examples/overlay.js @@ -49,7 +49,7 @@ map.addOverlay(popup); map.on('singleclick', function(evt) { var element = popup.getElement(); - var coordinate = evt.getCoordinate(); + var coordinate = evt.coordinate; var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326')); diff --git a/examples/popup.js b/examples/popup.js index 0c6a362153..050c679bcf 100644 --- a/examples/popup.js +++ b/examples/popup.js @@ -62,7 +62,7 @@ var map = new ol.Map({ * Add a click handler to the map to render the popup. */ map.on('singleclick', function(evt) { - var coordinate = evt.getCoordinate(); + var coordinate = evt.coordinate; var hdms = ol.coordinate.toStringHDMS(ol.proj.transform( coordinate, 'EPSG:3857', 'EPSG:4326')); diff --git a/examples/synthetic-points.js b/examples/synthetic-points.js index 671b5fa51a..ca199b1e18 100644 --- a/examples/synthetic-points.js +++ b/examples/synthetic-points.js @@ -97,8 +97,7 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var coordinate = evt.getCoordinate(); - displaySnap(coordinate); + displaySnap(evt.coordinate); }); var imageStyle = new ol.style.Circle({ diff --git a/examples/vector-layer.js b/examples/vector-layer.js index 3631e34c5a..737b37f3be 100644 --- a/examples/vector-layer.js +++ b/examples/vector-layer.js @@ -94,6 +94,5 @@ $(map.getViewport()).on('mousemove', function(evt) { }); map.on('singleclick', function(evt) { - var pixel = evt.getPixel(); - displayFeatureInfo(pixel); + displayFeatureInfo(evt.pixel); }); diff --git a/externs/oli.js b/externs/oli.js index a88d2f913a..0b2cda2bb8 100644 --- a/externs/oli.js +++ b/externs/oli.js @@ -36,6 +36,23 @@ oli.ObjectEvent.prototype.key; +/** @interface */ +oli.MapBrowserEvent; + + +/** @type {ol.Coordinate} */ +oli.MapBrowserEvent.prototype.coordinate; + + +/** @type {Event} */ +oli.MapBrowserEvent.prototype.originalEvent; + + +/** @type {ol.Pixel} */ +oli.MapBrowserEvent.prototype.pixel; + + + /** * @interface */ diff --git a/src/ol/interaction/doubleclickzoominteraction.js b/src/ol/interaction/doubleclickzoominteraction.js index ac4f7c9668..e5b019de33 100644 --- a/src/ol/interaction/doubleclickzoominteraction.js +++ b/src/ol/interaction/doubleclickzoominteraction.js @@ -48,7 +48,7 @@ ol.interaction.DoubleClickZoom.prototype.handleMapBrowserEvent = var browserEvent = mapBrowserEvent.browserEvent; if (mapBrowserEvent.type == ol.MapBrowserEvent.EventType.DBLCLICK) { var map = mapBrowserEvent.map; - var anchor = mapBrowserEvent.getCoordinate(); + var anchor = mapBrowserEvent.coordinate; var delta = browserEvent.shiftKey ? -this.delta_ : this.delta_; // FIXME works for View2D only var view = map.getView().getView2D(); diff --git a/src/ol/interaction/dragboxinteraction.js b/src/ol/interaction/dragboxinteraction.js index e83e240867..44cdf04267 100644 --- a/src/ol/interaction/dragboxinteraction.js +++ b/src/ol/interaction/dragboxinteraction.js @@ -114,7 +114,7 @@ goog.inherits(ol.interaction.DragBox, ol.interaction.Drag); * @inheritDoc */ ol.interaction.DragBox.prototype.handleDrag = function(mapBrowserEvent) { - this.box_.setPixels(this.startPixel_, mapBrowserEvent.getPixel()); + this.box_.setPixels(this.startPixel_, mapBrowserEvent.pixel); }; @@ -144,7 +144,7 @@ ol.interaction.DragBox.prototype.handleDragEnd = ol.DRAG_BOX_HYSTERESIS_PIXELS_SQUARED) { this.onBoxEnd(mapBrowserEvent); this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXEND, - mapBrowserEvent.getCoordinate())); + mapBrowserEvent.coordinate)); } }; @@ -156,11 +156,11 @@ ol.interaction.DragBox.prototype.handleDragStart = function(mapBrowserEvent) { var browserEvent = mapBrowserEvent.browserEvent; if (browserEvent.isMouseActionButton() && this.condition_(mapBrowserEvent)) { - this.startPixel_ = mapBrowserEvent.getPixel(); + this.startPixel_ = mapBrowserEvent.pixel; this.box_.setMap(mapBrowserEvent.map); this.box_.setPixels(this.startPixel_, this.startPixel_); this.dispatchEvent(new ol.DragBoxEvent(ol.DragBoxEventType.BOXSTART, - mapBrowserEvent.getCoordinate())); + mapBrowserEvent.coordinate)); return true; } else { return false; diff --git a/src/ol/interaction/draginteraction.js b/src/ol/interaction/draginteraction.js index d78fde2b8d..1ed4480374 100644 --- a/src/ol/interaction/draginteraction.js +++ b/src/ol/interaction/draginteraction.js @@ -133,8 +133,7 @@ ol.interaction.Drag.prototype.handleMapBrowserEvent = this.deltaX = 0; this.deltaY = 0; this.startCenter = view2DState.center; - this.startCoordinate = /** @type {ol.Coordinate} */ - (mapBrowserEvent.getCoordinate()); + this.startCoordinate = mapBrowserEvent.coordinate; var handled = this.handleDragStart(mapBrowserEvent); if (handled) { this.dragging_ = true; diff --git a/src/ol/interaction/dragrotateandzoominteraction.js b/src/ol/interaction/dragrotateandzoominteraction.js index fdef314122..1607d84ea3 100644 --- a/src/ol/interaction/dragrotateandzoominteraction.js +++ b/src/ol/interaction/dragrotateandzoominteraction.js @@ -71,7 +71,7 @@ ol.interaction.DragRotateAndZoom.prototype.handleDrag = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var size = map.getSize(); - var offset = mapBrowserEvent.getPixel(); + var offset = mapBrowserEvent.pixel; var delta = new goog.math.Vec2( offset[0] - size[0] / 2, size[1] / 2 - offset[1]); diff --git a/src/ol/interaction/dragrotateinteraction.js b/src/ol/interaction/dragrotateinteraction.js index eceed9dfc6..218eddbf5b 100644 --- a/src/ol/interaction/dragrotateinteraction.js +++ b/src/ol/interaction/dragrotateinteraction.js @@ -52,7 +52,7 @@ goog.inherits(ol.interaction.DragRotate, ol.interaction.Drag); ol.interaction.DragRotate.prototype.handleDrag = function(mapBrowserEvent) { var map = mapBrowserEvent.map; var size = map.getSize(); - var offset = mapBrowserEvent.getPixel(); + var offset = mapBrowserEvent.pixel; var theta = Math.atan2(size[1] / 2 - offset[1], offset[0] - size[0] / 2); if (goog.isDef(this.lastAngle_)) { diff --git a/src/ol/interaction/drawinteraction.js b/src/ol/interaction/drawinteraction.js index 7702487b94..89519b9227 100644 --- a/src/ol/interaction/drawinteraction.js +++ b/src/ol/interaction/drawinteraction.js @@ -253,7 +253,7 @@ ol.interaction.Draw.prototype.handleMapBrowserEvent = function(event) { */ ol.interaction.Draw.prototype.handleClick_ = function(event) { var downPx = event.map.getEventPixel(event.target.getDown()); - var clickPx = event.getPixel(); + var clickPx = event.pixel; var dx = downPx[0] - clickPx[0]; var dy = downPx[1] - clickPx[1]; var squaredDistance = dx * dx + dy * dy; @@ -316,7 +316,7 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) { for (var i = 0, ii = potentiallyFinishCoordinates.length; i < ii; i++) { var finishCoordinate = potentiallyFinishCoordinates[i]; var finishPixel = map.getPixelFromCoordinate(finishCoordinate); - var pixel = event.getPixel(); + var pixel = event.pixel; var dx = pixel[0] - finishPixel[0]; var dy = pixel[1] - finishPixel[1]; at = Math.sqrt(dx * dx + dy * dy) <= this.snapTolerance_; @@ -337,7 +337,7 @@ ol.interaction.Draw.prototype.atFinish_ = function(event) { * @private */ ol.interaction.Draw.prototype.startDrawing_ = function(event) { - var start = event.getCoordinate(); + var start = event.coordinate; this.finishCoordinate_ = start; var geometry; if (this.mode_ === ol.interaction.DrawMode.POINT) { @@ -368,7 +368,7 @@ ol.interaction.Draw.prototype.startDrawing_ = function(event) { * @private */ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) { - var coordinate = event.getCoordinate(); + var coordinate = event.coordinate; var geometry = this.sketchFeature_.getGeometry(); var coordinates, last; if (this.mode_ === ol.interaction.DrawMode.POINT) { @@ -416,7 +416,7 @@ ol.interaction.Draw.prototype.modifyDrawing_ = function(event) { * @private */ ol.interaction.Draw.prototype.addToDrawing_ = function(event) { - var coordinate = event.getCoordinate(); + var coordinate = event.coordinate; var geometry = this.sketchFeature_.getGeometry(); var coordinates, last; if (this.mode_ === ol.interaction.DrawMode.LINE_STRING) { diff --git a/src/ol/interaction/mousewheelzoominteraction.js b/src/ol/interaction/mousewheelzoominteraction.js index fb1c229ceb..034ca2a810 100644 --- a/src/ol/interaction/mousewheelzoominteraction.js +++ b/src/ol/interaction/mousewheelzoominteraction.js @@ -79,11 +79,10 @@ ol.interaction.MouseWheelZoom.prototype.handleMapBrowserEvent = if (mapBrowserEvent.type == goog.events.MouseWheelHandler.EventType.MOUSEWHEEL) { var map = mapBrowserEvent.map; - var mouseWheelEvent = /** @type {goog.events.MouseWheelEvent} */ - (mapBrowserEvent.browserEvent); + var mouseWheelEvent = mapBrowserEvent.browserEvent; goog.asserts.assertInstanceof(mouseWheelEvent, goog.events.MouseWheelEvent); - this.lastAnchor_ = mapBrowserEvent.getCoordinate(); + this.lastAnchor_ = mapBrowserEvent.coordinate; this.delta_ += mouseWheelEvent.deltaY / 3; if (!goog.isDef(this.startTime_)) { diff --git a/src/ol/interaction/touchinteraction.js b/src/ol/interaction/touchinteraction.js index 5ea3efab7f..3ad7d93fae 100644 --- a/src/ol/interaction/touchinteraction.js +++ b/src/ol/interaction/touchinteraction.js @@ -81,7 +81,7 @@ ol.interaction.Touch.isTouchEvent_ = function(mapBrowserEvent) { ol.interaction.Touch.prototype.updateTrackedTouches_ = function(mapBrowserEvent) { if (ol.interaction.Touch.isTouchEvent_(mapBrowserEvent)) { - var event = mapBrowserEvent.browserEvent.getBrowserEvent(); + var event = mapBrowserEvent.browserEvent; if (goog.isDef(event.targetTouches)) { // W3C touch events this.targetTouches = event.targetTouches; diff --git a/src/ol/map.js b/src/ol/map.js index dabfc3acf0..89f874014e 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -777,7 +777,7 @@ ol.Map.prototype.handleMapBrowserEvent = function(mapBrowserEvent) { // coordinates so interactions cannot be used. return; } - this.focus_ = mapBrowserEvent.getCoordinate(); + this.focus_ = mapBrowserEvent.coordinate; mapBrowserEvent.frameState = this.frameState_; var interactions = this.getInteractions(); var interactionsArray = /** @type {Array.