Fix private scope issues in ol/interaction/*
This commit is contained in:
@@ -20,9 +20,7 @@ class DoubleClickZoom extends Interaction {
|
||||
* @param {Options=} opt_options Options.
|
||||
*/
|
||||
constructor(opt_options) {
|
||||
super({
|
||||
handleEvent: handleEvent,
|
||||
});
|
||||
super();
|
||||
|
||||
const options = opt_options ? opt_options : {};
|
||||
|
||||
@@ -38,28 +36,27 @@ class DoubleClickZoom extends Interaction {
|
||||
*/
|
||||
this.duration_ = options.duration !== undefined ? options.duration : 250;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
|
||||
* doubleclick) and eventually zooms the map.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
* @this {DoubleClickZoom}
|
||||
*/
|
||||
function handleEvent(mapBrowserEvent) {
|
||||
let stopEvent = false;
|
||||
if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
|
||||
const browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
|
||||
const map = mapBrowserEvent.map;
|
||||
const anchor = mapBrowserEvent.coordinate;
|
||||
const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
const view = map.getView();
|
||||
zoomByDelta(view, delta, anchor, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
/**
|
||||
* Handles the {@link module:ol/MapBrowserEvent map browser event} (if it was a
|
||||
* doubleclick) and eventually zooms the map.
|
||||
* @param {import("../MapBrowserEvent.js").default} mapBrowserEvent Map browser event.
|
||||
* @return {boolean} `false` to stop event propagation.
|
||||
*/
|
||||
handleEvent(mapBrowserEvent) {
|
||||
let stopEvent = false;
|
||||
if (mapBrowserEvent.type == MapBrowserEventType.DBLCLICK) {
|
||||
const browserEvent = /** @type {MouseEvent} */ (mapBrowserEvent.originalEvent);
|
||||
const map = mapBrowserEvent.map;
|
||||
const anchor = mapBrowserEvent.coordinate;
|
||||
const delta = browserEvent.shiftKey ? -this.delta_ : this.delta_;
|
||||
const view = map.getView();
|
||||
zoomByDelta(view, delta, anchor, this.duration_);
|
||||
mapBrowserEvent.preventDefault();
|
||||
stopEvent = true;
|
||||
}
|
||||
return !stopEvent;
|
||||
}
|
||||
return !stopEvent;
|
||||
}
|
||||
|
||||
export default DoubleClickZoom;
|
||||
|
||||
Reference in New Issue
Block a user