@deck.gl/google-maps
Advanced tools
Comparing version 7.3.0-alpha.6 to 7.3.0-alpha.7
@@ -1,1 +0,1 @@ | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("deck"));else if("function"==typeof define&&define.amd)define(["deck"],t);else{var n="object"==typeof exports?t(require("deck")):t(e.deck);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(t,n){t.exports=e},function(e,t,n){(function(t){const o=n(5),i=("undefined"==typeof window?t:window).deck||{};if(!i.Layer)throw new Error("@deck.gl/core is not found");e.exports=Object.assign(i,o)}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1),a=n.n(r),s=n(2);function u(e){var t=e.getPanes().overlayLayer,n=document.createElement("canvas");return Object.assign(n.style,{position:"absolute"}),t.appendChild(n),n}function c(e){var t=e.props.userData._eventListeners;for(var n in t)t[n].remove();e.finalize(),e.canvas.parentNode.removeChild(e.canvas)}var l=function(){return!1},f=function(){function e(t){i()(this,e),this.props={},this._map=null;var n=new google.maps.OverlayView;n.onAdd=this._onAdd.bind(this),n.onRemove=this._onRemove.bind(this),n.draw=this._draw.bind(this),this._overlay=n,this.setProps(t)}return a()(e,[{key:"setMap",value:function(e){e!==this._map&&(this._map&&(this._overlay.setMap(null),this._map=null),e&&(this._map=e,this._overlay.setMap(e)))}},{key:"setProps",value:function(e){Object.assign(this.props,e),this._deck&&this._deck.setProps(this.props)}},{key:"pickObject",value:function(e){return this._deck&&this._deck.pickObject(e)}},{key:"pickMultipleObjects",value:function(e){return this._deck&&this._deck.pickMultipleObjects(e)}},{key:"pickObjects",value:function(e){return this._deck&&this._deck.pickObjects(e)}},{key:"finalize",value:function(){this.setMap(null),this._deck&&(c(this._deck),this._deck=null)}},{key:"_onAdd",value:function(){this._deck=function(e,t,n){if(n){if(n.props.userData._googleMap===e)return n;c(n)}var o={click:null,mousemove:null,mouseout:null};n=new s.Deck({canvas:u(t),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1,userData:{_googleMap:e,_eventListeners:o}});var i=function(t){o[t]=e.addListener(t,function(e){return function(e,t,n){var o;switch(t){case"click":e._lastPointerDownInfo=e.pickObject({x:n.pixel.x,y:n.pixel.y}),o=e._onEvent;break;case"mousemove":t="pointermove",o=e._onPointerMove;break;case"mouseout":t="pointerleave",o=e._onPointerMove;break;default:return}o({type:t,offsetCenter:n.pixel,srcEvent:n})}(n,t,e)})};for(var r in o)i(r);return n}(this._map,this._overlay,this._deck),this._deck.setProps(this.props)}},{key:"_onRemove",value:function(){this._deck.setProps({layerFilter:l})}},{key:"_draw",value:function(){var e=this._deck,t=function(e,t){var n=e.getDiv().firstChild,o=n.offsetWidth,i=n.offsetHeight,r=t.getProjection(),a=e.getBounds(),s=a.getNorthEast(),u=a.getSouthWest(),c=r.fromLatLngToDivPixel(s),l=r.fromLatLngToDivPixel(u),f=new google.maps.Point(0,0),p=r.fromContainerPixelToLatLng(f),d=r.fromLatLngToDivPixel(p),h=(c.x-l.x)/o,v=Math.log2(h)+e.getZoom()-1,y=new google.maps.Point(o/2,i/2),_=r.fromContainerPixelToLatLng(y),g=_.lat(),k=_.lng();return{width:o,height:i,left:d.x,top:d.y,zoom:v,pitch:e.getTilt(),latitude:g,longitude:k}}(this._map,this._overlay),n=t.width,o=t.height,i=t.left,r=t.top,a=t.zoom,s=t.pitch,u=t.latitude,c=t.longitude,f=a>=0&&0===s;e.canvas.style.left="".concat(i,"px"),e.canvas.style.top="".concat(r,"px"),e.setProps({width:n,height:o,viewState:{latitude:u,longitude:c,zoom:a},layerFilter:f?this.props.layerFilter:l}),e.redraw()}}]),e}();n.d(t,"GoogleMapsOverlay",function(){return f})}])}); | ||
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("deck"));else if("function"==typeof define&&define.amd)define(["deck"],t);else{var n="object"==typeof exports?t(require("deck")):t(e.deck);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,(function(e){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=3)}([function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}e.exports=function(e,t,o){return t&&n(e.prototype,t),o&&n(e,o),e}},function(t,n){t.exports=e},function(e,t,n){(function(t){const o=n(5),i=("undefined"==typeof window?t:window).deck||{};if(!i.Layer)throw new Error("@deck.gl/core is not found");e.exports=Object.assign(i,o)}).call(this,n(4))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1),a=n.n(r),s=n(2);function u(e){var t=e.getPanes().overlayLayer,n=document.createElement("canvas");return Object.assign(n.style,{position:"absolute"}),t.appendChild(n),n}function c(e){var t=e.props.userData._eventListeners;for(var n in t)t[n].remove();e.finalize(),e.canvas.parentNode.removeChild(e.canvas)}var l=function(){return!1},f=function(){function e(t){i()(this,e),this.props={},this._map=null;var n=new google.maps.OverlayView;n.onAdd=this._onAdd.bind(this),n.onRemove=this._onRemove.bind(this),n.draw=this._draw.bind(this),this._overlay=n,this.setProps(t)}return a()(e,[{key:"setMap",value:function(e){e!==this._map&&(this._map&&(this._overlay.setMap(null),this._map=null),e&&(this._map=e,this._overlay.setMap(e)))}},{key:"setProps",value:function(e){Object.assign(this.props,e),this._deck&&this._deck.setProps(this.props)}},{key:"pickObject",value:function(e){return this._deck&&this._deck.pickObject(e)}},{key:"pickMultipleObjects",value:function(e){return this._deck&&this._deck.pickMultipleObjects(e)}},{key:"pickObjects",value:function(e){return this._deck&&this._deck.pickObjects(e)}},{key:"finalize",value:function(){this.setMap(null),this._deck&&(c(this._deck),this._deck=null)}},{key:"_onAdd",value:function(){this._deck=function(e,t,n){if(n){if(n.props.userData._googleMap===e)return n;c(n)}var o={click:null,mousemove:null,mouseout:null};n=new s.Deck({canvas:u(t),initialViewState:{longitude:0,latitude:0,zoom:1},controller:!1,userData:{_googleMap:e,_eventListeners:o}});var i=function(t){o[t]=e.addListener(t,(function(e){return function(e,t,n){var o;switch(t){case"click":e._lastPointerDownInfo=e.pickObject({x:n.pixel.x,y:n.pixel.y}),o=e._onEvent;break;case"mousemove":t="pointermove",o=e._onPointerMove;break;case"mouseout":t="pointerleave",o=e._onPointerMove;break;default:return}o({type:t,offsetCenter:n.pixel,srcEvent:n})}(n,t,e)}))};for(var r in o)i(r);return n}(this._map,this._overlay,this._deck),this._deck.setProps(this.props)}},{key:"_onRemove",value:function(){this._deck.setProps({layerFilter:l})}},{key:"_draw",value:function(){var e=this._deck,t=function(e,t){var n=e.getDiv().firstChild,o=n.offsetWidth,i=n.offsetHeight,r=t.getProjection(),a=e.getBounds(),s=a.getNorthEast(),u=a.getSouthWest(),c=r.fromLatLngToDivPixel(s),l=r.fromLatLngToDivPixel(u),f=new google.maps.Point(0,0),p=r.fromContainerPixelToLatLng(f),d=r.fromLatLngToDivPixel(p),h=(c.x-l.x)/o,v=Math.log2(h)+e.getZoom()-1,y=new google.maps.Point(o/2,i/2),_=r.fromContainerPixelToLatLng(y),g=_.lat(),k=_.lng();return{width:o,height:i,left:d.x,top:d.y,zoom:v,pitch:e.getTilt(),latitude:g,longitude:k}}(this._map,this._overlay),n=t.width,o=t.height,i=t.left,r=t.top,a=t.zoom,s=t.pitch,u=t.latitude,c=t.longitude,f=a>=0&&0===s;e.canvas.style.left="".concat(i,"px"),e.canvas.style.top="".concat(r,"px"),e.setProps({width:n,height:o,viewState:{latitude:u,longitude:c,zoom:a},layerFilter:f?this.props.layerFilter:l}),e.redraw()}}]),e}();n.d(t,"GoogleMapsOverlay",(function(){return f}))}])})); |
@@ -8,3 +8,3 @@ "use strict"; | ||
}); | ||
exports.default = void 0; | ||
exports["default"] = void 0; | ||
@@ -23,3 +23,3 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
function GoogleMapsOverlay(props) { | ||
(0, _classCallCheck2.default)(this, GoogleMapsOverlay); | ||
(0, _classCallCheck2["default"])(this, GoogleMapsOverlay); | ||
this.props = {}; | ||
@@ -35,3 +35,3 @@ this._map = null; | ||
(0, _createClass2.default)(GoogleMapsOverlay, [{ | ||
(0, _createClass2["default"])(GoogleMapsOverlay, [{ | ||
key: "setMap", | ||
@@ -137,3 +137,3 @@ value: function setMap(map) { | ||
exports.default = GoogleMapsOverlay; | ||
exports["default"] = GoogleMapsOverlay; | ||
//# sourceMappingURL=google-maps-overlay.js.map |
@@ -11,3 +11,3 @@ "use strict"; | ||
get: function get() { | ||
return _googleMapsOverlay.default; | ||
return _googleMapsOverlay["default"]; | ||
} | ||
@@ -14,0 +14,0 @@ }); |
@@ -78,16 +78,15 @@ import { createDeckInstance, destroyDeckInstance, getViewState } from './utils'; | ||
const deck = this._deck; | ||
const _getViewState = getViewState(this._map, this._overlay), | ||
width = _getViewState.width, | ||
height = _getViewState.height, | ||
left = _getViewState.left, | ||
top = _getViewState.top, | ||
zoom = _getViewState.zoom, | ||
pitch = _getViewState.pitch, | ||
latitude = _getViewState.latitude, | ||
longitude = _getViewState.longitude; | ||
const { | ||
width, | ||
height, | ||
left, | ||
top, | ||
zoom, | ||
pitch, | ||
latitude, | ||
longitude | ||
} = getViewState(this._map, this._overlay); | ||
const canSyncWithGoogleMaps = zoom >= 0 && pitch === 0; | ||
deck.canvas.style.left = `${left}px`; | ||
deck.canvas.style.top = `${top}px`; | ||
deck.canvas.style.left = "".concat(left, "px"); | ||
deck.canvas.style.top = "".concat(top, "px"); | ||
deck.setProps({ | ||
@@ -94,0 +93,0 @@ width, |
@@ -48,3 +48,5 @@ import { Deck } from '@deck.gl/core'; | ||
export function destroyDeckInstance(deck) { | ||
const eventListeners = deck.props.userData._eventListeners; | ||
const { | ||
_eventListeners: eventListeners | ||
} = deck.props.userData; | ||
@@ -51,0 +53,0 @@ for (const eventType in eventListeners) { |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "7.3.0-alpha.6", | ||
"version": "7.3.0-alpha.7", | ||
"publishConfig": { | ||
@@ -36,3 +36,3 @@ "access": "public" | ||
}, | ||
"gitHead": "42af516aae7fbb21a48e5f4260b19d52ca9a6757" | ||
"gitHead": "2732d1192132eaf0a2784116b7a0b69fb2143706" | ||
} |
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
1278
91902