Socket
Socket
Sign inDemoInstall

@nextgis/control-container

Package Overview
Dependencies
Maintainers
3
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nextgis/control-container - npm Package Compare versions

Comparing version 2.2.3 to 2.3.0

12

lib/control-container.esm-browser.js

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/control-container; version: 2.2.3; author: NextGIS */
/** Bundle of @nextgis/control-container; version: 2.3.0; author: NextGIS */
function create(tagName, className, container) {

@@ -37,6 +37,3 @@ const el = window.document.createElement(tagName);

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
class ZoomControl {

@@ -122,6 +119,3 @@ constructor() {

var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
class ControlContainer {

@@ -128,0 +122,0 @@ constructor(opt = {}) {

@@ -1,2 +0,2 @@

function t(t,n,e){const o=window.document.createElement(t);return null!=n&&(o.className=n),e&&e.appendChild(o),o}function n(t){if("string"==typeof t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch(n){}return e||void 0}return t}var e=Object.defineProperty,o=(t,n,o)=>(((t,n,o)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o})(t,"symbol"!=typeof n?n+"":n,o),o);var i=Object.defineProperty,s=(t,n,e)=>(((t,n,e)=>{n in t?i(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e})(t,"symbol"!=typeof n?n+"":n,e),e);class a{constructor(t={}){s(this,"classPrefix","webmap"),s(this,"addClass"),s(this,"map"),s(this,"_container"),s(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(t){const e=n(t);return e&&e.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const e=document.createElement("div");return e.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(e,n.firstChild):n.appendChild(e),e}}addControl(t,n){const e=t.onAdd(this.map);e instanceof HTMLElement&&this.append(e,n)}append(t,n){const e=this._positionsContainers[n];if(e){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}e.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const e=this._createPositionContainer(n);this._positionsContainers[n]=e,t.appendChild(e)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}s(a,"controls",{ZOOM:class{constructor(){o(this,"map"),o(this,"_container"),o(this,"__onZoomInBtnClick"),o(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&function(t){const e=n(t);if(e){const t=e.parentElement;t&&t.removeChild(e)}}(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const e=t("button","webmap-ctrl-zoom-out",this._container);e.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),e.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}});export{a as default};
function t(t,n,e){const o=window.document.createElement(t);return null!=n&&(o.className=n),e&&e.appendChild(o),o}function n(t){if("string"==typeof t){let e=document.getElementById(t);if(!e)try{e=document.querySelector(t)}catch(n){}return e||void 0}return t}var e=Object.defineProperty,o=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);var i=Object.defineProperty,s=(t,n,e)=>((t,n,e)=>n in t?i(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e)(t,"symbol"!=typeof n?n+"":n,e);class a{constructor(t={}){s(this,"classPrefix","webmap"),s(this,"addClass"),s(this,"map"),s(this,"_container"),s(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(t){const e=n(t);return e&&e.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const e=document.createElement("div");return e.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(e,n.firstChild):n.appendChild(e),e}}addControl(t,n){const e=t.onAdd(this.map);e instanceof HTMLElement&&this.append(e,n)}append(t,n){const e=this._positionsContainers[n];if(e){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}e.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const e=this._createPositionContainer(n);this._positionsContainers[n]=e,t.appendChild(e)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}s(a,"controls",{ZOOM:class{constructor(){o(this,"map"),o(this,"_container"),o(this,"__onZoomInBtnClick"),o(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&function(t){const e=n(t);if(e){const t=e.parentElement;t&&t.removeChild(e)}}(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const e=t("button","webmap-ctrl-zoom-out",this._container);e.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),e.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}});export{a as default};
//# sourceMappingURL=control-container.esm-browser.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/control-container; version: 2.2.3; author: NextGIS */
/** Bundle of @nextgis/control-container; version: 2.3.0; author: NextGIS */
import * as dom from '@nextgis/dom';

@@ -6,6 +6,3 @@

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
class ZoomControl {

@@ -91,6 +88,3 @@ constructor() {

var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
class ControlContainer {

@@ -97,0 +91,0 @@ constructor(opt = {}) {

@@ -1,2 +0,2 @@

import*as t from"@nextgis/dom";var n=Object.defineProperty,o=(t,o,e)=>(((t,o,e)=>{o in t?n(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e})(t,"symbol"!=typeof o?o+"":o,e),e);var e=Object.defineProperty,i=(t,n,o)=>(((t,n,o)=>{n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o})(t,"symbol"!=typeof n?n+"":n,o),o);class s{constructor(t={}){i(this,"classPrefix","webmap"),i(this,"addClass"),i(this,"map"),i(this,"_container"),i(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(n){const o=t.getElement(n);return o&&o.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}}addControl(t,n){const o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)}append(t,n){const o=this._positionsContainers[n];if(o){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}o.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const o=this._createPositionContainer(n);this._positionsContainers[n]=o,t.appendChild(o)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}i(s,"controls",{ZOOM:class{constructor(){o(this,"map"),o(this,"_container"),o(this,"__onZoomInBtnClick"),o(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t.create("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&t.remove(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t.create("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const o=t.create("button","webmap-ctrl-zoom-out",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),o.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}});export{s as default};
import*as t from"@nextgis/dom";var n=Object.defineProperty,o=(t,o,e)=>((t,o,e)=>o in t?n(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e)(t,"symbol"!=typeof o?o+"":o,e);var e=Object.defineProperty,i=(t,n,o)=>((t,n,o)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);class s{constructor(t={}){i(this,"classPrefix","webmap"),i(this,"addClass"),i(this,"map"),i(this,"_container"),i(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(n){const o=t.getElement(n);return o&&o.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}}addControl(t,n){const o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)}append(t,n){const o=this._positionsContainers[n];if(o){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}o.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const o=this._createPositionContainer(n);this._positionsContainers[n]=o,t.appendChild(o)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}i(s,"controls",{ZOOM:class{constructor(){o(this,"map"),o(this,"_container"),o(this,"__onZoomInBtnClick"),o(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t.create("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&t.remove(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t.create("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const o=t.create("button","webmap-ctrl-zoom-out",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),o.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}});export{s as default};
//# sourceMappingURL=control-container.esm-bundler.prod.js.map

@@ -1,2 +0,2 @@

/** Bundle of @nextgis/control-container; version: 2.2.3; author: NextGIS */
/** Bundle of @nextgis/control-container; version: 2.3.0; author: NextGIS */
var ControlContainer = (function () {

@@ -40,6 +40,3 @@ 'use strict';

var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField$1 = (obj, key, value) => {
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField$1 = (obj, key, value) => __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
class ZoomControl {

@@ -125,6 +122,3 @@ constructor() {

var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => {
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
return value;
};
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
class ControlContainer {

@@ -131,0 +125,0 @@ constructor(opt = {}) {

@@ -1,2 +0,2 @@

var ControlContainer=function(){"use strict";function t(t,n,o){const e=window.document.createElement(t);return null!=n&&(e.className=n),o&&o.appendChild(e),e}function n(t){if("string"==typeof t){let o=document.getElementById(t);if(!o)try{o=document.querySelector(t)}catch(n){}return o||void 0}return t}var o=Object.defineProperty,e=(t,n,e)=>(((t,n,e)=>{n in t?o(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e})(t,"symbol"!=typeof n?n+"":n,e),e);var i=Object.defineProperty,s=(t,n,o)=>(((t,n,o)=>{n in t?i(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o})(t,"symbol"!=typeof n?n+"":n,o),o);class a{constructor(t={}){s(this,"classPrefix","webmap"),s(this,"addClass"),s(this,"map"),s(this,"_container"),s(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(t){const o=n(t);return o&&o.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}}addControl(t,n){const o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)}append(t,n){const o=this._positionsContainers[n];if(o){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}o.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const o=this._createPositionContainer(n);this._positionsContainers[n]=o,t.appendChild(o)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}return s(a,"controls",{ZOOM:class{constructor(){e(this,"map"),e(this,"_container"),e(this,"__onZoomInBtnClick"),e(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&function(t){const o=n(t);if(o){const t=o.parentElement;t&&t.removeChild(o)}}(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const o=t("button","webmap-ctrl-zoom-out",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),o.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}}),a}();
var ControlContainer=function(){"use strict";function t(t,n,o){const e=window.document.createElement(t);return null!=n&&(e.className=n),o&&o.appendChild(e),e}function n(t){if("string"==typeof t){let o=document.getElementById(t);if(!o)try{o=document.querySelector(t)}catch(n){}return o||void 0}return t}var o=Object.defineProperty,e=(t,n,e)=>((t,n,e)=>n in t?o(t,n,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[n]=e)(t,"symbol"!=typeof n?n+"":n,e);var i=Object.defineProperty,s=(t,n,o)=>((t,n,o)=>n in t?i(t,n,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[n]=o)(t,"symbol"!=typeof n?n+"":n,o);class a{constructor(t={}){s(this,"classPrefix","webmap"),s(this,"addClass"),s(this,"map"),s(this,"_container"),s(this,"_positionsContainers",{"bottom-left":null,"bottom-right":null,"top-left":null,"top-right":null}),this.classPrefix=t.classPrefix||this.classPrefix,this.addClass=t.addClass,this.map=t.map,this._container=this.createContainerElement()}addTo(t){const o=n(t);return o&&o.appendChild(this._container),this}detach(){const t=this._container.parentElement;t&&t.removeChild(this._container)}getContainer(){return this._container}getPositionContainer(t){const n=this._positionsContainers[t];if(n)return n}newPositionContainer(t){const n=this.getPositionContainer(t);if(n){const o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}}addControl(t,n){const o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)}append(t,n){const o=this._positionsContainers[n];if(o){if("string"==typeof t){const n=document.createElement("div");n.outerHTML=t,t=n}o.appendChild(t)}}createContainerElement(){const t=document.createElement("div");t.className=`${this.classPrefix}-control-container`+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((n=>{const o=this._createPositionContainer(n);this._positionsContainers[n]=o,t.appendChild(o)})),t}_createPositionContainer(t){const n=document.createElement("div");return n.className=`${this.classPrefix}-ctrl-${t}`,n}}return s(a,"controls",{ZOOM:class{constructor(){e(this,"map"),e(this,"_container"),e(this,"__onZoomInBtnClick"),e(this,"__onZoomOutBtnClick")}onAdd(n){if(this.map||(this.map=n),!this._container){const n=t("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container}onRemove(){this.map=void 0,this._container&&function(t){const o=n(t);if(o){const t=o.parentElement;t&&t.removeChild(o)}}(this._container)}zoomIn(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{const t=this.map.getZoom();if(t){this.map.setZoom(t+1)}}}zoomOut(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{const t=this.map.getZoom();if(t){this.map.setZoom(t-1)}}}_createContent(){if(this._container){const n=t("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';const o=t("button","webmap-ctrl-zoom-out",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=()=>this._onZoomInBtnClick(),n.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=()=>this._onZoomOutBtnClick(),o.addEventListener("click",this.__onZoomOutBtnClick)}}_onZoomInBtnClick(){this.zoomIn()}_onZoomOutBtnClick(){this.zoomOut()}}}),a}();
//# sourceMappingURL=control-container.global.prod.js.map
{
"name": "@nextgis/control-container",
"version": "2.2.3",
"version": "2.3.0",
"description": "Placing control elements in the corners of the map container",

@@ -11,5 +11,5 @@ "main": "lib/control-container.global.prod.js",

"dependencies": {
"@nextgis/dom": "^2.0.2",
"@nextgis/utils": "^2.2.3",
"@nextgis/webmap": "^2.2.3",
"@nextgis/dom": "^2.3.0",
"@nextgis/utils": "^2.3.0",
"@nextgis/webmap": "^2.3.0",
"@types/events": "^3.0.0",

@@ -19,3 +19,3 @@ "events": "*"

"devDependencies": {
"@nextgis/build-tools": "^2.0.2"
"@nextgis/build-tools": "^2.3.0"
},

@@ -55,3 +55,3 @@ "buildOptions": {

},
"gitHead": "3f367cf4bf7dfc602c12a409da5647bd3d1181ce"
"gitHead": "e25d812d39f6c704adb2884ffbf20e84ef7cb1dc"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc