Spaces:
Sleeping
Sleeping
File size: 941 Bytes
11811dc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | // @flow
import type Point from '@mapbox/point-geometry';
import type Map from '../map';
export default class ClickZoomHandler {
_enabled: boolean;
_active: boolean;
constructor() {
this.reset();
}
reset() {
this._active = false;
}
blur() {
this.reset();
}
dblclick(e: MouseEvent, point: Point) {
e.preventDefault();
return {
cameraAnimation: (map: Map) => {
map.easeTo({
duration: 300,
zoom: map.getZoom() + (e.shiftKey ? -1 : 1),
around: map.unproject(point)
}, {originalEvent: e});
}
};
}
enable() {
this._enabled = true;
}
disable() {
this._enabled = false;
this.reset();
}
isEnabled() {
return this._enabled;
}
isActive() {
return this._active;
}
}
|