diff --git a/scripts/vendorsjs.sh b/scripts/vendorsjs.sh index 6236936e..bb10f935 100755 --- a/scripts/vendorsjs.sh +++ b/scripts/vendorsjs.sh @@ -14,7 +14,7 @@ mkdir -p umap/static/umap/vendors/markercluster/ && cp -r node_modules/leaflet.m mkdir -p umap/static/umap/vendors/contextmenu/ && cp -r node_modules/leaflet-contextmenu/dist/leaflet.contextmenu.min.* umap/static/umap/vendors/contextmenu/ mkdir -p umap/static/umap/vendors/heat/ && cp -r node_modules/leaflet.heat/dist/leaflet-heat.js umap/static/umap/vendors/heat/ mkdir -p umap/static/umap/vendors/fullscreen/ && cp -r node_modules/leaflet-fullscreen/dist/** umap/static/umap/vendors/fullscreen/ -mkdir -p umap/static/umap/vendors/toolbar/ && cp -r node_modules/leaflet-toolbar/dist/** umap/static/umap/vendors/toolbar/ +mkdir -p umap/static/umap/vendors/toolbar/ && cp -r node_modules/leaflet-toolbar/dist/leaflet.toolbar.* umap/static/umap/vendors/toolbar/ mkdir -p umap/static/umap/vendors/formbuilder/ && cp -r node_modules/leaflet-formbuilder/Leaflet.FormBuilder.js umap/static/umap/vendors/formbuilder/ mkdir -p umap/static/umap/vendors/measurable/ && cp -r node_modules/leaflet-measurable/Leaflet.Measurable.* umap/static/umap/vendors/measurable/ mkdir -p umap/static/umap/vendors/photon/ && cp -r node_modules/leaflet.photon/leaflet.photon.js umap/static/umap/vendors/photon/ diff --git a/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.css b/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.css deleted file mode 100644 index 790981fc..00000000 --- a/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.css +++ /dev/null @@ -1,117 +0,0 @@ -/* Variables and Mixins */ -/* Generic L.Toolbar */ -.leaflet-toolbar-0 { - list-style: none; - padding-left: 0; - box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65); -} -.leaflet-toolbar-0 > li { - position: relative; -} -.leaflet-toolbar-0 > li > .leaflet-toolbar-icon { - display: block; - width: 26px; - height: 26px; - line-height: 26px; - margin-right: 0; - padding-right: 0; - border-right: 0; - text-align: center; - text-decoration: none; - background-color: #ffffff; -} -.leaflet-toolbar-0 > li > .leaflet-toolbar-icon:hover { - background-color: #f4f4f4; -} -.leaflet-toolbar-0 .leaflet-toolbar-1 { - display: none; - list-style: none; -} -.leaflet-toolbar-tip-container { - margin: 0 auto; - height: 12px; - position: relative; - overflow: hidden; -} -.leaflet-toolbar-tip { - width: 12px; - height: 12px; - margin: -6px auto 0; - background-color: #ffffff; - box-shadow: 0 1px 5px rgba(0, 0, 0, 0.65); - -webkit-transform: rotate(45deg); - -ms-transform: rotate(45deg); - transform: rotate(45deg); -} -/* L.Toolbar.Control */ -.leaflet-control-toolbar { - /* Secondary Toolbar */ -} -.leaflet-control-toolbar > li > .leaflet-toolbar-icon { - border-bottom: 1px solid #ccc; -} -.leaflet-control-toolbar > li:first-child > .leaflet-toolbar-icon { - border-top-left-radius: 4px; - border-top-right-radius: 4px; -} -.leaflet-control-toolbar > li:last-child > .leaflet-toolbar-icon { - border-bottom-left-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom-width: 0; -} -.leaflet-control-toolbar .leaflet-toolbar-1 { - margin: 0; - padding: 0; - position: absolute; - left: 26px; - /* leaflet-draw-toolbar.left + leaflet-draw-toolbar.width */ - top: 0; - white-space: nowrap; - height: 26px; -} -.leaflet-control-toolbar .leaflet-toolbar-1 > li { - display: inline-block; -} -.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon { - display: block; - background-color: #919187; - border-left: 1px solid #aaa; - color: #fff; - font: 11px/19px "Helvetica Neue", Arial, Helvetica, sans-serif; - line-height: 26px; - text-decoration: none; - padding-left: 10px; - padding-right: 10px; - height: 26px; -} -.leaflet-control-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon:hover { - background-color: #a0a098; -} -/* L.Toolbar.Popup */ -.leaflet-popup-toolbar { - position: relative; -} -.leaflet-popup-toolbar > li { - float: left; -} -.leaflet-popup-toolbar > li:first-child > .leaflet-toolbar-icon { - border-top-left-radius: 4px; - border-bottom-left-radius: 4px; -} -.leaflet-popup-toolbar > li:last-child > .leaflet-toolbar-icon { - border-top-right-radius: 4px; - border-bottom-right-radius: 4px; - border-bottom-width: 0; -} -.leaflet-popup-toolbar .leaflet-toolbar-1 { - position: absolute; - top: 26px; - left: 0; - padding-left: 0; -} -.leaflet-popup-toolbar .leaflet-toolbar-1 > li > .leaflet-toolbar-icon { - position: relative; - float: left; - width: 26px; - height: 26px; -} diff --git a/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js b/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js deleted file mode 100644 index c8e8fa44..00000000 --- a/umap/static/umap/vendors/toolbar/leaflet.toolbar-src.js +++ /dev/null @@ -1,365 +0,0 @@ -(function(window, document, undefined) { - -"use strict"; - -L.Toolbar = (L.Layer || L.Class).extend({ - statics: { - baseClass: 'leaflet-toolbar' - }, - - includes: L.Mixin.Events, - - options: { - className: '', - filter: function() { return true; }, - actions: [] - }, - - initialize: function(options) { - L.setOptions(this, options); - this._toolbar_type = this.constructor._toolbar_class_id; - }, - - addTo: function(map) { - this._arguments = [].slice.call(arguments); - - map.addLayer(this); - - return this; - }, - - onAdd: function(map) { - var currentToolbar = map._toolbars[this._toolbar_type]; - - if (this._calculateDepth() === 0) { - if (currentToolbar) { map.removeLayer(currentToolbar); } - map._toolbars[this._toolbar_type] = this; - } - }, - - onRemove: function(map) { - /* - * TODO: Cleanup event listeners. - * For some reason, this throws: - * "Uncaught TypeError: Cannot read property 'dragging' of null" - * on this._marker when a toolbar icon is clicked. - */ - // for (var i = 0, l = this._disabledEvents.length; i < l; i++) { - // L.DomEvent.off(this._ul, this._disabledEvents[i], L.DomEvent.stopPropagation); - // } - - if (this._calculateDepth() === 0) { - delete map._toolbars[this._toolbar_type]; - } - }, - - appendToContainer: function(container) { - var baseClass = this.constructor.baseClass + '-' + this._calculateDepth(), - className = baseClass + ' ' + this.options.className, - Action, action, - i, j, l, m; - - this._container = container; - this._ul = L.DomUtil.create('ul', className, container); - - /* Ensure that clicks, drags, etc. don't bubble up to the map. */ - this._disabledEvents = ['click', 'mousemove', 'dblclick']; - - for (j = 0, m = this._disabledEvents.length; j < m; j++) { - L.DomEvent.on(this._ul, this._disabledEvents[j], L.DomEvent.stopPropagation); - } - - /* Instantiate each toolbar action and add its corresponding toolbar icon. */ - for (i = 0, l = this.options.actions.length; i < l; i++) { - Action = this._getActionConstructor(this.options.actions[i]); - - action = new Action(); - action._createIcon(this, this._ul, this._arguments); - } - }, - - _getActionConstructor: function(Action) { - var args = this._arguments, - toolbar = this; - - return Action.extend({ - initialize: function() { - Action.prototype.initialize.apply(this, args); - }, - enable: function(e) { - /* Ensure that only one action in a toolbar will be active at a time. */ - if (toolbar._active) { toolbar._active.disable(); } - toolbar._active = this; - - Action.prototype.enable.call(this, e); - } - }); - }, - - /* Used to hide subToolbars without removing them from the map. */ - _hide: function() { - this._ul.style.display = 'none'; - }, - - /* Used to show subToolbars without removing them from the map. */ - _show: function() { - this._ul.style.display = 'block'; - }, - - _calculateDepth: function() { - var depth = 0, - toolbar = this.parentToolbar; - - while (toolbar) { - depth += 1; - toolbar = toolbar.parentToolbar; - } - - return depth; - } -}); - -L.toolbar = {}; - -var toolbar_class_id = 0; - -L.Toolbar.extend = function extend(props) { - var statics = L.extend({}, props.statics, { - "_toolbar_class_id": toolbar_class_id - }); - - toolbar_class_id += 1; - L.extend(props, { statics: statics }); - - return L.Class.extend.call(this, props); -}; - -L.Map.addInitHook(function() { - this._toolbars = {}; -}); - -L.ToolbarAction = L.Handler.extend({ - statics: { - baseClass: 'leaflet-toolbar-icon' - }, - - options: { - toolbarIcon: { - html: '', - className: '', - tooltip: '' - }, - subToolbar: new L.Toolbar() - }, - - initialize: function(options) { - var defaultIconOptions = L.ToolbarAction.prototype.options.toolbarIcon; - - L.setOptions(this, options); - this.options.toolbarIcon = L.extend({}, defaultIconOptions, this.options.toolbarIcon); - }, - - enable: function(e) { - if (e) { L.DomEvent.preventDefault(e); } - if (this._enabled) { return; } - this._enabled = true; - - if (this.addHooks) { this.addHooks(); } - }, - - disable: function() { - if (!this._enabled) { return; } - this._enabled = false; - - if (this.removeHooks) { this.removeHooks(); } - }, - - _createIcon: function(toolbar, container, args) { - var iconOptions = this.options.toolbarIcon; - - this.toolbar = toolbar; - this._icon = L.DomUtil.create('li', '', container); - this._link = L.DomUtil.create('a', '', this._icon); - - this._link.innerHTML = iconOptions.html; - this._link.setAttribute('href', '#'); - this._link.setAttribute('title', iconOptions.tooltip); - - L.DomUtil.addClass(this._link, this.constructor.baseClass); - if (iconOptions.className) { - L.DomUtil.addClass(this._link, iconOptions.className); - } - - L.DomEvent.on(this._link, 'click', this.enable, this); - - /* Add secondary toolbar */ - this._addSubToolbar(toolbar, this._icon, args); - }, - - _addSubToolbar: function(toolbar, container, args) { - var subToolbar = this.options.subToolbar, - addHooks = this.addHooks, - removeHooks = this.removeHooks; - - /* For calculating the nesting depth. */ - subToolbar.parentToolbar = toolbar; - - if (subToolbar.options.actions.length > 0) { - /* Make a copy of args so as not to pollute the args array used by other actions. */ - args = [].slice.call(args); - args.push(this); - - subToolbar.addTo.apply(subToolbar, args); - subToolbar.appendToContainer(container); - - this.addHooks = function(map) { - if (typeof addHooks === 'function') { addHooks.call(this, map); } - subToolbar._show(); - }; - - this.removeHooks = function(map) { - if (typeof removeHooks === 'function') { removeHooks.call(this, map); } - subToolbar._hide(); - }; - } - } -}); - -L.toolbarAction = function toolbarAction(options) { - return new L.ToolbarAction(options); -}; - -L.ToolbarAction.extendOptions = function(options) { - return this.extend({ options: options }); -}; - -L.Toolbar.Control = L.Toolbar.extend({ - statics: { - baseClass: 'leaflet-control-toolbar ' + L.Toolbar.baseClass - }, - - initialize: function(options) { - L.Toolbar.prototype.initialize.call(this, options); - - this._control = new L.Control.Toolbar(this.options); - }, - - onAdd: function(map) { - this._control.addTo(map); - - L.Toolbar.prototype.onAdd.call(this, map); - - this.appendToContainer(this._control.getContainer()); - }, - - onRemove: function(map) { - L.Toolbar.prototype.onRemove.call(this, map); - if (this._control.remove) {this._control.remove();} // Leaflet 1.0 - else {this._control.removeFrom(map);} - } -}); - -L.Control.Toolbar = L.Control.extend({ - onAdd: function() { - return L.DomUtil.create('div', ''); - } -}); - -L.toolbar.control = function(options) { - return new L.Toolbar.Control(options); -}; - -// A convenience class for built-in popup toolbars. - -L.Toolbar.Popup = L.Toolbar.extend({ - statics: { - baseClass: 'leaflet-popup-toolbar ' + L.Toolbar.baseClass - }, - - options: { - anchor: [0, 0] - }, - - initialize: function(latlng, options) { - L.Toolbar.prototype.initialize.call(this, options); - - /* - * Developers can't pass a DivIcon in the options for L.Toolbar.Popup - * (the use of DivIcons is an implementation detail which may change). - */ - this._marker = new L.Marker(latlng, { - icon : new L.DivIcon({ - className: this.options.className, - iconAnchor: [0, 0] - }) - }); - }, - - onAdd: function(map) { - this._map = map; - this._marker.addTo(map); - - L.Toolbar.prototype.onAdd.call(this, map); - - this.appendToContainer(this._marker._icon); - - this._setStyles(); - }, - - onRemove: function(map) { - map.removeLayer(this._marker); - - L.Toolbar.prototype.onRemove.call(this, map); - - delete this._map; - }, - - setLatLng: function(latlng) { - this._marker.setLatLng(latlng); - - return this; - }, - - _setStyles: function() { - var container = this._container, - toolbar = this._ul, - anchor = L.point(this.options.anchor), - icons = toolbar.querySelectorAll('.leaflet-toolbar-icon'), - buttonHeights = [], - toolbarWidth = 0, - toolbarHeight, - tipSize, - tipAnchor; - - /* Calculate the dimensions of the toolbar. */ - for (var i = 0, l = icons.length; i < l; i++) { - if (icons[i].parentNode.parentNode === toolbar) { - buttonHeights.push(parseInt(L.DomUtil.getStyle(icons[i], 'height'), 10)); - toolbarWidth += Math.ceil(parseFloat(L.DomUtil.getStyle(icons[i], 'width'))); - } - } - toolbar.style.width = toolbarWidth + 'px'; - - /* Create and place the toolbar tip. */ - this._tipContainer = L.DomUtil.create('div', 'leaflet-toolbar-tip-container', container); - this._tipContainer.style.width = toolbarWidth + 'px'; - - this._tip = L.DomUtil.create('div', 'leaflet-toolbar-tip', this._tipContainer); - - /* Set the tipAnchor point. */ - toolbarHeight = Math.max.apply(undefined, buttonHeights); - tipSize = parseInt(L.DomUtil.getStyle(this._tip, 'width'), 10); - tipAnchor = new L.Point(toolbarWidth/2, toolbarHeight + 0.7071*tipSize); - - /* The anchor option allows app developers to adjust the toolbar's position. */ - container.style.marginLeft = (anchor.x - tipAnchor.x) + 'px'; - container.style.marginTop = (anchor.y - tipAnchor.y) + 'px'; - } -}); - -L.toolbar.popup = function(options) { - return new L.Toolbar.Popup(options); -}; - - -})(window, document); \ No newline at end of file