summaryrefslogtreecommitdiffstats
path: root/debian/missing-sources/leaflet.js/core/Handler.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 12:45:13 +0000
commit3c99fde45db83b531c41c350ed4d0ac2a3c40c62 (patch)
treead5257daf9e41556ed73875ab56b69162dffdac1 /debian/missing-sources/leaflet.js/core/Handler.js
parentAdding upstream version 1.1.0. (diff)
downloadicingaweb2-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/core/Handler.js')
-rw-r--r--debian/missing-sources/leaflet.js/core/Handler.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/missing-sources/leaflet.js/core/Handler.js b/debian/missing-sources/leaflet.js/core/Handler.js
new file mode 100644
index 0000000..8ad639b
--- /dev/null
+++ b/debian/missing-sources/leaflet.js/core/Handler.js
@@ -0,0 +1,57 @@
+import {Class} from './Class';
+
+/*
+ L.Handler is a base class for handler classes that are used internally to inject
+ interaction features like dragging to classes like Map and Marker.
+*/
+
+// @class Handler
+// @aka L.Handler
+// Abstract class for map interaction handlers
+
+export var Handler = Class.extend({
+ initialize: function (map) {
+ this._map = map;
+ },
+
+ // @method enable(): this
+ // Enables the handler
+ enable: function () {
+ if (this._enabled) { return this; }
+
+ this._enabled = true;
+ this.addHooks();
+ return this;
+ },
+
+ // @method disable(): this
+ // Disables the handler
+ disable: function () {
+ if (!this._enabled) { return this; }
+
+ this._enabled = false;
+ this.removeHooks();
+ return this;
+ },
+
+ // @method enabled(): Boolean
+ // Returns `true` if the handler is enabled
+ enabled: function () {
+ return !!this._enabled;
+ }
+
+ // @section Extension methods
+ // Classes inheriting from `Handler` must implement the two following methods:
+ // @method addHooks()
+ // Called when the handler is enabled, should add event hooks.
+ // @method removeHooks()
+ // Called when the handler is disabled, should remove the event hooks added previously.
+});
+
+// @section There is static function which can be called without instantiating L.Handler:
+// @function addTo(map: Map, name: String): this
+// Adds a new Handler to the given map with the given name.
+Handler.addTo = function (map, name) {
+ map.addHandler(name, this);
+ return this;
+};