node-red-contrib-jwht-map/worldmap/leaflet/leaflet-side-by-side.js

2 lines
8.4 KiB
JavaScript
Raw Normal View History

2019-03-12 05:08:53 +08:00
!function a(s,o,d){function l(r,e){if(!o[r]){if(!s[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(h)return h(r,!0);var n=new Error("Cannot find module '"+r+"'");throw n.code="MODULE_NOT_FOUND",n}var i=o[r]={exports:{}};s[r][0].call(i.exports,function(e){return l(s[r][1][e]||e)},i,i.exports,a,s,o,d)}return o[r].exports}for(var h="function"==typeof require&&require,e=0;e<d.length;e++)l(d[e]);return l}({1:[function(h,u,e){(function(e){var r,t,i="undefined"!=typeof window?window.L:void 0!==e?e.L:null;function n(r,e,t,n){e.split(" ").forEach(function(e){i.DomEvent.on(r,e,t,n)})}function a(r,e,t,n){e.split(" ").forEach(function(e){i.DomEvent.off(r,e,t,n)})}function s(e){return"oninput"in e?"input":"change"}function o(){r=this._map.dragging.enabled(),t=this._map.tap&&this._map.tap.enabled(),this._map.dragging.disable(),this._map.tap&&this._map.tap.disable()}function d(e){this._refocusOnMap(e),r&&this._map.dragging.enable(),t&&this._map.tap.enable()}function l(e){return"undefined"===e?[]:Array.isArray(e)?e:[e]}h("./layout.css"),h("./range.css"),i.Control.SideBySide=i.Control.extend({options:{thumbSize:42,padding:0},initialize:function(e,r,t){this.setLeftLayers(e),this.setRightLayers(r),i.setOptions(this,t)},getPosition:function(){var e=this._range.value,r=(.5-e)*(2*this.options.padding+this.options.thumbSize);return this._map.getSize().x*e+r},setPosition:function(){},includes:i.Evented.prototype||i.Mixin.Events,addTo:function(e){this.remove(),this._map=e;var r=this._container=i.DomUtil.create("div","leaflet-sbs",e._controlContainer);this._divider=i.DomUtil.create("div","leaflet-sbs-divider",r);var t=this._range=i.DomUtil.create("input","leaflet-sbs-range",r);return t.type="range",t.min=0,t.max=1,t.step="any",t.value=.5,t.style.paddingLeft=t.style.paddingRight=this.options.padding+"px",this._addEvents(),this._updateLayers(),this},remove:function(){return this._map&&(this._leftLayer&&(this._leftLayer.getContainer().style.clip=""),this._rightLayer&&(this._rightLayer.getContainer().style.clip=""),this._removeEvents(),i.DomUtil.remove(this._container),this._map=null),this},setLeftLayers:function(e){return this._leftLayers=l(e),this._updateLayers(),this},setRightLayers:function(e){return this._rightLayers=l(e),this._updateLayers(),this},_updateClip:function(){var e=this._map,r=e.containerPointToLayerPoint([0,0]),t=e.containerPointToLayerPoint(e.getSize()),n=r.x+this.getPosition(),i=this.getPosition();this._divider.style.left=i+"px",this.fire("dividermove",{x:i});var a="rect("+[r.y,n,t.y,r.x].join("px,")+"px)",s="rect("+[r.y,t.x,t.y,n].join("px,")+"px)";this._leftLayer&&(this._leftLayer.getContainer().style.clip=a),this._rightLayer&&(this._rightLayer.getContainer().style.clip=s)},_updateLayers:function(){if(!this._map)return this;var e=this._leftLayer,r=this._rightLayer;this._leftLayer=this._rightLayer=null,this._leftLayers.forEach(function(e){this._map.hasLayer(e)&&(this._leftLayer=e)},this),this._rightLayers.forEach(function(e){this._map.hasLayer(e)&&(this._rightLayer=e)},this),e!==this._leftLayer&&(e&&this.fire("leftlayerremove",{layer:e}),this._leftLayer&&this.fire("leftlayeradd",{layer:this._leftLayer})),r!==this._rightLayer&&(r&&this.fire("rightlayerremove",{layer:r}),this._rightLayer&&this.fire("rightlayeradd",{layer:this._rightLayer})),this._updateClip()},_addEvents:function(){var e=this._range,r=this._map;r&&e&&(r.on("move",this._updateClip,this),r.on("layeradd layerremove",this._updateLayers,this),n(e,s(e),this._updateClip,this),n(e,i.Browser.touch?"touchstart":"mousedown",o,this),n(e,i.Browser.touch?"touchend":"mouseup",d,this))},_removeEvents:function(){var e=this._range,r=this._map;e&&(a(e,s(e),this._updateClip,this),a(e,i.Browser.touch?"touchstart":"mousedown",o,this),a(e,i.Browser.touch?"touchend":"mouseup",d,this)),r&&(r.off("layeradd layerremove",this._updateLayers,this),r.off("move",this._updateClip,this))}}),i.control.sideBySide=function(e,r,t){return new i.Control.SideBySide(e,r,t)},u.exports=i.Control.SideBySide}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"