PageSourceSearch

https://biblio.toscana.it/static/js/leaflet/leaflet.touch.helper.js

js biblio.toscana.it collected 2026-10-02 17:08:29 UTC 2,099 bytes, 62 lines download raw bytes

1!(function () {
2    L.Path.TouchHelper = L[L.Layer ? 'Layer' : 'Class'].extend({
3        options: {
4            extraWeight: 25
5        },
6
7        initialize: function (path, options) {
8            L.setOptions(this, options);
9            this._sourceLayer = path;
10            var touchPathOptions = L.extend({}, path.options, {opacity: 0, fillOpacity: 0});
11            touchPathOptions.weight += this.options.extraWeight;
12
13            if (path.eachLayer) {
14                this._layer = L.layerGroup();
15                path.eachLayer(function (l) {
16                    if (l.eachLayer || l.getLatLngs) {
17                        this._layer.addLayer(L.path.touchHelper(l, L.extend({}, options, {parentLayer: this._layer})));
18                    }
19                }, this);
20            } else if (path.getLatLngs) {
21                this._layer = new path.constructor(path.getLatLngs(), touchPathOptions);
22                this._layer.feature = path.feature;
23            } else {
24                throw new Error('Unknown layer type, neither a group or a path');
25            }
26
27            this._layer.on('click dblclick mouseover mouseout mousemove', function (e) {
28                (this.options.parentLayer ? this.options.parentLayer : path).fire(e.type, e);
29            }, this);
30        },
31
32        onAdd: function (map) {
33            this._map = map;
34            this._layer.addTo(map);
35            if (!this.options.parentLayer) {
36                map.on('layerremove', this._onLayerRemoved, this);
37            }
38        },
39
40        onRemove: function (map) {
41            map.removeLayer(this._layer);
42            map.off('layerremove', this._onLayerRemoved, this);
43            this._map = null;
44        },
45
46        addTo: function (map) {
47            map.addLayer(this);
48        },
49
50        _onLayerRemoved: function (e) {
51            if (e.layer === this._sourceLayer) {
52                this._map.removeLayer(this);
53            }
54        },
55    });
56
57    L.path = L.path || {};
58
59    L.path.touchHelper = function (path, options) {
60        return new L.Path.TouchHelper(path, options);
61    }
62})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.