diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:45:13 +0000 |
commit | 3c99fde45db83b531c41c350ed4d0ac2a3c40c62 (patch) | |
tree | ad5257daf9e41556ed73875ab56b69162dffdac1 /debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js | |
parent | Adding upstream version 1.1.0. (diff) | |
download | icingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.tar.xz icingaweb2-module-map-3c99fde45db83b531c41c350ed4d0ac2a3c40c62.zip |
Adding debian version 1.1.0-3.debian/1.1.0-3debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js')
-rw-r--r-- | debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js b/debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js new file mode 100644 index 0000000..c105e8e --- /dev/null +++ b/debian/missing-sources/leaflet.js/map/handler/Map.DoubleClickZoom.js @@ -0,0 +1,55 @@ +import {Map} from '../Map'; +import {Handler} from '../../core/Handler'; + +/* + * L.Handler.DoubleClickZoom is used to handle double-click zoom on the map, enabled by default. + */ + +// @namespace Map +// @section Interaction Options + +Map.mergeOptions({ + // @option doubleClickZoom: Boolean|String = true + // Whether the map can be zoomed in by double clicking on it and + // zoomed out by double clicking while holding shift. If passed + // `'center'`, double-click zoom will zoom to the center of the + // view regardless of where the mouse was. + doubleClickZoom: true +}); + +export var DoubleClickZoom = Handler.extend({ + addHooks: function () { + this._map.on('dblclick', this._onDoubleClick, this); + }, + + removeHooks: function () { + this._map.off('dblclick', this._onDoubleClick, this); + }, + + _onDoubleClick: function (e) { + var map = this._map, + oldZoom = map.getZoom(), + delta = map.options.zoomDelta, + zoom = e.originalEvent.shiftKey ? oldZoom - delta : oldZoom + delta; + + if (map.options.doubleClickZoom === 'center') { + map.setZoom(zoom); + } else { + map.setZoomAround(e.containerPoint, zoom); + } + } +}); + +// @section Handlers +// +// Map properties include interaction handlers that allow you to control +// interaction behavior in runtime, enabling or disabling certain features such +// as dragging or touch zoom (see `Handler` methods). For example: +// +// ```js +// map.doubleClickZoom.disable(); +// ``` +// +// @property doubleClickZoom: Handler +// Double click zoom handler. +Map.addInitHook('addHandler', 'doubleClickZoom', DoubleClickZoom); |