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 0.31.0 to 0.32.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.32.0](https://github.com/nextgis/nextgisweb_frontend/compare/v0.31.0...v0.32.0) (2020-06-03)
### Features
* **webmap:** zoomIn and zoomOut MapAdapter optional methods ([70b807f](https://github.com/nextgis/nextgisweb_frontend/commit/70b807fd1d157b5505a3d815f24a02fbb1fff6a6))
# [0.31.0](https://github.com/nextgis/nextgisweb_frontend/compare/v0.30.2...v0.31.0) (2020-05-13)

@@ -8,0 +19,0 @@

2

lib/control-container.js

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

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@nextgis/dom")):"function"==typeof define&&define.amd?define(["@nextgis/dom"],n):"object"==typeof exports?exports.ControlContainer=n(require("@nextgis/dom")):t.ControlContainer=n(t["@nextgis/dom"])}("undefined"!=typeof self?self:this,(function(t){return function(t){var n={};function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(o,i,function(n){return t[n]}.bind(null,i));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=3)}([function(n,e){n.exports=t},function(t,n){},function(t,n,e){"use strict";e.d(n,"a",(function(){return r}));e(4);var o=e(0),i=function(){function t(){}return t.prototype.onAdd=function(t){if(this.webMap||(this.webMap=t),!this._container){var n=o.create("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container},t.prototype.onRemove=function(){this.webMap=void 0,this._container&&o.remove(this._container)},t.prototype._createContent=function(){var t=this;if(this._container){var n=o.create("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';var e=o.create("button","webmap-ctrl-zoom-out",this._container);e.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this._zoomInBtn=n,this.__onZoomInBtnClick=function(){return t._onZoomInBtnClick()},n.addEventListener("click",this.__onZoomInBtnClick),this._zoomOutBtn=e,this.__onZoomOutBtnClick=function(){return t._onZoomOutBtnClick()},e.addEventListener("click",this.__onZoomOutBtnClick)}},t.prototype._onZoomInBtnClick=function(){this.changeZoom()},t.prototype._onZoomOutBtnClick=function(){this.changeZoom(!0)},t.prototype.changeZoom=function(t){var n=this.webMap;if(n){var e=n.getZoom();if(e){var o=e+(t?-1:1);n.setZoom(o)}}},t}(),r=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.webMap=t.webMap,this._container=this.createContainerElement()}return t.prototype.addTo=function(t){var n=o.getElement(t);return n&&n.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 e=document.createElement("div");return e.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(e,n.firstChild):n.appendChild(e),e}},t.prototype.addControl=function(t,n){var e=t.onAdd(this.webMap);e instanceof HTMLElement&&this.append(e,n)},t.prototype.append=function(t,n){var e=this._positionsContainers[n];if(e){if("string"==typeof t){var o=document.createElement("div");o.outerHTML=t,t=o}e.appendChild(t)}},t.prototype.createContainerElement=function(){var t=this,n=document.createElement("div");n.className=this.classPrefix+"-control-container"+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((function(e){var o=t._createPositionContainer(e);t._positionsContainers[e]=o,n.appendChild(o)})),n},t.prototype._createPositionContainer=function(t){var n=document.createElement("div");return n.className=this.classPrefix+"-ctrl-"+t,n},t.controls={ZOOM:i},t}()},function(t,n,e){"use strict";e.r(n);var o=e(2),i=e(1);for(var r in i)"default"!==r&&function(t){e.d(n,t,(function(){return i[t]}))}(r);n.default=o.a},function(t,n,e){}]).default}));
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("@nextgis/dom")):"function"==typeof define&&define.amd?define(["@nextgis/dom"],n):"object"==typeof exports?exports.ControlContainer=n(require("@nextgis/dom")):t.ControlContainer=n(t["@nextgis/dom"])}("undefined"!=typeof self?self:this,(function(t){return function(t){var n={};function e(o){if(n[o])return n[o].exports;var i=n[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,e),i.l=!0,i.exports}return e.m=t,e.c=n,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var i in t)e.d(o,i,function(n){return t[n]}.bind(null,i));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=3)}([function(n,e){n.exports=t},function(t,n){},function(t,n,e){"use strict";e.d(n,"a",(function(){return r}));e(4);var o=e(0),i=function(){function t(){}return t.prototype.onAdd=function(t){if(this.map||(this.map=t),!this._container){var n=o.create("div","webmap-ctrl webmap-ctrl-group");this._container=n,this._createContent()}return this._container},t.prototype.onRemove=function(){this.map=void 0,this._container&&o.remove(this._container)},t.prototype.zoomIn=function(){if(this.map)if(this.map.zoomIn)this.map.zoomIn();else{var t=this.map.getZoom();if(t){var n=t+1;this.map.setZoom(n)}}},t.prototype.zoomOut=function(){if(this.map)if(this.map.zoomOut)this.map.zoomOut();else{var t=this.map.getZoom();if(t){var n=t-1;this.map.setZoom(n)}}},t.prototype._createContent=function(){var t=this;if(this._container){var n=o.create("button","webmap-ctrl-zoom-in",this._container);n.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>';var e=o.create("button","webmap-ctrl-zoom-out",this._container);e.innerHTML='<span class="webmap-ctrl-icon" aria-hidden="true"></span>',this._zoomInBtn=n,this.__onZoomInBtnClick=function(){return t._onZoomInBtnClick()},n.addEventListener("click",this.__onZoomInBtnClick),this._zoomOutBtn=e,this.__onZoomOutBtnClick=function(){return t._onZoomOutBtnClick()},e.addEventListener("click",this.__onZoomOutBtnClick)}},t.prototype._onZoomInBtnClick=function(){this.zoomIn()},t.prototype._onZoomOutBtnClick=function(){this.zoomOut()},t}(),r=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 n=o.getElement(t);return n&&n.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 e=document.createElement("div");return e.className="openlayers-ctrl",-1!==t.indexOf("bottom")&&n.childElementCount?n.insertBefore(e,n.firstChild):n.appendChild(e),e}},t.prototype.addControl=function(t,n){var e=t.onAdd(this.map);e instanceof HTMLElement&&this.append(e,n)},t.prototype.append=function(t,n){var e=this._positionsContainers[n];if(e){if("string"==typeof t){var o=document.createElement("div");o.outerHTML=t,t=o}e.appendChild(t)}},t.prototype.createContainerElement=function(){var t=this,n=document.createElement("div");n.className=this.classPrefix+"-control-container"+(this.addClass?" "+this.addClass:"");return["top-right","top-left","bottom-right","bottom-left"].forEach((function(e){var o=t._createPositionContainer(e);t._positionsContainers[e]=o,n.appendChild(o)})),n},t.prototype._createPositionContainer=function(t){var n=document.createElement("div");return n.className=this.classPrefix+"-ctrl-"+t,n},t.controls={ZOOM:i},t}()},function(t,n,e){"use strict";e.r(n);var o=e(2),i=e(1);for(var r in i)"default"!==r&&function(t){e.d(n,t,(function(){return i[t]}))}(r);n.default=o.a},function(t,n,e){}]).default}));
//# sourceMappingURL=control-container.js.map

@@ -11,3 +11,3 @@ import './ControlContainer.css';

private readonly addClass?;
private readonly webMap?;
private readonly map?;
private _container;

@@ -14,0 +14,0 @@ private _positionsContainers;

@@ -1,4 +0,4 @@

import WebMap, { MapControl } from '@nextgis/webmap';
import { MapControl, MapAdapter } from '@nextgis/webmap';
export declare class ZoomControl implements MapControl {
private webMap?;
private map?;
private _container?;

@@ -9,8 +9,9 @@ private _zoomInBtn?;

private __onZoomOutBtnClick?;
onAdd(webMap: WebMap): HTMLElement;
onAdd(map: MapAdapter): HTMLElement;
onRemove(): void;
zoomIn(): void;
zoomOut(): void;
private _createContent;
private _onZoomInBtnClick;
private _onZoomOutBtnClick;
private changeZoom;
}

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

import WebMap from '@nextgis/webmap';
import { MapAdapter } from '@nextgis/webmap';
export interface ControlContainerOptions {

@@ -6,3 +6,3 @@ target?: string;

addClass?: string;
webMap?: WebMap;
map?: MapAdapter;
}
{
"name": "@nextgis/control-container",
"version": "0.31.0",
"version": "0.32.0",
"description": "Placing control elements in the corners of the map container",

@@ -9,9 +9,9 @@ "main": "lib/control-container.js",

"dependencies": {
"@nextgis/dom": "^0.31.0",
"@nextgis/utils": "^0.31.0",
"@nextgis/webmap": "^0.31.0",
"@nextgis/dom": "^0.32.0",
"@nextgis/utils": "^0.32.0",
"@nextgis/webmap": "^0.32.0",
"events": "^3.1.0"
},
"devDependencies": {
"@nextgis/build-tools": "^0.31.0",
"@nextgis/build-tools": "^0.32.0",
"install": "^0.13.0",

@@ -51,3 +51,3 @@ "mini-css-extract-plugin": "^0.9.0",

},
"gitHead": "dbaf876d0522db329934a524ac928cb34b0d76af"
"gitHead": "1aad86f16ee21b2ea87a5bfce98ecf9dad74e01f"
}

@@ -9,10 +9,7 @@ # Control Container

```text
______________________________
| |
| top-left top-right |
| |
| MAP |
| |
| bottom-left bottom-right |
|____________________________|
╭───────────────────────────────────────────╮
│ top-left top-right │
│ MAP │
│ bottom-left bottom-right │
╰───────────────────────────────────────────╯
```

@@ -19,0 +16,0 @@

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