PageSourceSearch

https://www.hidro.ro/wp-content/plugins/leaftile/public/js/erictheise-rrose/leaflet.rrose-src.js?ver=7.1.2

js hidro.ro collected 2026-10-02 06:05:24 UTC 5,629 bytes, 124 lines download raw bytes

1/*
2  Copyright (c) 2012 Eric S. Theise
3  
4  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
5  documentation files (the "Software"), to deal in the Software without restriction, including without limitation the 
6  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 
7  persons to whom the Software is furnished to do so, subject to the following conditions:
8  
9  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the 
10  Software.
11  
12  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
13  WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
14  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 
15  OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16*/
17    
18L.Rrose = L.Popup.extend({
19
20  _initLayout:function () {
21    var prefix = 'leaflet-rrose',
22      container = this._container = L.DomUtil.create('div', prefix + ' ' + this.options.className + ' leaflet-zoom-animated'),
23      closeButton, wrapper;
24
25
26
27    // Set the pixel distances from the map edges at which popups are too close and need to be re-oriented.
28    var x_bound = 980, y_bound = 380;
29    // Determine the alternate direction to pop up; north mimics Leaflet's default behavior, so we initialize to that.
30    this.options.position = 'n';
31    // Then see if the point is too far north...
32    var y_diff = y_bound - this._map.latLngToContainerPoint(this._latlng).y;
33    if (y_diff > 0) {
34      this.options.position = 's'
35    }
36    // or too far east...
37    var x_diff = this._map.latLngToContainerPoint(this._latlng).x - (this._map.getSize().x - x_bound);
38    if (x_diff > 0) {
39      this.options.position += 'w'
40    } else {
41    // or too far west.
42      x_diff = x_bound - this._map.latLngToContainerPoint(this._latlng).x;
43      if (x_diff > 0) {
44        this.options.position += 'e'
45      }
46    }
47
48	var closebtn = 'right'
49	
50	if(this.options.position == 'sw')
51		closebtn = 'left'
52		
53		
54	
55	if (this.options.closeButton) {
56      closeButton = this._closeButton = L.DomUtil.create('a', prefix + '-close-button ' + this.options.position, container);
57      closeButton.href = '#close';
58      closeButton.innerHTML = '×';
59
60      L.DomEvent.on(closeButton, 'click', this._onCloseButtonClick, this);
61    }
62	
63    // Create the necessary DOM elements in the correct order. Pure 'n' and 's' conditions need only one class for styling, others need two.
64    if (/s/.test(this.options.position)) {
65      if (this.options.position === 's') {
66        this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
67        wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper', container);
68      } 
69      else {
70        this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container' + ' ' + prefix + '-tip-container-' + this.options.position, container);
71        wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper' + ' ' + prefix + '-content-wrapper-' + this.options.position, container);
72      }
73      this._tip = L.DomUtil.create('div', prefix + '-tip' + ' ' + prefix + '-tip-' + this.options.position, this._tipContainer);
74      L.DomEvent.disableClickPropagation(wrapper);
75      this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);
76      L.DomEvent.on(this._contentNode, 'mousewheel', L.DomEvent.stopPropagation);
77    } 
78    else {
79      if (this.options.position === 'n') {
80        wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper', container);
81        this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container', container);
82      } 
83      else {
84        wrapper = this._wrapper = L.DomUtil.create('div', prefix + '-content-wrapper' + ' ' + prefix + '-content-wrapper-' + this.options.position, container);
85        this._tipContainer = L.DomUtil.create('div', prefix + '-tip-container' + ' ' + prefix + '-tip-container-' + this.options.position, container);
86      }
87      L.DomEvent.disableClickPropagation(wrapper);
88      this._contentNode = L.DomUtil.create('div', prefix + '-content', wrapper);
89      L.DomEvent.on(this._contentNode, 'mousewheel', L.DomEvent.stopPropagation);
90      this._tip = L.DomUtil.create('div', prefix + '-tip' + ' ' + prefix + '-tip-' + this.options.position, this._tipContainer);
91    }
92
93  },
94
95  _updatePosition:function () {
96    var pos = this._map.latLngToLayerPoint(this._latlng),
97      is3d = L.Browser.any3d,
98      offset = this.options.offset;
99
100    if (is3d) {
101      L.DomUtil.setPosition(this._container, pos);
102    }
103
104    if (/s/.test(this.options.position)) {
105      this._containerBottom = -this._container.offsetHeight + offset.y - (is3d ? 0 : pos.y);
106    } else {
107      this._containerBottom = -offset.y - (is3d ? 0 : pos.y);
108    }
109
110    if (/e/.test(this.options.position)) {
111      this._containerLeft = offset.x + (is3d ? 0 : pos.x);
112    } 
113    else if (/w/.test(this.options.position)) {
114      this._containerLeft = -Math.round(this._containerWidth) + offset.x + (is3d ? 0 : pos.x);
115    } 
116    else {
117      this._containerLeft = -Math.round(this._containerWidth / 2) + offset.x + (is3d ? 0 : pos.x);
118    }
119
120    this._container.style.bottom = this._containerBottom + 'px';
121    this._container.style.left = this._containerLeft + 'px';
122  }
123
124});

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.