PageSourceSearch

https://geroika.org.ua/zerum/leaflet/leaflet.draw/label/Marker.Label.js

js geroika.org.ua collected 2026-10-03 17:56:12 UTC 1,381 bytes, 55 lines download raw bytes

vendor: 1,381 bytes, lines 1-55
1// Add in an option to icon that is used to set where the label anchor is
2L.Icon.Default.mergeOptions({
3	labelAnchor: new L.Point(9, -20)
4});
5
6// Have to do this since Leaflet is loaded before this plugin and initializes
7// L.Marker.options.icon therefore missing our mixin above.
8L.Marker.mergeOptions({
9	icon: new L.Icon.Default()
10});
11
12L.Marker.include(L.BaseMarkerMethods);
13L.Marker.include({
14	_originalUpdateZIndex: L.Marker.prototype._updateZIndex,
15
16	_updateZIndex: function (offset) {
17		var zIndex = this._zIndex + offset;
18
19		this._originalUpdateZIndex(offset);
20
21		if (this.label) {
22			this.label.updateZIndex(zIndex);
23		}
24	},
25
26	_originalSetOpacity: L.Marker.prototype.setOpacity,
27
28	setOpacity: function (opacity, labelHasSemiTransparency) {
29		this.options.labelHasSemiTransparency = labelHasSemiTransparency;
30
31		this._originalSetOpacity(opacity);
32	},
33
34	_originalUpdateOpacity: L.Marker.prototype._updateOpacity,
35
36	_updateOpacity: function () {
37		var absoluteOpacity = this.options.opacity === 0 ? 0 : 1;
38
39		this._originalUpdateOpacity();
40
41		if (this.label) {
42			this.label.setOpacity(this.options.labelHasSemiTransparency ? this.options.opacity : absoluteOpacity);
43		}
44	},
45
46	_originalSetLatLng: L.Marker.prototype.setLatLng,
47
48	setLatLng: function (latlng) {
49		if (this.label && !this._labelNoHide) {
50			this.hideLabel();
51		}
52
53		return this._originalSetLatLng(latlng);
54	}
55});

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.