ol-contextmenu 5.1.1 → 5.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -21,7 +21,9 @@ A `contextmenu` extension for [OpenLayers](http://openlayers.org/). **Requires**
21
21
 
22
22
  ## Demo
23
23
 
24
- [JSFiddle](https://jsfiddle.net/jonataswalker/ooxs1w5d/).
24
+ [CodeSandbox](https://codesandbox.io/s/openlayers-custom-context-menu-5s99kb?file=/src/index.js)
25
+
26
+ [JSFiddle](https://jsfiddle.net/jonataswalker/ooxs1w5d/)
25
27
 
26
28
  ## How to use it?
27
29
 
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.1.1
3
+ * ol-contextmenu - v5.1.2
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Sat Nov 12 2022 12:41:10 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Mon Dec 26 2022 19:24:15 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:#0003 3px 3px 5px;box-sizing:border-box}.ol-ctx-menu-container div,.ol-ctx-menu-container span,.ol-ctx-menu-container a,.ol-ctx-menu-container img,.ol-ctx-menu-container ul,.ol-ctx-menu-container li{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container *:before,.ol-ctx-menu-container *:after{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px;white-space:nowrap}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container:not(.ol-ctx-menu-hidden) li.ol-ctx-menu-submenu:hover .ol-ctx-menu-container{opacity:1;visibility:visible;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:linear-gradient(to left,rgba(0,0,0,0),rgba(0,0,0,.75),rgba(0,0,0,0))}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:left center}.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=)}.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC)}
8
+ .ol-ctx-menu-container{position:absolute;padding:8px;background:#fff;color:#222;font-size:13px;border-radius:5px;box-shadow:#0003 3px 3px 5px;box-sizing:border-box}.ol-ctx-menu-container div,.ol-ctx-menu-container span,.ol-ctx-menu-container a,.ol-ctx-menu-container img,.ol-ctx-menu-container ul,.ol-ctx-menu-container li{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}.ol-ctx-menu-container a img{border:none}.ol-ctx-menu-container *,.ol-ctx-menu-container *:before,.ol-ctx-menu-container *:after{box-sizing:inherit}.ol-ctx-menu-container.ol-ctx-menu-hidden{opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container ul{list-style:none}.ol-ctx-menu-container li{position:relative;line-height:20px;padding:2px 5px;white-space:nowrap}.ol-ctx-menu-container li:not(.ol-ctx-menu-separator):hover{cursor:pointer;background-color:#333;color:#eee}.ol-ctx-menu-container li.ol-ctx-menu-submenu .ol-ctx-menu-container{border:1px solid #eee;padding:8px;top:0;opacity:0;visibility:hidden;transition:visibility 0s linear .3s,opacity .3s}.ol-ctx-menu-container li.ol-ctx-menu-submenu:after{position:absolute;top:7px;right:10px;content:"";display:inline-block;width:.6em;height:.6em;border-right:.3em solid #222;border-top:.3em solid #222;transform:rotate(45deg)}.ol-ctx-menu-container li.ol-ctx-menu-submenu:hover:after{border-color:#eee}.ol-ctx-menu-container:not(.ol-ctx-menu-hidden) li.ol-ctx-menu-submenu:hover>.ol-ctx-menu-container{opacity:1;visibility:visible;transition-delay:0s}.ol-ctx-menu-container li.ol-ctx-menu-separator{padding:0}.ol-ctx-menu-container li.ol-ctx-menu-separator hr{border:0;height:1px;background-image:linear-gradient(to left,rgba(0,0,0,0),rgba(0,0,0,.75),rgba(0,0,0,0))}.ol-ctx-menu-icon{text-indent:20px;background-size:20px auto;background-repeat:no-repeat;background-position:left center}.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABaUlEQVQ4T72U7VHCQBCGn90GtAMuNGCswFiBWIFQgWMFxg6wArECsQKhArEBiB1Qwa1zgQn5IAYcxv13k71n3919L8KJQ07M47+BzgG9TRfZ/JBuWhS6BJFHRJICYrZGZIz3z5Ct2+B7gG6I6kt+wewdkQVwjtkAkR5mC8yu26A1oItR/cTsOweQBdgutD8G7jGm2PJ2n8oqUKIpIjd4HxTM8gvaT/F+AlmWnyWaIXKF95eNguFzTYFhNsdWu9kFgFlaFMANUH3D8wDLoLgSTSD2il8NCe2ZXQBxWDGwxmyUzzOMBZ7wy7Qb2K0wQfXjMOBuhlFpZtNty5sFaTQBuTusZdymeqs1SpYKcO9HkE3KbTd9WFijMHJQ5hBNEAYNq5Qd0dhyke0GiE4QzjqfW23mHT8Hl4DG4Lce3FPE7AtbBSdsbNqpoJLgYkRnNeUV+xwJDHTnUEkxHGbhBXUs5TjJjew/KPy94g+NRaIVRYmMXwAAAABJRU5ErkJggg==)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-in{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABc0lEQVQ4T71U21ECQRDsJgGdvQDECMQIxAjECMQILCPwzAAjECIQI0AiEDPQAPaWCBhrcKHuCUcV5f7dY3v6tUscefHIePhfwBBCF8CZqRCReRs1tQxDCH1VfQLQz4EsSY4AvIjIsgm8AhhCGKrqa9zwrqoLAKckB5HtguR1E2gBMITQU9VPAD8GICIGtl3e+xHJBwBT59xtHcsCYJZlUwA3kcGHbfDep51OZywi3/acZZm9vyJ5WR5o38uACmDunNt6ZwAkUxFZDwghDFT1jeSjiJinhVUBVNVJkiTDKO8CQA+AsbNQ7s1Ps0VVn5MkSfcCtmBoDZi1Bdx4eJ7zbBolrwPy3o9J3rWSHPs3A1BbjVKlYBaIyDgvu9LDXDU2RTZmXVW1oKyLxRD+OrkOrJLy5mVM0iaftDhuhVbsvBzMglzKUNW6IV/OOWtCM8MmVvEkmbwt83LaB19fdgOtVquUZJeknaDdobTwbOcvBzPcN/AXH1DFFWP7u9oAAAAASUVORK5CYII=)}.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABU0lEQVQ4T72U7VECMRRFz3sNaAdkacC1AtcKxApcKnCsQOwAK3CtQKxAqEBsANYOqCDPyTIC+8WCw5jfybn33dxEOPGSE/P4b6BzQG89RT47ZJoWhy5B5BGRZAMxWyEyxvtnyFdt8AagS1F9KQ6YvSMyB84xGyDSw2yO2XUbtAJ0MaqfmH0XAPIA2y7tj4F7jAm2uG1yWQZKNEHkBu+Dg2njWBJNEbnC+8uaIFRuWfuG2QxbbrOrUd0A1Tc8D7AIjkur7DAAsVf8MiWMZ3ZR2m02LPIMscATfjHqBnY7TFD9OAy4zTCCPG/MUKMM5O6wkXFr9dZq7FQqqHk/hDzbFa73cFONTZFDdRyiCcKg5rrSiLaXkiI6RjjrfG6VzDs+B5eAxuDXeYpmNRGzL2wZ/wof+du4GNFpBVqqz5HA4MM5VEYYDrOs+1I6Q9u/4Q8O9wN/AGgWjBVqQjjgAAAAAElFTkSuQmCC)}.ol-ctx-menu-container li:hover.ol-ctx-menu-zoom-out{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABYklEQVQ4T72U4VHCQBCF36tA91KAWIFYgViBWIFYgWMFYgdYgVCBWAFSgdiBFpAsFWSdxcDkQoBkhnF/ZjbfvX377ogjF4/Mw/8CVbUD4MynEJF5k2lqFapqz8yeAPRKkCXJEYAXEVnugm8BVXVgZq/FD+9mtgBwSrJfqF2QvN4FjYCq2jWzTwA/DhARh20qTdMRyQcA0xDCbZ3KCJhl2RTATaHgo+6HLMv8+xXJy+qB3l8FGoB5CKHsXcRV1b6ZvZF8FBH3NKotoJlNkiQZFONdlLtJ3rufbouZPSdJMjwIbKDQEzBrClx7eC4i33Uepmk6JnnXaOQifzMAtdGoRApugYiMI1uqKkrRWAfZo9MxM1+UZzFewl8mN4nYdVM83L7BkwbXLUrF3sfBLQDQBbDy08x8vOohXyEE71lVq9emuEk+3gZa3XYroCvwFyjP8yHJDsnxwaU08GxvS2uFhw78BbzWrxXgMbsHAAAAAElFTkSuQmCC)}
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.1.1
3
+ * ol-contextmenu - v5.1.2
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Sat Nov 12 2022 12:41:10 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Mon Dec 26 2022 19:24:15 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- var ContextMenu=function(m,h){"use strict";var H=Object.defineProperty;var U=(m,h,f)=>h in m?H(m,h,{enumerable:!0,configurable:!0,writable:!0,value:f}):m[h]=f;var r=(m,h,f)=>(U(m,typeof h!="symbol"?h+"":h,f),f);const S=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(m);var b=(n=>(n.CONTEXTMENU="contextmenu",n.CLICK="click",n.DBLCLICK="dblclick",n))(b||{}),d=(n=>(n.BEFOREOPEN="beforeopen",n.OPEN="open",n.CLOSE="close",n.ADD_MENU_ENTRY="add-menu-entry",n))(d||{});class C extends h.MapBrowserEvent{constructor(s){super(s.type,s.map,s.originalEvent)}}const k={width:150,scrollAt:4,eventType:b.CONTEXTMENU,defaultItems:!0,items:[]},p="ol-ctx-menu",a={namespace:p,container:`${p}-container`,separator:`${p}-separator`,submenu:`${p}-submenu`,hidden:`${p}-hidden`,icon:`${p}-icon`,zoomIn:`${p}-zoom-in`,zoomOut:`${p}-zoom-out`,unselectable:"ol-unselectable"},A=[{text:"Zoom In",classname:`${a.zoomIn} ${a.icon}`,callback:(n,s)=>{const e=s.getView();e.animate({zoom:Number(e.getZoom())+1,duration:700,center:n.coordinate})}},{text:"Zoom Out",classname:`${a.zoomOut} ${a.icon}`,callback:(n,s)=>{const e=s.getView();e.animate({zoom:Number(e.getZoom())-1,duration:700,center:n.coordinate})}}];var N={exports:{}};function x(){}x.prototype={on:function(n,s,e){var t=this.e||(this.e={});return(t[n]||(t[n]=[])).push({fn:s,ctx:e}),this},once:function(n,s,e){var t=this;function i(){t.off(n,i),s.apply(e,arguments)}return i._=s,this.on(n,i,e)},emit:function(n){var s=[].slice.call(arguments,1),e=((this.e||(this.e={}))[n]||[]).slice(),t=0,i=e.length;for(t;t<i;t++)e[t].fn.apply(e[t].ctx,s);return this},off:function(n,s){var e=this.e||(this.e={}),t=e[n],i=[];if(t&&s)for(var o=0,c=t.length;o<c;o++)t[o].fn!==s&&t[o].fn._!==s&&i.push(t[o]);return i.length?e[n]=i:delete e[n],this}},N.exports=x;var T=N.exports.TinyEmitter=x;const y=new T;function v(n){const s=document.createDocumentFragment(),e=document.createElement("div");for(e.innerHTML=n;e.firstChild;)s.append(e.firstChild);return s}function _(n){const s=document.importNode(n),e=n.offsetWidth;s.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;const t=v("<span>Foo</span>"),i=v("<span>Foo</span>"),o=document.createElement("li"),c=document.createElement("li");o.append(t),c.append(i),s.append(o),s.append(c),n.parentNode?.append(s);const E=s.offsetHeight/2;return n.parentNode?.removeChild(s),E}function $(n,s,e=!1){const t=`_${Math.random().toString(36).slice(2,11)}`;if(typeof s!="string"&&"text"in s){const E=`<span>${s.text}</span>`,M=v(E),l=document.createElement("li");return s.classname=s.classname||"",s.icon&&(s.classname===""?s.classname=a.icon:s.classname.includes(a.icon)===!1&&(s.classname+=` ${a.icon}`),l.setAttribute("style",`background-image:url(${s.icon})`)),l.id=t,l.className=s.classname,l.append(M),n.append(l),y.emit(d.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!1,callback:"callback"in s?s.callback:null,data:"data"in s?s.data:null},l),l}const i=`<li id="${t}" class="${a.separator}"><hr></li>`,o=v(i);n.append(o);const c=n.lastChild;return y.emit(d.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!0,callback:null,data:null},c),c}function L(n,s,e){s.forEach(t=>{if(typeof t!="string"&&"items"in t&&Array.isArray(t.items)){const i=$(n,t,!0);i.classList.add(a.submenu);const o=document.createElement("ul");o.classList.add(a.container),o.style.width=`${e}px`,i.append(o),L(o,t.items,e)}else $(n,t)})}const F="";function w(n,s){if(!n)throw new Error(s)}class D extends S.default{constructor(e={}){w(typeof e=="object","@param `opts` should be object type!");const t=document.createElement("div");super({element:t});r(this,"map");r(this,"container");r(this,"coordinate",[]);r(this,"pixel",[]);r(this,"contextMenuEventListener");r(this,"entryCallbackEventListener");r(this,"mapMoveListener");r(this,"lineHeight",0);r(this,"disabled");r(this,"opened");r(this,"items",[]);r(this,"menuEntries",new Map);r(this,"options");this.options={...k,...e};const i=document.createElement("ul");t.append(i),t.style.width=`${this.options.width}px`,t.classList.add(a.container,a.unselectable,a.hidden),this.container=t,this.contextMenuEventListener=o=>{this.handleContextMenu(o)},this.entryCallbackEventListener=o=>{this.handleEntryCallback(o)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1}clear(){for(const e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return A}countItems(){return this.menuEntries.size}extend(e){w(Array.isArray(e),"@param `items` should be an Array."),L(this.container.firstElementChild,e,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(a.hidden),this.dispatchEvent(d.CLOSE)}isOpen(){return this.opened}updatePosition(e){w(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){const e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){const e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),y.on(d.ADD_MENU_ENTRY,(i,o)=>{this.handleAddMenuEntry(i,o)},this),this.items=this.options.defaultItems?this.options.items.concat(A):this.options.items,L(this.container.firstElementChild,this.items,this.options.width);const t=this.getMenuEntriesLength();this.lineHeight=t>0?this.container.offsetHeight/t:_(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),y.off(d.ADD_MENU_ENTRY)}removeMenuEntry(e){const t=document.getElementById(e);t?.remove(),t?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new C({type:d.BEFOREOPEN,map:this.map,originalEvent:e})),!this.disabled&&(this.options.eventType===b.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)}),e.target?.addEventListener("pointerdown",t=>{this.opened&&(t.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.menuEntries.size!==0&&(this.opened=!0,this.positionContainer(),this.container.classList.remove(a.hidden),this.dispatchEvent(new C({type:d.OPEN,map:this.map,originalEvent:e})))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1||e.isSubmenu===!1).length}positionContainer(){const e=this.map.getSize()||[0,0],t={w:e[0]-this.pixel[0],h:e[1]-this.pixel[1]},i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*this.getMenuEntriesLength())},o=t.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}px`,this.container.style.top=t.h>=i.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-i.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",t.w-=i.w;const c=l=>Array.from(l.children).filter(g=>g.tagName==="LI"&&g.classList.contains(a.submenu));let E=0;const M=(l,g)=>{E+=1,c(l).forEach(O=>{const I=g>=i.w?i.w-8:(i.w+8)*-1,u=O.querySelector(`ul.${a.container}`),z=Math.round(this.lineHeight*Array.from(u.children).filter(P=>P.tagName==="LI").length);u.style.left=`${I}px`,u.style.right="auto",u.style.top=t.h>=z+i.h?"0":`-${u.offsetHeight-25}px`,u.style.bottom="auto",u.style.zIndex=String(E),c(u).length>0&&M(u,g-i.w)})};M(this.container.firstElementChild,t.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,i=this.menuEntries.get(t.id);if(!i)return;const o={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(o,this.map)}handleAddMenuEntry(e,t){this.menuEntries.set(e.id,e),"callback"in e&&typeof e.callback=="function"&&t.addEventListener("click",this.entryCallbackEventListener,!1)}}return D}(ol.control.Control,ol);
8
+ var ContextMenu=function(f,h){"use strict";var P=Object.defineProperty;var H=(f,h,u)=>h in f?P(f,h,{enumerable:!0,configurable:!0,writable:!0,value:u}):f[h]=u;var a=(f,h,u)=>(H(f,typeof h!="symbol"?h+"":h,u),u);var u=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(u||{}),p=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(p||{});class C extends h.MapBrowserEvent{constructor(n){super(n.type,n.map,n.originalEvent)}}const $={width:150,scrollAt:4,eventType:u.CONTEXTMENU,defaultItems:!0,items:[]},m="ol-ctx-menu",r={namespace:m,container:`${m}-container`,separator:`${m}-separator`,submenu:`${m}-submenu`,hidden:`${m}-hidden`,icon:`${m}-icon`,zoomIn:`${m}-zoom-in`,zoomOut:`${m}-zoom-out`,unselectable:"ol-unselectable"},A=[{text:"Zoom In",classname:`${r.zoomIn} ${r.icon}`,callback:(s,n)=>{const e=n.getView();e.animate({zoom:Number(e.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${r.zoomOut} ${r.icon}`,callback:(s,n)=>{const e=n.getView();e.animate({zoom:Number(e.getZoom())-1,duration:700,center:s.coordinate})}}];var b={},S={get exports(){return b},set exports(s){b=s}};function x(){}x.prototype={on:function(s,n,e){var t=this.e||(this.e={});return(t[s]||(t[s]=[])).push({fn:n,ctx:e}),this},once:function(s,n,e){var t=this;function i(){t.off(s,i),n.apply(e,arguments)}return i._=n,this.on(s,i,e)},emit:function(s){var n=[].slice.call(arguments,1),e=((this.e||(this.e={}))[s]||[]).slice(),t=0,i=e.length;for(t;t<i;t++)e[t].fn.apply(e[t].ctx,n);return this},off:function(s,n){var e=this.e||(this.e={}),t=e[s],i=[];if(t&&n)for(var o=0,c=t.length;o<c;o++)t[o].fn!==n&&t[o].fn._!==n&&i.push(t[o]);return i.length?e[s]=i:delete e[s],this}},S.exports=x;var k=b.TinyEmitter=x;const v=new k;function y(s){const n=document.createDocumentFragment(),e=document.createElement("div");for(e.innerHTML=s;e.firstChild;)n.append(e.firstChild);return n}function T(s){const n=document.importNode(s),e=s.offsetWidth;n.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;const t=y("<span>Foo</span>"),i=y("<span>Foo</span>"),o=document.createElement("li"),c=document.createElement("li");o.append(t),c.append(i),n.append(o),n.append(c),s.parentNode?.append(n);const E=n.offsetHeight/2;return s.parentNode?.removeChild(n),E}function N(s,n,e=!1){const t=`_${Math.random().toString(36).slice(2,11)}`;if(typeof n!="string"&&"text"in n){const E=`<span>${n.text}</span>`,M=y(E),l=document.createElement("li");return n.classname=n.classname||"",n.icon&&(n.classname===""?n.classname=r.icon:n.classname.includes(r.icon)===!1&&(n.classname+=` ${r.icon}`),l.setAttribute("style",`background-image:url(${n.icon})`)),l.id=t,l.className=n.classname,l.append(M),s.append(l),v.emit(p.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!1,callback:"callback"in n?n.callback:null,data:"data"in n?n.data:null},l),l}const i=`<li id="${t}" class="${r.separator}"><hr></li>`,o=y(i);s.append(o);const c=s.lastChild;return v.emit(p.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!0,callback:null,data:null},c),c}function L(s,n,e){n.forEach(t=>{if(typeof t!="string"&&"items"in t&&Array.isArray(t.items)){const i=N(s,t,!0);i.classList.add(r.submenu);const o=document.createElement("ul");o.classList.add(r.container),o.style.width=`${e}px`,i.append(o),L(o,t.items,e)}else N(s,t)})}const U="";function w(s,n){if(!s)throw new Error(n)}class O extends f{constructor(e={}){w(typeof e=="object","@param `opts` should be object type!");const t=document.createElement("div");super({element:t});a(this,"map");a(this,"container");a(this,"coordinate",[]);a(this,"pixel",[]);a(this,"contextMenuEventListener");a(this,"entryCallbackEventListener");a(this,"mapMoveListener");a(this,"lineHeight",0);a(this,"disabled");a(this,"opened");a(this,"items",[]);a(this,"menuEntries",new Map);a(this,"options");this.options={...$,...e};const i=document.createElement("ul");t.append(i),t.style.width=`${this.options.width}px`,t.classList.add(r.container,r.unselectable,r.hidden),this.container=t,this.contextMenuEventListener=o=>{this.handleContextMenu(o)},this.entryCallbackEventListener=o=>{this.handleEntryCallback(o)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1}clear(){for(const e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return A}countItems(){return this.menuEntries.size}extend(e){w(Array.isArray(e),"@param `items` should be an Array."),L(this.container.firstElementChild,e,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(r.hidden),this.dispatchEvent(p.CLOSE)}isOpen(){return this.opened}updatePosition(e){w(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){const e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){const e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),v.on(p.ADD_MENU_ENTRY,(i,o)=>{this.handleAddMenuEntry(i,o)},this),this.items=this.options.defaultItems?this.options.items.concat(A):this.options.items,L(this.container.firstElementChild,this.items,this.options.width);const t=this.getMenuEntriesLength();this.lineHeight=t>0?this.container.offsetHeight/t:T(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),v.off(p.ADD_MENU_ENTRY)}removeMenuEntry(e){const t=document.getElementById(e);t?.remove(),t?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new C({type:p.BEFOREOPEN,map:this.map,originalEvent:e})),!this.disabled&&(this.options.eventType===u.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)}),e.target?.addEventListener("pointerdown",t=>{this.opened&&(t.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.menuEntries.size!==0&&(this.opened=!0,this.positionContainer(),this.container.classList.remove(r.hidden),this.dispatchEvent(new C({type:p.OPEN,map:this.map,originalEvent:e})))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1||e.isSubmenu===!1).length}positionContainer(){const e=this.map.getSize()||[0,0],t={w:e[0]-this.pixel[0],h:e[1]-this.pixel[1]},i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*this.getMenuEntriesLength())},o=t.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}px`,this.container.style.top=t.h>=i.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-i.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",t.w-=i.w;const c=l=>Array.from(l.children).filter(g=>g.tagName==="LI"&&g.classList.contains(r.submenu));let E=0;const M=(l,g)=>{E+=1,c(l).forEach(D=>{const _=g>=i.w?i.w-8:(i.w+8)*-1,d=D.querySelector(`ul.${r.container}`),I=Math.round(this.lineHeight*Array.from(d.children).filter(z=>z.tagName==="LI").length);d.style.left=`${_}px`,d.style.right="auto",d.style.top=t.h>=I+i.h?"0":`-${d.offsetHeight-25}px`,d.style.bottom="auto",d.style.zIndex=String(E),c(d).length>0&&M(d,g-i.w)})};M(this.container.firstElementChild,t.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,i=this.menuEntries.get(t.id);if(!i)return;const o={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(o,this.map)}handleAddMenuEntry(e,t){this.menuEntries.set(e.id,e),this.positionContainer(),"callback"in e&&typeof e.callback=="function"&&t.addEventListener("click",this.entryCallbackEventListener,!1)}}return O}(ol.control.Control,ol);
@@ -1,17 +1,17 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.1.1
3
+ * ol-contextmenu - v5.1.2
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Sat Nov 12 2022 12:41:10 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Mon Dec 26 2022 19:24:15 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
8
  var k = Object.defineProperty;
9
9
  var T = (s, t, e) => t in s ? k(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
10
- var r = (s, t, e) => (T(s, typeof t != "symbol" ? t + "" : t, e), e);
10
+ var a = (s, t, e) => (T(s, typeof t != "symbol" ? t + "" : t, e), e);
11
11
  import O from "ol/control/Control";
12
12
  import { MapBrowserEvent as D } from "ol";
13
- var M = /* @__PURE__ */ ((s) => (s.CONTEXTMENU = "contextmenu", s.CLICK = "click", s.DBLCLICK = "dblclick", s))(M || {}), d = /* @__PURE__ */ ((s) => (s.BEFOREOPEN = "beforeopen", s.OPEN = "open", s.CLOSE = "close", s.ADD_MENU_ENTRY = "add-menu-entry", s))(d || {});
14
- class x extends D {
13
+ var b = /* @__PURE__ */ ((s) => (s.CONTEXTMENU = "contextmenu", s.CLICK = "click", s.DBLCLICK = "dblclick", s))(b || {}), p = /* @__PURE__ */ ((s) => (s.BEFOREOPEN = "beforeopen", s.OPEN = "open", s.CLOSE = "close", s.ADD_MENU_ENTRY = "add-menu-entry", s))(p || {});
14
+ class L extends D {
15
15
  constructor(t) {
16
16
  super(t.type, t.map, t.originalEvent);
17
17
  }
@@ -19,10 +19,10 @@ class x extends D {
19
19
  const _ = {
20
20
  width: 150,
21
21
  scrollAt: 4,
22
- eventType: M.CONTEXTMENU,
22
+ eventType: b.CONTEXTMENU,
23
23
  defaultItems: !0,
24
24
  items: []
25
- }, u = "ol-ctx-menu", a = {
25
+ }, u = "ol-ctx-menu", r = {
26
26
  namespace: u,
27
27
  container: `${u}-container`,
28
28
  separator: `${u}-separator`,
@@ -32,10 +32,10 @@ const _ = {
32
32
  zoomIn: `${u}-zoom-in`,
33
33
  zoomOut: `${u}-zoom-out`,
34
34
  unselectable: "ol-unselectable"
35
- }, L = [
35
+ }, w = [
36
36
  {
37
37
  text: "Zoom In",
38
- classname: `${a.zoomIn} ${a.icon}`,
38
+ classname: `${r.zoomIn} ${r.icon}`,
39
39
  callback: (s, t) => {
40
40
  const e = t.getView();
41
41
  e.animate({
@@ -47,7 +47,7 @@ const _ = {
47
47
  },
48
48
  {
49
49
  text: "Zoom Out",
50
- classname: `${a.zoomOut} ${a.icon}`,
50
+ classname: `${r.zoomOut} ${r.icon}`,
51
51
  callback: (s, t) => {
52
52
  const e = t.getView();
53
53
  e.animate({
@@ -58,10 +58,17 @@ const _ = {
58
58
  }
59
59
  }
60
60
  ];
61
- var C = { exports: {} };
62
- function b() {
61
+ var v = {}, I = {
62
+ get exports() {
63
+ return v;
64
+ },
65
+ set exports(s) {
66
+ v = s;
67
+ }
68
+ };
69
+ function x() {
63
70
  }
64
- b.prototype = {
71
+ x.prototype = {
65
72
  on: function(s, t, e) {
66
73
  var n = this.e || (this.e = {});
67
74
  return (n[s] || (n[s] = [])).push({
@@ -90,29 +97,29 @@ b.prototype = {
90
97
  return i.length ? e[s] = i : delete e[s], this;
91
98
  }
92
99
  };
93
- C.exports = b;
94
- var I = C.exports.TinyEmitter = b;
95
- const E = new I();
100
+ I.exports = x;
101
+ var z = v.TinyEmitter = x;
102
+ const E = new z();
96
103
  function g(s) {
97
104
  const t = document.createDocumentFragment(), e = document.createElement("div");
98
105
  for (e.innerHTML = s; e.firstChild; )
99
106
  t.append(e.firstChild);
100
107
  return t;
101
108
  }
102
- function z(s) {
109
+ function P(s) {
103
110
  const t = document.importNode(s), e = s.offsetWidth;
104
111
  t.style.cssText = `position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;
105
112
  const n = g("<span>Foo</span>"), i = g("<span>Foo</span>"), o = document.createElement("li"), c = document.createElement("li");
106
113
  o.append(n), c.append(i), t.append(o), t.append(c), s.parentNode?.append(t);
107
- const p = t.offsetHeight / 2;
108
- return s.parentNode?.removeChild(t), p;
114
+ const d = t.offsetHeight / 2;
115
+ return s.parentNode?.removeChild(t), d;
109
116
  }
110
- function w(s, t, e = !1) {
117
+ function C(s, t, e = !1) {
111
118
  const n = `_${Math.random().toString(36).slice(2, 11)}`;
112
119
  if (typeof t != "string" && "text" in t) {
113
- const p = `<span>${t.text}</span>`, f = g(p), l = document.createElement("li");
114
- return t.classname = t.classname || "", t.icon && (t.classname === "" ? t.classname = a.icon : t.classname.includes(a.icon) === !1 && (t.classname += ` ${a.icon}`), l.setAttribute("style", `background-image:url(${t.icon})`)), l.id = n, l.className = t.classname, l.append(f), s.append(l), E.emit(
115
- d.ADD_MENU_ENTRY,
120
+ const d = `<span>${t.text}</span>`, f = g(d), l = document.createElement("li");
121
+ return t.classname = t.classname || "", t.icon && (t.classname === "" ? t.classname = r.icon : t.classname.includes(r.icon) === !1 && (t.classname += ` ${r.icon}`), l.setAttribute("style", `background-image:url(${t.icon})`)), l.id = n, l.className = t.classname, l.append(f), s.append(l), E.emit(
122
+ p.ADD_MENU_ENTRY,
116
123
  {
117
124
  id: n,
118
125
  isSubmenu: e,
@@ -123,11 +130,11 @@ function w(s, t, e = !1) {
123
130
  l
124
131
  ), l;
125
132
  }
126
- const i = `<li id="${n}" class="${a.separator}"><hr></li>`, o = g(i);
133
+ const i = `<li id="${n}" class="${r.separator}"><hr></li>`, o = g(i);
127
134
  s.append(o);
128
135
  const c = s.lastChild;
129
136
  return E.emit(
130
- d.ADD_MENU_ENTRY,
137
+ p.ADD_MENU_ENTRY,
131
138
  {
132
139
  id: n,
133
140
  isSubmenu: e,
@@ -138,45 +145,45 @@ function w(s, t, e = !1) {
138
145
  c
139
146
  ), c;
140
147
  }
141
- function v(s, t, e) {
148
+ function M(s, t, e) {
142
149
  t.forEach((n) => {
143
150
  if (typeof n != "string" && "items" in n && Array.isArray(n.items)) {
144
- const i = w(s, n, !0);
145
- i.classList.add(a.submenu);
151
+ const i = C(s, n, !0);
152
+ i.classList.add(r.submenu);
146
153
  const o = document.createElement("ul");
147
- o.classList.add(a.container), o.style.width = `${e}px`, i.append(o), v(o, n.items, e);
154
+ o.classList.add(r.container), o.style.width = `${e}px`, i.append(o), M(o, n.items, e);
148
155
  } else
149
- w(s, n);
156
+ C(s, n);
150
157
  });
151
158
  }
152
159
  function y(s, t) {
153
160
  if (!s)
154
161
  throw new Error(t);
155
162
  }
156
- class R extends O {
163
+ class B extends O {
157
164
  constructor(e = {}) {
158
165
  y(typeof e == "object", "@param `opts` should be object type!");
159
166
  const n = document.createElement("div");
160
167
  super({ element: n });
161
- r(this, "map");
162
- r(this, "container");
163
- r(this, "coordinate", []);
164
- r(this, "pixel", []);
165
- r(this, "contextMenuEventListener");
166
- r(this, "entryCallbackEventListener");
167
- r(this, "mapMoveListener");
168
- r(this, "lineHeight", 0);
169
- r(this, "disabled");
170
- r(this, "opened");
171
- r(this, "items", []);
172
- r(this, "menuEntries", /* @__PURE__ */ new Map());
173
- r(this, "options");
168
+ a(this, "map");
169
+ a(this, "container");
170
+ a(this, "coordinate", []);
171
+ a(this, "pixel", []);
172
+ a(this, "contextMenuEventListener");
173
+ a(this, "entryCallbackEventListener");
174
+ a(this, "mapMoveListener");
175
+ a(this, "lineHeight", 0);
176
+ a(this, "disabled");
177
+ a(this, "opened");
178
+ a(this, "items", []);
179
+ a(this, "menuEntries", /* @__PURE__ */ new Map());
180
+ a(this, "options");
174
181
  this.options = { ..._, ...e };
175
182
  const i = document.createElement("ul");
176
183
  n.append(i), n.style.width = `${this.options.width}px`, n.classList.add(
177
- a.container,
178
- a.unselectable,
179
- a.hidden
184
+ r.container,
185
+ r.unselectable,
186
+ r.hidden
180
187
  ), this.container = n, this.contextMenuEventListener = (o) => {
181
188
  this.handleContextMenu(o);
182
189
  }, this.entryCallbackEventListener = (o) => {
@@ -197,20 +204,20 @@ class R extends O {
197
204
  this.disabled = !0;
198
205
  }
199
206
  getDefaultItems() {
200
- return L;
207
+ return w;
201
208
  }
202
209
  countItems() {
203
210
  return this.menuEntries.size;
204
211
  }
205
212
  extend(e) {
206
- y(Array.isArray(e), "@param `items` should be an Array."), v(
213
+ y(Array.isArray(e), "@param `items` should be an Array."), M(
207
214
  this.container.firstElementChild,
208
215
  e,
209
216
  this.options.width
210
217
  );
211
218
  }
212
219
  closeMenu() {
213
- this.opened = !1, this.container.classList.add(a.hidden), this.dispatchEvent(d.CLOSE);
220
+ this.opened = !1, this.container.classList.add(r.hidden), this.dispatchEvent(p.CLOSE);
214
221
  }
215
222
  isOpen() {
216
223
  return this.opened;
@@ -234,23 +241,23 @@ class R extends O {
234
241
  this.map = e, this.map.getViewport().addEventListener(this.options.eventType, this.contextMenuEventListener, !1), this.map.on("movestart", () => {
235
242
  this.handleMapMove();
236
243
  }), E.on(
237
- d.ADD_MENU_ENTRY,
244
+ p.ADD_MENU_ENTRY,
238
245
  (i, o) => {
239
246
  this.handleAddMenuEntry(i, o);
240
247
  },
241
248
  this
242
- ), this.items = this.options.defaultItems ? this.options.items.concat(L) : this.options.items, v(
249
+ ), this.items = this.options.defaultItems ? this.options.items.concat(w) : this.options.items, M(
243
250
  this.container.firstElementChild,
244
251
  this.items,
245
252
  this.options.width
246
253
  );
247
254
  const n = this.getMenuEntriesLength();
248
- this.lineHeight = n > 0 ? this.container.offsetHeight / n : z(this.container);
255
+ this.lineHeight = n > 0 ? this.container.offsetHeight / n : P(this.container);
249
256
  } else
250
257
  this.removeListeners(), this.clear();
251
258
  }
252
259
  removeListeners() {
253
- this.map.getViewport().removeEventListener(this.options.eventType, this.contextMenuEventListener, !1), E.off(d.ADD_MENU_ENTRY);
260
+ this.map.getViewport().removeEventListener(this.options.eventType, this.contextMenuEventListener, !1), E.off(p.ADD_MENU_ENTRY);
254
261
  }
255
262
  removeMenuEntry(e) {
256
263
  const n = document.getElementById(e);
@@ -258,12 +265,12 @@ class R extends O {
258
265
  }
259
266
  handleContextMenu(e) {
260
267
  this.coordinate = this.map.getEventCoordinate(e), this.pixel = this.map.getEventPixel(e), this.dispatchEvent(
261
- new x({
262
- type: d.BEFOREOPEN,
268
+ new L({
269
+ type: p.BEFOREOPEN,
263
270
  map: this.map,
264
271
  originalEvent: e
265
272
  })
266
- ), !this.disabled && (this.options.eventType === M.CONTEXTMENU && (e.stopPropagation(), e.preventDefault()), setTimeout(() => {
273
+ ), !this.disabled && (this.options.eventType === b.CONTEXTMENU && (e.stopPropagation(), e.preventDefault()), setTimeout(() => {
267
274
  this.openMenu(e);
268
275
  }), e.target?.addEventListener(
269
276
  "pointerdown",
@@ -274,9 +281,9 @@ class R extends O {
274
281
  ));
275
282
  }
276
283
  openMenu(e) {
277
- this.menuEntries.size !== 0 && (this.opened = !0, this.positionContainer(), this.container.classList.remove(a.hidden), this.dispatchEvent(
278
- new x({
279
- type: d.OPEN,
284
+ this.menuEntries.size !== 0 && (this.opened = !0, this.positionContainer(), this.container.classList.remove(r.hidden), this.dispatchEvent(
285
+ new L({
286
+ type: p.OPEN,
280
287
  map: this.map,
281
288
  originalEvent: e
282
289
  })
@@ -297,17 +304,17 @@ class R extends O {
297
304
  }, o = n.w >= i.w ? this.pixel[0] + 5 : this.pixel[0] - i.w;
298
305
  this.container.style.left = `${o}px`, this.container.style.top = n.h >= i.h ? `${this.pixel[1] - 10}px` : `${this.pixel[1] - i.h}px`, this.container.style.right = "auto", this.container.style.bottom = "auto", n.w -= i.w;
299
306
  const c = (l) => Array.from(l.children).filter(
300
- (m) => m.tagName === "LI" && m.classList.contains(a.submenu)
307
+ (m) => m.tagName === "LI" && m.classList.contains(r.submenu)
301
308
  );
302
- let p = 0;
309
+ let d = 0;
303
310
  const f = (l, m) => {
304
- p += 1, c(l).forEach((A) => {
311
+ d += 1, c(l).forEach((A) => {
305
312
  const N = m >= i.w ? i.w - 8 : (i.w + 8) * -1, h = A.querySelector(
306
- `ul.${a.container}`
313
+ `ul.${r.container}`
307
314
  ), $ = Math.round(
308
315
  this.lineHeight * Array.from(h.children).filter((S) => S.tagName === "LI").length
309
316
  );
310
- h.style.left = `${N}px`, h.style.right = "auto", h.style.top = n.h >= $ + i.h ? "0" : `-${h.offsetHeight - 25}px`, h.style.bottom = "auto", h.style.zIndex = String(p), c(h).length > 0 && f(h, m - i.w);
317
+ h.style.left = `${N}px`, h.style.right = "auto", h.style.top = n.h >= $ + i.h ? "0" : `-${h.offsetHeight - 25}px`, h.style.bottom = "auto", h.style.zIndex = String(d), c(h).length > 0 && f(h, m - i.w);
311
318
  });
312
319
  };
313
320
  f(this.container.firstElementChild, n.w);
@@ -327,9 +334,9 @@ class R extends O {
327
334
  this.closeMenu(), i.callback?.(o, this.map);
328
335
  }
329
336
  handleAddMenuEntry(e, n) {
330
- this.menuEntries.set(e.id, e), "callback" in e && typeof e.callback == "function" && n.addEventListener("click", this.entryCallbackEventListener, !1);
337
+ this.menuEntries.set(e.id, e), this.positionContainer(), "callback" in e && typeof e.callback == "function" && n.addEventListener("click", this.entryCallbackEventListener, !1);
331
338
  }
332
339
  }
333
340
  export {
334
- R as default
341
+ B as default
335
342
  };
@@ -1,8 +1,8 @@
1
1
 
2
2
  /*!
3
- * ol-contextmenu - v5.1.1
3
+ * ol-contextmenu - v5.1.2
4
4
  * https://github.com/jonataswalker/ol-contextmenu
5
- * Built: Sat Nov 12 2022 12:41:10 GMT-0300 (Brasilia Standard Time)
5
+ * Built: Mon Dec 26 2022 19:24:15 GMT-0300 (Brasilia Standard Time)
6
6
  */
7
7
 
8
- (function(l,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("ol/control/Control"),require("ol")):typeof define=="function"&&define.amd?define(["ol/control/Control","ol"],c):(l=typeof globalThis<"u"?globalThis:l||self,l.ContextMenu=c(l.ol.control.Control,l.ol))})(this,function(l,c){"use strict";var H=Object.defineProperty;var U=(l,c,f)=>c in l?H(l,c,{enumerable:!0,configurable:!0,writable:!0,value:f}):l[c]=f;var a=(l,c,f)=>(U(l,typeof c!="symbol"?c+"":c,f),f);const S=(n=>n&&typeof n=="object"&&"default"in n?n:{default:n})(l);var x=(n=>(n.CONTEXTMENU="contextmenu",n.CLICK="click",n.DBLCLICK="dblclick",n))(x||{}),p=(n=>(n.BEFOREOPEN="beforeopen",n.OPEN="open",n.CLOSE="close",n.ADD_MENU_ENTRY="add-menu-entry",n))(p||{});class w extends c.MapBrowserEvent{constructor(s){super(s.type,s.map,s.originalEvent)}}const T={width:150,scrollAt:4,eventType:x.CONTEXTMENU,defaultItems:!0,items:[]},m="ol-ctx-menu",r={namespace:m,container:`${m}-container`,separator:`${m}-separator`,submenu:`${m}-submenu`,hidden:`${m}-hidden`,icon:`${m}-icon`,zoomIn:`${m}-zoom-in`,zoomOut:`${m}-zoom-out`,unselectable:"ol-unselectable"},A=[{text:"Zoom In",classname:`${r.zoomIn} ${r.icon}`,callback:(n,s)=>{const e=s.getView();e.animate({zoom:Number(e.getZoom())+1,duration:700,center:n.coordinate})}},{text:"Zoom Out",classname:`${r.zoomOut} ${r.icon}`,callback:(n,s)=>{const e=s.getView();e.animate({zoom:Number(e.getZoom())-1,duration:700,center:n.coordinate})}}];var N={exports:{}};function b(){}b.prototype={on:function(n,s,e){var t=this.e||(this.e={});return(t[n]||(t[n]=[])).push({fn:s,ctx:e}),this},once:function(n,s,e){var t=this;function i(){t.off(n,i),s.apply(e,arguments)}return i._=s,this.on(n,i,e)},emit:function(n){var s=[].slice.call(arguments,1),e=((this.e||(this.e={}))[n]||[]).slice(),t=0,i=e.length;for(t;t<i;t++)e[t].fn.apply(e[t].ctx,s);return this},off:function(n,s){var e=this.e||(this.e={}),t=e[n],i=[];if(t&&s)for(var o=0,u=t.length;o<u;o++)t[o].fn!==s&&t[o].fn._!==s&&i.push(t[o]);return i.length?e[n]=i:delete e[n],this}},N.exports=b;var k=N.exports.TinyEmitter=b;const y=new k;function v(n){const s=document.createDocumentFragment(),e=document.createElement("div");for(e.innerHTML=n;e.firstChild;)s.append(e.firstChild);return s}function _(n){const s=document.importNode(n),e=n.offsetWidth;s.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;const t=v("<span>Foo</span>"),i=v("<span>Foo</span>"),o=document.createElement("li"),u=document.createElement("li");o.append(t),u.append(i),s.append(o),s.append(u),n.parentNode?.append(s);const E=s.offsetHeight/2;return n.parentNode?.removeChild(s),E}function $(n,s,e=!1){const t=`_${Math.random().toString(36).slice(2,11)}`;if(typeof s!="string"&&"text"in s){const E=`<span>${s.text}</span>`,M=v(E),h=document.createElement("li");return s.classname=s.classname||"",s.icon&&(s.classname===""?s.classname=r.icon:s.classname.includes(r.icon)===!1&&(s.classname+=` ${r.icon}`),h.setAttribute("style",`background-image:url(${s.icon})`)),h.id=t,h.className=s.classname,h.append(M),n.append(h),y.emit(p.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!1,callback:"callback"in s?s.callback:null,data:"data"in s?s.data:null},h),h}const i=`<li id="${t}" class="${r.separator}"><hr></li>`,o=v(i);n.append(o);const u=n.lastChild;return y.emit(p.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!0,callback:null,data:null},u),u}function L(n,s,e){s.forEach(t=>{if(typeof t!="string"&&"items"in t&&Array.isArray(t.items)){const i=$(n,t,!0);i.classList.add(r.submenu);const o=document.createElement("ul");o.classList.add(r.container),o.style.width=`${e}px`,i.append(o),L(o,t.items,e)}else $(n,t)})}const F="";function C(n,s){if(!n)throw new Error(s)}class D extends S.default{constructor(e={}){C(typeof e=="object","@param `opts` should be object type!");const t=document.createElement("div");super({element:t});a(this,"map");a(this,"container");a(this,"coordinate",[]);a(this,"pixel",[]);a(this,"contextMenuEventListener");a(this,"entryCallbackEventListener");a(this,"mapMoveListener");a(this,"lineHeight",0);a(this,"disabled");a(this,"opened");a(this,"items",[]);a(this,"menuEntries",new Map);a(this,"options");this.options={...T,...e};const i=document.createElement("ul");t.append(i),t.style.width=`${this.options.width}px`,t.classList.add(r.container,r.unselectable,r.hidden),this.container=t,this.contextMenuEventListener=o=>{this.handleContextMenu(o)},this.entryCallbackEventListener=o=>{this.handleEntryCallback(o)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1}clear(){for(const e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return A}countItems(){return this.menuEntries.size}extend(e){C(Array.isArray(e),"@param `items` should be an Array."),L(this.container.firstElementChild,e,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(r.hidden),this.dispatchEvent(p.CLOSE)}isOpen(){return this.opened}updatePosition(e){C(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){const e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){const e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),y.on(p.ADD_MENU_ENTRY,(i,o)=>{this.handleAddMenuEntry(i,o)},this),this.items=this.options.defaultItems?this.options.items.concat(A):this.options.items,L(this.container.firstElementChild,this.items,this.options.width);const t=this.getMenuEntriesLength();this.lineHeight=t>0?this.container.offsetHeight/t:_(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),y.off(p.ADD_MENU_ENTRY)}removeMenuEntry(e){const t=document.getElementById(e);t?.remove(),t?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new w({type:p.BEFOREOPEN,map:this.map,originalEvent:e})),!this.disabled&&(this.options.eventType===x.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)}),e.target?.addEventListener("pointerdown",t=>{this.opened&&(t.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.menuEntries.size!==0&&(this.opened=!0,this.positionContainer(),this.container.classList.remove(r.hidden),this.dispatchEvent(new w({type:p.OPEN,map:this.map,originalEvent:e})))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1||e.isSubmenu===!1).length}positionContainer(){const e=this.map.getSize()||[0,0],t={w:e[0]-this.pixel[0],h:e[1]-this.pixel[1]},i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*this.getMenuEntriesLength())},o=t.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}px`,this.container.style.top=t.h>=i.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-i.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",t.w-=i.w;const u=h=>Array.from(h.children).filter(g=>g.tagName==="LI"&&g.classList.contains(r.submenu));let E=0;const M=(h,g)=>{E+=1,u(h).forEach(O=>{const I=g>=i.w?i.w-8:(i.w+8)*-1,d=O.querySelector(`ul.${r.container}`),z=Math.round(this.lineHeight*Array.from(d.children).filter(P=>P.tagName==="LI").length);d.style.left=`${I}px`,d.style.right="auto",d.style.top=t.h>=z+i.h?"0":`-${d.offsetHeight-25}px`,d.style.bottom="auto",d.style.zIndex=String(E),u(d).length>0&&M(d,g-i.w)})};M(this.container.firstElementChild,t.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,i=this.menuEntries.get(t.id);if(!i)return;const o={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(o,this.map)}handleAddMenuEntry(e,t){this.menuEntries.set(e.id,e),"callback"in e&&typeof e.callback=="function"&&t.addEventListener("click",this.entryCallbackEventListener,!1)}}return D});
8
+ (function(l,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("ol/control/Control"),require("ol")):typeof define=="function"&&define.amd?define(["ol/control/Control","ol"],c):(l=typeof globalThis<"u"?globalThis:l||self,l.ContextMenu=c(l.ol.control.Control,l.ol))})(this,function(l,c){"use strict";var P=Object.defineProperty;var H=(l,c,d)=>c in l?P(l,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):l[c]=d;var a=(l,c,d)=>(H(l,typeof c!="symbol"?c+"":c,d),d);var d=(s=>(s.CONTEXTMENU="contextmenu",s.CLICK="click",s.DBLCLICK="dblclick",s))(d||{}),m=(s=>(s.BEFOREOPEN="beforeopen",s.OPEN="open",s.CLOSE="close",s.ADD_MENU_ENTRY="add-menu-entry",s))(m||{});class w extends c.MapBrowserEvent{constructor(n){super(n.type,n.map,n.originalEvent)}}const $={width:150,scrollAt:4,eventType:d.CONTEXTMENU,defaultItems:!0,items:[]},f="ol-ctx-menu",r={namespace:f,container:`${f}-container`,separator:`${f}-separator`,submenu:`${f}-submenu`,hidden:`${f}-hidden`,icon:`${f}-icon`,zoomIn:`${f}-zoom-in`,zoomOut:`${f}-zoom-out`,unselectable:"ol-unselectable"},A=[{text:"Zoom In",classname:`${r.zoomIn} ${r.icon}`,callback:(s,n)=>{const e=n.getView();e.animate({zoom:Number(e.getZoom())+1,duration:700,center:s.coordinate})}},{text:"Zoom Out",classname:`${r.zoomOut} ${r.icon}`,callback:(s,n)=>{const e=n.getView();e.animate({zoom:Number(e.getZoom())-1,duration:700,center:s.coordinate})}}];var x={},S={get exports(){return x},set exports(s){x=s}};function b(){}b.prototype={on:function(s,n,e){var t=this.e||(this.e={});return(t[s]||(t[s]=[])).push({fn:n,ctx:e}),this},once:function(s,n,e){var t=this;function i(){t.off(s,i),n.apply(e,arguments)}return i._=n,this.on(s,i,e)},emit:function(s){var n=[].slice.call(arguments,1),e=((this.e||(this.e={}))[s]||[]).slice(),t=0,i=e.length;for(t;t<i;t++)e[t].fn.apply(e[t].ctx,n);return this},off:function(s,n){var e=this.e||(this.e={}),t=e[s],i=[];if(t&&n)for(var o=0,u=t.length;o<u;o++)t[o].fn!==n&&t[o].fn._!==n&&i.push(t[o]);return i.length?e[s]=i:delete e[s],this}},S.exports=b;var T=x.TinyEmitter=b;const y=new T;function v(s){const n=document.createDocumentFragment(),e=document.createElement("div");for(e.innerHTML=s;e.firstChild;)n.append(e.firstChild);return n}function k(s){const n=document.importNode(s),e=s.offsetWidth;n.style.cssText=`position: fixed; top: 0; left: 0; overflow: auto; visibility: hidden; pointer-events: none; height: unset; max-height: unset; width: ${e}px`;const t=v("<span>Foo</span>"),i=v("<span>Foo</span>"),o=document.createElement("li"),u=document.createElement("li");o.append(t),u.append(i),n.append(o),n.append(u),s.parentNode?.append(n);const E=n.offsetHeight/2;return s.parentNode?.removeChild(n),E}function N(s,n,e=!1){const t=`_${Math.random().toString(36).slice(2,11)}`;if(typeof n!="string"&&"text"in n){const E=`<span>${n.text}</span>`,M=v(E),h=document.createElement("li");return n.classname=n.classname||"",n.icon&&(n.classname===""?n.classname=r.icon:n.classname.includes(r.icon)===!1&&(n.classname+=` ${r.icon}`),h.setAttribute("style",`background-image:url(${n.icon})`)),h.id=t,h.className=n.classname,h.append(M),s.append(h),y.emit(m.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!1,callback:"callback"in n?n.callback:null,data:"data"in n?n.data:null},h),h}const i=`<li id="${t}" class="${r.separator}"><hr></li>`,o=v(i);s.append(o);const u=s.lastChild;return y.emit(m.ADD_MENU_ENTRY,{id:t,isSubmenu:e,isSeparator:!0,callback:null,data:null},u),u}function L(s,n,e){n.forEach(t=>{if(typeof t!="string"&&"items"in t&&Array.isArray(t.items)){const i=N(s,t,!0);i.classList.add(r.submenu);const o=document.createElement("ul");o.classList.add(r.container),o.style.width=`${e}px`,i.append(o),L(o,t.items,e)}else N(s,t)})}const U="";function C(s,n){if(!s)throw new Error(n)}class O extends l{constructor(e={}){C(typeof e=="object","@param `opts` should be object type!");const t=document.createElement("div");super({element:t});a(this,"map");a(this,"container");a(this,"coordinate",[]);a(this,"pixel",[]);a(this,"contextMenuEventListener");a(this,"entryCallbackEventListener");a(this,"mapMoveListener");a(this,"lineHeight",0);a(this,"disabled");a(this,"opened");a(this,"items",[]);a(this,"menuEntries",new Map);a(this,"options");this.options={...$,...e};const i=document.createElement("ul");t.append(i),t.style.width=`${this.options.width}px`,t.classList.add(r.container,r.unselectable,r.hidden),this.container=t,this.contextMenuEventListener=o=>{this.handleContextMenu(o)},this.entryCallbackEventListener=o=>{this.handleEntryCallback(o)},this.mapMoveListener=()=>{this.handleMapMove()},this.disabled=!1,this.opened=!1}clear(){for(const e of this.menuEntries.keys())this.removeMenuEntry(e);this.container.replaceChildren(),this.container.append(document.createElement("ul"))}enable(){this.disabled=!1}disable(){this.disabled=!0}getDefaultItems(){return A}countItems(){return this.menuEntries.size}extend(e){C(Array.isArray(e),"@param `items` should be an Array."),L(this.container.firstElementChild,e,this.options.width)}closeMenu(){this.opened=!1,this.container.classList.add(r.hidden),this.dispatchEvent(m.CLOSE)}isOpen(){return this.opened}updatePosition(e){C(Array.isArray(e),"@param `pixel` should be an Array."),this.isOpen()&&(this.pixel=e,this.positionContainer())}pop(){const e=Array.from(this.menuEntries.keys()).pop();e&&this.removeMenuEntry(e)}shift(){const e=Array.from(this.menuEntries.keys()).shift();e&&this.removeMenuEntry(e)}push(e){e&&this.extend([e])}setMap(e){if(super.setMap(e),e){this.map=e,this.map.getViewport().addEventListener(this.options.eventType,this.contextMenuEventListener,!1),this.map.on("movestart",()=>{this.handleMapMove()}),y.on(m.ADD_MENU_ENTRY,(i,o)=>{this.handleAddMenuEntry(i,o)},this),this.items=this.options.defaultItems?this.options.items.concat(A):this.options.items,L(this.container.firstElementChild,this.items,this.options.width);const t=this.getMenuEntriesLength();this.lineHeight=t>0?this.container.offsetHeight/t:k(this.container)}else this.removeListeners(),this.clear()}removeListeners(){this.map.getViewport().removeEventListener(this.options.eventType,this.contextMenuEventListener,!1),y.off(m.ADD_MENU_ENTRY)}removeMenuEntry(e){const t=document.getElementById(e);t?.remove(),t?.removeEventListener("click",this.entryCallbackEventListener),this.menuEntries.delete(e)}handleContextMenu(e){this.coordinate=this.map.getEventCoordinate(e),this.pixel=this.map.getEventPixel(e),this.dispatchEvent(new w({type:m.BEFOREOPEN,map:this.map,originalEvent:e})),!this.disabled&&(this.options.eventType===d.CONTEXTMENU&&(e.stopPropagation(),e.preventDefault()),setTimeout(()=>{this.openMenu(e)}),e.target?.addEventListener("pointerdown",t=>{this.opened&&(t.stopPropagation(),this.closeMenu())},{once:!0}))}openMenu(e){this.menuEntries.size!==0&&(this.opened=!0,this.positionContainer(),this.container.classList.remove(r.hidden),this.dispatchEvent(new w({type:m.OPEN,map:this.map,originalEvent:e})))}getMenuEntriesLength(){return Array.from(this.menuEntries).filter(([,e])=>e.isSeparator===!1||e.isSubmenu===!1).length}positionContainer(){const e=this.map.getSize()||[0,0],t={w:e[0]-this.pixel[0],h:e[1]-this.pixel[1]},i={w:this.container.offsetWidth,h:Math.round(this.lineHeight*this.getMenuEntriesLength())},o=t.w>=i.w?this.pixel[0]+5:this.pixel[0]-i.w;this.container.style.left=`${o}px`,this.container.style.top=t.h>=i.h?`${this.pixel[1]-10}px`:`${this.pixel[1]-i.h}px`,this.container.style.right="auto",this.container.style.bottom="auto",t.w-=i.w;const u=h=>Array.from(h.children).filter(g=>g.tagName==="LI"&&g.classList.contains(r.submenu));let E=0;const M=(h,g)=>{E+=1,u(h).forEach(D=>{const _=g>=i.w?i.w-8:(i.w+8)*-1,p=D.querySelector(`ul.${r.container}`),I=Math.round(this.lineHeight*Array.from(p.children).filter(z=>z.tagName==="LI").length);p.style.left=`${_}px`,p.style.right="auto",p.style.top=t.h>=I+i.h?"0":`-${p.offsetHeight-25}px`,p.style.bottom="auto",p.style.zIndex=String(E),u(p).length>0&&M(p,g-i.w)})};M(this.container.firstElementChild,t.w)}handleMapMove(){this.closeMenu()}handleEntryCallback(e){e.preventDefault(),e.stopPropagation();const t=e.currentTarget,i=this.menuEntries.get(t.id);if(!i)return;const o={coordinate:this.coordinate,data:i.data};this.closeMenu(),i.callback?.(o,this.map)}handleAddMenuEntry(e,t){this.menuEntries.set(e.id,e),this.positionContainer(),"callback"in e&&typeof e.callback=="function"&&t.addEventListener("click",this.entryCallbackEventListener,!1)}}return O});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol-contextmenu",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "Custom Context Menu for Openlayers",
5
5
  "type": "module",
6
6
  "main": "./dist/ol-contextmenu.umd.cjs",
@@ -42,27 +42,29 @@
42
42
  "lint": "eslint --cache --ext .js .",
43
43
  "lint:fix": "npm run lint -- --fix",
44
44
  "test": "jest",
45
- "prepublishOnly": "npm run lint && npm test && npm run build"
45
+ "prepublishOnly": "npm run lint && npm test && npm run build",
46
+ "prepare": "husky install"
46
47
  },
47
48
  "devDependencies": {
48
- "@swc/core": "^1.3.15",
49
- "@swc/jest": "^0.2.23",
50
- "@types/jest": "^29.2.2",
51
- "eslint": "^8.27.0",
52
- "eslint-config-jwalker": "^7.9.2",
49
+ "@swc/core": "^1.3.24",
50
+ "@swc/jest": "^0.2.24",
51
+ "@types/jest": "^29.2.4",
52
+ "eslint": "^8.30.0",
53
+ "eslint-config-jwalker": "^7.10.0",
53
54
  "eslint-config-prettier": "^8.5.0",
54
- "eslint-plugin-jest": "^27.1.5",
55
+ "eslint-plugin-jest": "^27.1.7",
55
56
  "eslint-plugin-prettier": "^4.2.1",
57
+ "husky": "^8.0.2",
56
58
  "identity-obj-proxy": "^3.0.0",
57
59
  "jest": "^29.3.1",
58
60
  "jest-environment-jsdom": "^29.3.1",
59
- "ol": "^7.1.0",
60
- "prettier": "^2.7.1",
61
+ "ol": "^7.2.2",
62
+ "prettier": "^2.8.1",
61
63
  "rimraf": "^3.0.2",
62
- "typescript": "^4.8.4",
63
- "vite": "^3.2.3",
64
- "vite-plugin-banner": "^0.6.1",
65
- "vite-plugin-dts": "^1.7.0"
64
+ "typescript": "^4.9.4",
65
+ "vite": "^4.0.3",
66
+ "vite-plugin-banner": "^0.7.0",
67
+ "vite-plugin-dts": "^1.7.1"
66
68
  },
67
69
  "peerDependencies": {
68
70
  "ol": "^7.1.0"