@nextgis/control-container
Advanced tools
Comparing version 1.16.9 to 1.17.0
@@ -1,4 +0,4 @@ | ||
/** Bundle of @nextgis/control-container; version: 1.16.9; author: NextGIS */ | ||
/** Bundle of @nextgis/control-container; version: 1.17.0; author: NextGIS */ | ||
function create(tagName, className, container) { | ||
var el = window.document.createElement(tagName); | ||
const el = window.document.createElement(tagName); | ||
if (className !== undefined && className !== null) { | ||
@@ -24,3 +24,3 @@ el.className = className; | ||
if (typeof el === 'string') { | ||
var el_ = document.getElementById(el); | ||
let el_ = document.getElementById(el); | ||
if (!el_) { | ||
@@ -30,3 +30,3 @@ try { | ||
} | ||
catch (_a) { | ||
catch { | ||
// ignore | ||
@@ -40,7 +40,7 @@ } | ||
function remove(element) { | ||
var el = getElement(element); | ||
const el = getElement(element); | ||
if (el) { | ||
var parent_1 = el.parentElement; | ||
if (parent_1) { | ||
parent_1.removeChild(el); | ||
const parent = el.parentElement; | ||
if (parent) { | ||
parent.removeChild(el); | ||
} | ||
@@ -50,6 +50,4 @@ } | ||
var ZoomControl = /** @class */ (function () { | ||
function ZoomControl() { | ||
} | ||
ZoomControl.prototype.onAdd = function (map) { | ||
class ZoomControl { | ||
onAdd(map) { | ||
if (!this.map) { | ||
@@ -59,3 +57,3 @@ this.map = map; | ||
if (!this._container) { | ||
var container = create('div', 'webmap-ctrl webmap-ctrl-group'); | ||
const container = create('div', 'webmap-ctrl webmap-ctrl-group'); | ||
this._container = container; | ||
@@ -65,4 +63,4 @@ this._createContent(); | ||
return this._container; | ||
}; | ||
ZoomControl.prototype.onRemove = function () { | ||
} | ||
onRemove() { | ||
this.map = undefined; | ||
@@ -72,4 +70,4 @@ if (this._container) { | ||
} | ||
}; | ||
ZoomControl.prototype.zoomIn = function () { | ||
} | ||
zoomIn() { | ||
if (this.map) { | ||
@@ -80,5 +78,5 @@ if (this.map.zoomIn) { | ||
else { | ||
var zoom = this.map.getZoom(); | ||
const zoom = this.map.getZoom(); | ||
if (zoom) { | ||
var toZoom = zoom + 1; | ||
const toZoom = zoom + 1; | ||
this.map.setZoom(toZoom); | ||
@@ -88,4 +86,4 @@ } | ||
} | ||
}; | ||
ZoomControl.prototype.zoomOut = function () { | ||
} | ||
zoomOut() { | ||
if (this.map) { | ||
@@ -96,5 +94,5 @@ if (this.map.zoomOut) { | ||
else { | ||
var zoom = this.map.getZoom(); | ||
const zoom = this.map.getZoom(); | ||
if (zoom) { | ||
var toZoom = zoom - 1; | ||
const toZoom = zoom - 1; | ||
this.map.setZoom(toZoom); | ||
@@ -104,30 +102,27 @@ } | ||
} | ||
}; | ||
ZoomControl.prototype._createContent = function () { | ||
var _this = this; | ||
} | ||
_createContent() { | ||
if (this._container) { | ||
var zoomInBtn = create('button', 'webmap-ctrl-zoom-in', this._container); | ||
const zoomInBtn = create('button', 'webmap-ctrl-zoom-in', this._container); | ||
zoomInBtn.innerHTML = | ||
'<span class="webmap-ctrl-icon" aria-hidden="true"></span>'; | ||
var zoomOutBtn = create('button', 'webmap-ctrl-zoom-out', this._container); | ||
const zoomOutBtn = create('button', 'webmap-ctrl-zoom-out', this._container); | ||
zoomOutBtn.innerHTML = | ||
'<span class="webmap-ctrl-icon" aria-hidden="true"></span>'; | ||
this.__onZoomInBtnClick = function () { return _this._onZoomInBtnClick(); }; | ||
this.__onZoomInBtnClick = () => this._onZoomInBtnClick(); | ||
zoomInBtn.addEventListener('click', this.__onZoomInBtnClick); | ||
this.__onZoomOutBtnClick = function () { return _this._onZoomOutBtnClick(); }; | ||
this.__onZoomOutBtnClick = () => this._onZoomOutBtnClick(); | ||
zoomOutBtn.addEventListener('click', this.__onZoomOutBtnClick); | ||
} | ||
}; | ||
ZoomControl.prototype._onZoomInBtnClick = function () { | ||
} | ||
_onZoomInBtnClick() { | ||
this.zoomIn(); | ||
}; | ||
ZoomControl.prototype._onZoomOutBtnClick = function () { | ||
} | ||
_onZoomOutBtnClick() { | ||
this.zoomOut(); | ||
}; | ||
return ZoomControl; | ||
}()); | ||
} | ||
} | ||
var ControlContainer$1 = /** @class */ (function () { | ||
function ControlContainer(opt) { | ||
if (opt === void 0) { opt = {}; } | ||
class ControlContainer$1 { | ||
constructor(opt = {}) { | ||
this.classPrefix = 'webmap'; | ||
@@ -145,4 +140,4 @@ this._positionsContainers = { | ||
} | ||
ControlContainer.prototype.addTo = function (el) { | ||
var el_ = getElement(el); | ||
addTo(el) { | ||
const el_ = getElement(el); | ||
if (el_) { | ||
@@ -152,22 +147,22 @@ el_.appendChild(this._container); | ||
return this; | ||
}; | ||
ControlContainer.prototype.detach = function () { | ||
var parent = this._container.parentElement; | ||
} | ||
detach() { | ||
const parent = this._container.parentElement; | ||
if (parent) { | ||
parent.removeChild(this._container); | ||
} | ||
}; | ||
ControlContainer.prototype.getContainer = function () { | ||
} | ||
getContainer() { | ||
return this._container; | ||
}; | ||
ControlContainer.prototype.getPositionContainer = function (position) { | ||
var positionContainer = this._positionsContainers[position]; | ||
} | ||
getPositionContainer(position) { | ||
const positionContainer = this._positionsContainers[position]; | ||
if (positionContainer) { | ||
return positionContainer; | ||
} | ||
}; | ||
ControlContainer.prototype.newPositionContainer = function (position) { | ||
var positionContainer = this.getPositionContainer(position); | ||
} | ||
newPositionContainer(position) { | ||
const positionContainer = this.getPositionContainer(position); | ||
if (positionContainer) { | ||
var newContainer = document.createElement('div'); | ||
const newContainer = document.createElement('div'); | ||
newContainer.className = 'openlayers-ctrl'; | ||
@@ -184,14 +179,14 @@ // reserve place for async loaded containers | ||
} | ||
}; | ||
ControlContainer.prototype.addControl = function (control, position) { | ||
var controlContainer = control.onAdd(this.map); | ||
} | ||
addControl(control, position) { | ||
const controlContainer = control.onAdd(this.map); | ||
if (controlContainer instanceof HTMLElement) { | ||
this.append(controlContainer, position); | ||
} | ||
}; | ||
ControlContainer.prototype.append = function (element, position) { | ||
var positionContainer = this._positionsContainers[position]; | ||
} | ||
append(element, position) { | ||
const positionContainer = this._positionsContainers[position]; | ||
if (positionContainer) { | ||
if (typeof element === 'string') { | ||
var el = document.createElement('div'); | ||
const el = document.createElement('div'); | ||
el.outerHTML = element; | ||
@@ -202,10 +197,9 @@ element = el; | ||
} | ||
}; | ||
ControlContainer.prototype.createContainerElement = function () { | ||
var _this = this; | ||
var element = document.createElement('div'); | ||
} | ||
createContainerElement() { | ||
const element = document.createElement('div'); | ||
element.className = | ||
"".concat(this.classPrefix, "-control-container") + | ||
`${this.classPrefix}-control-container` + | ||
(this.addClass ? ' ' + this.addClass : ''); | ||
var positions = [ | ||
const positions = [ | ||
'top-right', | ||
@@ -216,19 +210,18 @@ 'top-left', | ||
]; | ||
positions.forEach(function (x) { | ||
var positionContainer = _this._createPositionContainer(x); | ||
_this._positionsContainers[x] = positionContainer; | ||
positions.forEach((x) => { | ||
const positionContainer = this._createPositionContainer(x); | ||
this._positionsContainers[x] = positionContainer; | ||
element.appendChild(positionContainer); | ||
}); | ||
return element; | ||
}; | ||
ControlContainer.prototype._createPositionContainer = function (position) { | ||
var positionContainer = document.createElement('div'); | ||
positionContainer.className = "".concat(this.classPrefix, "-ctrl-").concat(position); | ||
} | ||
_createPositionContainer(position) { | ||
const positionContainer = document.createElement('div'); | ||
positionContainer.className = `${this.classPrefix}-ctrl-${position}`; | ||
return positionContainer; | ||
}; | ||
ControlContainer.controls = { | ||
ZOOM: ZoomControl, | ||
}; | ||
return ControlContainer; | ||
}()); | ||
} | ||
} | ||
ControlContainer$1.controls = { | ||
ZOOM: ZoomControl, | ||
}; | ||
@@ -235,0 +228,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
function t(t,n,o){var i=window.document.createElement(t);return null!=n&&(i.className=n),o&&o.appendChild(i),i}function n(t){if("string"==typeof t){var n=document.getElementById(t);if(!n)try{n=document.querySelector(t)}catch(o){}return n||void 0}return t}var o=function(){function o(){}return o.prototype.onAdd=function(n){if(this.map||(this.map=n),!this._container){var o=t("div","webmap-ctrl webmap-ctrl-group");this._container=o,this._createContent()}return this._container},o.prototype.onRemove=function(){this.map=void 0,this._container&&function(t){var o=n(t);if(o){var i=o.parentElement;i&&i.removeChild(o)}}(this._container)},o.prototype.zoomIn=function(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{var t=this.map.getZoom();if(t)this.map.setZoom(t+1)}},o.prototype.zoomOut=function(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{var t=this.map.getZoom();if(t)this.map.setZoom(t-1)}},o.prototype._createContent=function(){var n=this;if(this._container){var o=t("button","webmap-ctrl-zoom-in",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';var i=t("button","webmap-ctrl-zoom-out",this._container);i.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=function(){return n._onZoomInBtnClick()},o.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=function(){return n._onZoomOutBtnClick()},i.addEventListener("click",this.__onZoomOutBtnClick)}},o.prototype._onZoomInBtnClick=function(){this.zoomIn()},o.prototype._onZoomOutBtnClick=function(){this.zoomOut()},o}(),i=function(){function t(t){void 0===t&&(t={}),this.classPrefix="webmap",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()}return t.prototype.addTo=function(t){var o=n(t);return o&&o.appendChild(this._container),this},t.prototype.detach=function(){var t=this._container.parentElement;t&&t.removeChild(this._container)},t.prototype.getContainer=function(){return this._container},t.prototype.getPositionContainer=function(t){var n=this._positionsContainers[t];if(n)return n},t.prototype.newPositionContainer=function(t){var n=this.getPositionContainer(t);if(n){var o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}},t.prototype.addControl=function(t,n){var o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)},t.prototype.append=function(t,n){var o=this._positionsContainers[n];if(o){if("string"==typeof t){var i=document.createElement("div");i.outerHTML=t,t=i}o.appendChild(t)}},t.prototype.createContainerElement=function(){var t=this,n=document.createElement("div");n.className="".concat(this.classPrefix,"-control-container")+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((function(o){var i=t._createPositionContainer(o);t._positionsContainers[o]=i,n.appendChild(i)})),n},t.prototype._createPositionContainer=function(t){var n=document.createElement("div");return n.className="".concat(this.classPrefix,"-ctrl-").concat(t),n},t.controls={ZOOM:o},t}(),e=i;export{e as default}; | ||
function t(t,n,o){const i=window.document.createElement(t);return null!=n&&(i.className=n),o&&o.appendChild(i),i}function n(t){if("string"==typeof t){let n=document.getElementById(t);if(!n)try{n=document.querySelector(t)}catch{}return n||void 0}return t}class o{constructor(t={}){this.classPrefix="webmap",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}}o.controls={ZOOM:class{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()}}};var i=o;export{i as default}; | ||
//# sourceMappingURL=control-container.esm-browser.prod.js.map |
@@ -1,8 +0,6 @@ | ||
/** Bundle of @nextgis/control-container; version: 1.16.9; author: NextGIS */ | ||
/** Bundle of @nextgis/control-container; version: 1.17.0; author: NextGIS */ | ||
import * as dom from '@nextgis/dom'; | ||
var ZoomControl = /** @class */ (function () { | ||
function ZoomControl() { | ||
} | ||
ZoomControl.prototype.onAdd = function (map) { | ||
class ZoomControl { | ||
onAdd(map) { | ||
if (!this.map) { | ||
@@ -12,3 +10,3 @@ this.map = map; | ||
if (!this._container) { | ||
var container = dom.create('div', 'webmap-ctrl webmap-ctrl-group'); | ||
const container = dom.create('div', 'webmap-ctrl webmap-ctrl-group'); | ||
this._container = container; | ||
@@ -18,4 +16,4 @@ this._createContent(); | ||
return this._container; | ||
}; | ||
ZoomControl.prototype.onRemove = function () { | ||
} | ||
onRemove() { | ||
this.map = undefined; | ||
@@ -25,4 +23,4 @@ if (this._container) { | ||
} | ||
}; | ||
ZoomControl.prototype.zoomIn = function () { | ||
} | ||
zoomIn() { | ||
if (this.map) { | ||
@@ -33,5 +31,5 @@ if (this.map.zoomIn) { | ||
else { | ||
var zoom = this.map.getZoom(); | ||
const zoom = this.map.getZoom(); | ||
if (zoom) { | ||
var toZoom = zoom + 1; | ||
const toZoom = zoom + 1; | ||
this.map.setZoom(toZoom); | ||
@@ -41,4 +39,4 @@ } | ||
} | ||
}; | ||
ZoomControl.prototype.zoomOut = function () { | ||
} | ||
zoomOut() { | ||
if (this.map) { | ||
@@ -49,5 +47,5 @@ if (this.map.zoomOut) { | ||
else { | ||
var zoom = this.map.getZoom(); | ||
const zoom = this.map.getZoom(); | ||
if (zoom) { | ||
var toZoom = zoom - 1; | ||
const toZoom = zoom - 1; | ||
this.map.setZoom(toZoom); | ||
@@ -57,30 +55,27 @@ } | ||
} | ||
}; | ||
ZoomControl.prototype._createContent = function () { | ||
var _this = this; | ||
} | ||
_createContent() { | ||
if (this._container) { | ||
var zoomInBtn = dom.create('button', 'webmap-ctrl-zoom-in', this._container); | ||
const zoomInBtn = dom.create('button', 'webmap-ctrl-zoom-in', this._container); | ||
zoomInBtn.innerHTML = | ||
'<span class="webmap-ctrl-icon" aria-hidden="true"></span>'; | ||
var zoomOutBtn = dom.create('button', 'webmap-ctrl-zoom-out', this._container); | ||
const zoomOutBtn = dom.create('button', 'webmap-ctrl-zoom-out', this._container); | ||
zoomOutBtn.innerHTML = | ||
'<span class="webmap-ctrl-icon" aria-hidden="true"></span>'; | ||
this.__onZoomInBtnClick = function () { return _this._onZoomInBtnClick(); }; | ||
this.__onZoomInBtnClick = () => this._onZoomInBtnClick(); | ||
zoomInBtn.addEventListener('click', this.__onZoomInBtnClick); | ||
this.__onZoomOutBtnClick = function () { return _this._onZoomOutBtnClick(); }; | ||
this.__onZoomOutBtnClick = () => this._onZoomOutBtnClick(); | ||
zoomOutBtn.addEventListener('click', this.__onZoomOutBtnClick); | ||
} | ||
}; | ||
ZoomControl.prototype._onZoomInBtnClick = function () { | ||
} | ||
_onZoomInBtnClick() { | ||
this.zoomIn(); | ||
}; | ||
ZoomControl.prototype._onZoomOutBtnClick = function () { | ||
} | ||
_onZoomOutBtnClick() { | ||
this.zoomOut(); | ||
}; | ||
return ZoomControl; | ||
}()); | ||
} | ||
} | ||
var ControlContainer$1 = /** @class */ (function () { | ||
function ControlContainer(opt) { | ||
if (opt === void 0) { opt = {}; } | ||
class ControlContainer$1 { | ||
constructor(opt = {}) { | ||
this.classPrefix = 'webmap'; | ||
@@ -98,4 +93,4 @@ this._positionsContainers = { | ||
} | ||
ControlContainer.prototype.addTo = function (el) { | ||
var el_ = dom.getElement(el); | ||
addTo(el) { | ||
const el_ = dom.getElement(el); | ||
if (el_) { | ||
@@ -105,22 +100,22 @@ el_.appendChild(this._container); | ||
return this; | ||
}; | ||
ControlContainer.prototype.detach = function () { | ||
var parent = this._container.parentElement; | ||
} | ||
detach() { | ||
const parent = this._container.parentElement; | ||
if (parent) { | ||
parent.removeChild(this._container); | ||
} | ||
}; | ||
ControlContainer.prototype.getContainer = function () { | ||
} | ||
getContainer() { | ||
return this._container; | ||
}; | ||
ControlContainer.prototype.getPositionContainer = function (position) { | ||
var positionContainer = this._positionsContainers[position]; | ||
} | ||
getPositionContainer(position) { | ||
const positionContainer = this._positionsContainers[position]; | ||
if (positionContainer) { | ||
return positionContainer; | ||
} | ||
}; | ||
ControlContainer.prototype.newPositionContainer = function (position) { | ||
var positionContainer = this.getPositionContainer(position); | ||
} | ||
newPositionContainer(position) { | ||
const positionContainer = this.getPositionContainer(position); | ||
if (positionContainer) { | ||
var newContainer = document.createElement('div'); | ||
const newContainer = document.createElement('div'); | ||
newContainer.className = 'openlayers-ctrl'; | ||
@@ -137,14 +132,14 @@ // reserve place for async loaded containers | ||
} | ||
}; | ||
ControlContainer.prototype.addControl = function (control, position) { | ||
var controlContainer = control.onAdd(this.map); | ||
} | ||
addControl(control, position) { | ||
const controlContainer = control.onAdd(this.map); | ||
if (controlContainer instanceof HTMLElement) { | ||
this.append(controlContainer, position); | ||
} | ||
}; | ||
ControlContainer.prototype.append = function (element, position) { | ||
var positionContainer = this._positionsContainers[position]; | ||
} | ||
append(element, position) { | ||
const positionContainer = this._positionsContainers[position]; | ||
if (positionContainer) { | ||
if (typeof element === 'string') { | ||
var el = document.createElement('div'); | ||
const el = document.createElement('div'); | ||
el.outerHTML = element; | ||
@@ -155,10 +150,9 @@ element = el; | ||
} | ||
}; | ||
ControlContainer.prototype.createContainerElement = function () { | ||
var _this = this; | ||
var element = document.createElement('div'); | ||
} | ||
createContainerElement() { | ||
const element = document.createElement('div'); | ||
element.className = | ||
"".concat(this.classPrefix, "-control-container") + | ||
`${this.classPrefix}-control-container` + | ||
(this.addClass ? ' ' + this.addClass : ''); | ||
var positions = [ | ||
const positions = [ | ||
'top-right', | ||
@@ -169,19 +163,18 @@ 'top-left', | ||
]; | ||
positions.forEach(function (x) { | ||
var positionContainer = _this._createPositionContainer(x); | ||
_this._positionsContainers[x] = positionContainer; | ||
positions.forEach((x) => { | ||
const positionContainer = this._createPositionContainer(x); | ||
this._positionsContainers[x] = positionContainer; | ||
element.appendChild(positionContainer); | ||
}); | ||
return element; | ||
}; | ||
ControlContainer.prototype._createPositionContainer = function (position) { | ||
var positionContainer = document.createElement('div'); | ||
positionContainer.className = "".concat(this.classPrefix, "-ctrl-").concat(position); | ||
} | ||
_createPositionContainer(position) { | ||
const positionContainer = document.createElement('div'); | ||
positionContainer.className = `${this.classPrefix}-ctrl-${position}`; | ||
return positionContainer; | ||
}; | ||
ControlContainer.controls = { | ||
ZOOM: ZoomControl, | ||
}; | ||
return ControlContainer; | ||
}()); | ||
} | ||
} | ||
ControlContainer$1.controls = { | ||
ZOOM: ZoomControl, | ||
}; | ||
@@ -188,0 +181,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
import*as t from"@nextgis/dom";var n=function(){function n(){}return n.prototype.onAdd=function(n){if(this.map||(this.map=n),!this._container){var o=t.create("div","webmap-ctrl webmap-ctrl-group");this._container=o,this._createContent()}return this._container},n.prototype.onRemove=function(){this.map=void 0,this._container&&t.remove(this._container)},n.prototype.zoomIn=function(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{var t=this.map.getZoom();if(t)this.map.setZoom(t+1)}},n.prototype.zoomOut=function(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{var t=this.map.getZoom();if(t)this.map.setZoom(t-1)}},n.prototype._createContent=function(){var n=this;if(this._container){var o=t.create("button","webmap-ctrl-zoom-in",this._container);o.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';var i=t.create("button","webmap-ctrl-zoom-out",this._container);i.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this.__onZoomInBtnClick=function(){return n._onZoomInBtnClick()},o.addEventListener("click",this.__onZoomInBtnClick),this.__onZoomOutBtnClick=function(){return n._onZoomOutBtnClick()},i.addEventListener("click",this.__onZoomOutBtnClick)}},n.prototype._onZoomInBtnClick=function(){this.zoomIn()},n.prototype._onZoomOutBtnClick=function(){this.zoomOut()},n}(),o=function(){function o(t){void 0===t&&(t={}),this.classPrefix="webmap",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()}return o.prototype.addTo=function(n){var o=t.getElement(n);return o&&o.appendChild(this._container),this},o.prototype.detach=function(){var t=this._container.parentElement;t&&t.removeChild(this._container)},o.prototype.getContainer=function(){return this._container},o.prototype.getPositionContainer=function(t){var n=this._positionsContainers[t];if(n)return n},o.prototype.newPositionContainer=function(t){var n=this.getPositionContainer(t);if(n){var o=document.createElement("div");return o.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(o,n.firstChild):n.appendChild(o),o}},o.prototype.addControl=function(t,n){var o=t.onAdd(this.map);o instanceof HTMLElement&&this.append(o,n)},o.prototype.append=function(t,n){var o=this._positionsContainers[n];if(o){if("string"==typeof t){var i=document.createElement("div");i.outerHTML=t,t=i}o.appendChild(t)}},o.prototype.createContainerElement=function(){var t=this,n=document.createElement("div");n.className="".concat(this.classPrefix,"-control-container")+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((function(o){var i=t._createPositionContainer(o);t._positionsContainers[o]=i,n.appendChild(i)})),n},o.prototype._createPositionContainer=function(t){var n=document.createElement("div");return n.className="".concat(this.classPrefix,"-ctrl-").concat(t),n},o.controls={ZOOM:n},o}(),i=o;export{i as default}; | ||
import*as t from"@nextgis/dom";class n{constructor(t={}){this.classPrefix="webmap",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}}n.controls={ZOOM:class{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()}}};var o=n;export{o as default}; | ||
//# sourceMappingURL=control-container.esm-bundler.prod.js.map |
@@ -1,2 +0,2 @@ | ||
/** Bundle of @nextgis/control-container; version: 1.16.9; author: NextGIS */ | ||
/** Bundle of @nextgis/control-container; version: 1.17.0; author: NextGIS */ | ||
var ControlContainer = (function () { | ||
@@ -3,0 +3,0 @@ 'use strict'; |
{ | ||
"name": "@nextgis/control-container", | ||
"version": "1.16.9", | ||
"version": "1.17.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": "^1.16.8", | ||
"@nextgis/utils": "^1.16.8", | ||
"@nextgis/webmap": "^1.16.9", | ||
"@nextgis/dom": "^1.17.0", | ||
"@nextgis/utils": "^1.17.0", | ||
"@nextgis/webmap": "^1.17.0", | ||
"@types/events": "^3.0.0", | ||
@@ -19,3 +19,3 @@ "events": "^3.3.0" | ||
"devDependencies": { | ||
"@nextgis/build-tools": "^1.16.8" | ||
"@nextgis/build-tools": "^1.17.0" | ||
}, | ||
@@ -55,3 +55,3 @@ "buildOptions": { | ||
}, | ||
"gitHead": "2a5de98fca702773dd82adaa3ca8843be5dec03c" | ||
"gitHead": "c3162aae53c381cd6a581a2a67173fb1bf6de87e" | ||
} |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
112166
692
Updated@nextgis/dom@^1.17.0
Updated@nextgis/utils@^1.17.0
Updated@nextgis/webmap@^1.17.0