New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

maptalks.three

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

maptalks.three - npm Package Compare versions

Comparing version 0.4.1 to 0.4.2

6

dist/maptalks.three.es.js
/*!
* maptalks.three v0.4.1
* maptalks.three v0.4.2
* LICENSE : MIT

@@ -298,3 +298,3 @@ * (c) 2016-2017 maptalks.org

var gl;
if (renderer$$1 === 'webgl') {
if (renderer$$1 === 'gl') {
gl = new WebGLRenderer(Util.extend({

@@ -416,2 +416,2 @@ 'canvas': this.canvas,

typeof console !== 'undefined' && console.log('maptalks.three v0.4.1, requires maptalks@>=0.25.1.');
typeof console !== 'undefined' && console.log('maptalks.three v0.4.2, requires maptalks@>=0.25.1.');
/*!
* maptalks.three v0.4.1
* maptalks.three v0.4.2
* LICENSE : MIT

@@ -301,3 +301,3 @@ * (c) 2016-2017 maptalks.org

var gl;
if (renderer$$1 === 'webgl') {
if (renderer$$1 === 'gl') {
gl = new THREE.WebGLRenderer(maptalks.Util.extend({

@@ -422,4 +422,4 @@ 'canvas': this.canvas,

typeof console !== 'undefined' && console.log('maptalks.three v0.4.1, requires maptalks@>=0.25.1.');
typeof console !== 'undefined' && console.log('maptalks.three v0.4.2, requires maptalks@>=0.25.1.');
})));
/*!
* maptalks.three v0.4.1
* maptalks.three v0.4.2
* LICENSE : MIT

@@ -9,2 +9,2 @@ * (c) 2016-2017 maptalks.org

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("maptalks"),require("three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three"],t):t(e.maptalks=e.maptalks||{},e.maptalks,e.THREE)}(this,function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],a=Object.getOwnPropertyDescriptor(t,o);a&&a.configurable&&void 0===e[o]&&Object.defineProperty(e,o,a)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}function s(e){return e.getMaxNativeZoom()}var c={renderer:"gl",doubleBuffer:!0,glOptions:null},h=Math.PI/180,p=function(e){function n(){return o(this,n),a(this,e.apply(this,arguments))}return i(n,e),n.prototype.draw=function(){this.renderScene()},n.prototype.drawOnInteracting=function(){this.renderScene()},n.prototype.coordinateToVector3=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getMap();if(!n)return null;var o=n.coordinateToPoint(e,s(n));return new r.Vector3(o.x,o.y,-t)},n.prototype.distanceToVector3=function(e,n,o){var a=this.getMap(),i=s(a),c=o||a.getCenter(),h=a.locate(c,e,n),p=a.coordinateToPoint(c,i),u=a.coordinateToPoint(h,i),l=Math.abs(u.x-p.x)*t.Util.sign(e),f=Math.abs(u.y-p.y)*t.Util.sign(n);return new r.Vector3(l,f,0)},n.prototype.toShape=function(e){var n=this;if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map(function(e){return n.toShape(e)});var o=e.getCenter(),a=this.coordinateToVector3(o),i=e.getShell().map(function(e){return n.coordinateToVector3(e).sub(a)}),s=new r.Shape(i),c=e.getHoles();return c&&c.length>0&&(s.holes=c.map(function(e){var t=e.map(function(e){return n.coordinateToVector3(e).sub(a)});return new r.Shape(t)})),s},n.prototype.toExtrudeMesh=function(e,n,o,a){var i=this;if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map(function(e){return i.toExtrudeGeometry(e,n,o)});if(a){var s=e.getCoordinates();s.forEach(function(e){for(var t=e.length-1;t>=1;t--)e[t].equals(e[t-1])&&e.splice(t,1)}),e.setCoordinates(s)}var c=this.toShape(e),h=this.coordinateToVector3(e.getCenter());n=this.distanceToVector3(n,n).x;var p=new r.ExtrudeGeometry(c,{amount:n,bevelEnabled:!0}),u=new r.BufferGeometry;u.fromGeometry(p);var l=new r.Mesh(u,o);return l.position.set(h.x,h.y,-n),l},n.prototype.clearMesh=function(){var e=this.getScene();if(!e)return this;for(var t=e.children.length-1;t>=0;t--)e.children[t]instanceof r.Mesh&&e.remove(e.children[t]);return this},n.prototype.lookAt=function(e){var t=this._getRenderer();return t&&t.context.lookAt(e),this},n.prototype.getCamera=function(){var e=this._getRenderer();return e?e.camera:null},n.prototype.getScene=function(){var e=this._getRenderer();return e?e.scene:null},n.prototype.renderScene=function(){var e=this._getRenderer();return e?e.renderScene():this},n.prototype.getThreeRenderer=function(){var e=this._getRenderer();return e?e.context:null},n.prototype._getFovRatio=function(){var e=this.getMap().getFov();return Math.tan(e/2*h)},n}(t.CanvasLayer);p.mergeOptions(c);var u=function(e){function n(){return o(this,n),a(this,e.apply(this,arguments))}return i(n,e),n.prototype.getPrepareParams=function(){return[this.scene,this.camera]},n.prototype.getDrawParams=function(){return[this.scene,this.camera]},n.prototype._drawLayer=function(){e.prototype._drawLayer.apply(this,arguments),this.renderScene()},n.prototype.hitDetect=function(){return!1},n.prototype.onCanvasCreate=function(){e.prototype.onCanvasCreate.call(this),this.layer.onCanvasCreate(this.context,this.scene,this.camera)},n.prototype.initContext=function(){var e,n=this.getMap(),o=n.getSize(),a=this.layer.options.renderer;"webgl"===a?((e=new r.WebGLRenderer(t.Util.extend({canvas:this.canvas,alpha:!0,preserveDrawingBuffer:!0},this.layer.options.glOptions))).autoClear=!1,e.clear()):"canvas"===a&&(e=new r.CanvasRenderer(t.Util.extend({canvas:this.canvas,alpha:!0},this.layer.options.glOptions))),e.setSize(this.canvas.width,this.canvas.height),e.setClearColor(new r.Color(1,1,1),0),e.canvas=this.canvas,this.context=e;var i=n.getScale(n.getMinZoom())/n.getScale(s(n))*o.height/2/this.layer._getFovRatio(),c=this.scene=new r.Scene,h=n.getFov(),p=this.camera=new r.PerspectiveCamera(h,o.width/o.height,1,i);c.add(p)},n.prototype.resizeCanvas=function(e){if(this.canvas){var r;r=e||this.getMap().getSize();var n=t.Browser.retina?2:1;this.canvas.height=n*r.height,this.canvas.width=n*r.width,this.camera.aspect=this.canvas.width/this.canvas.height,this.camera.updateProjectionMatrix(),this.context.setSize(this.canvas.width,this.canvas.height)}},n.prototype.clearCanvas=function(){this.canvas&&this.context.clear()},n.prototype.prepareCanvas=function(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null},n.prototype.renderScene=function(){this._locateCamera(),this.context.render(this.scene,this.camera),this.completeRender()},n.prototype.remove=function(){delete this._drawContext,e.prototype.remove.call(this)},n.prototype._locateCamera=function(){var e=this.getMap(),t=e.getSize(),n=e.getScale(),o=this.camera,a=e.coordinateToPoint(e.getCenter(),s(e)),i=e.getPitch()*h,c=e.getBearing()*h,p=this.layer._getFovRatio(),u=-n*t.height/2/p;o.position.z=u*Math.cos(i);var l=Math.sin(i)*u;o.position.x=a.x+l*Math.sin(c),o.position.y=a.y-l*Math.cos(c),o.up.set(Math.sin(c),-Math.cos(c),0),o.lookAt(new r.Vector3(a.x,a.y,0)),o.updateProjectionMatrix()},n}(t.renderer.CanvasLayerRenderer);p.registerRenderer("canvas",u),p.registerRenderer("gl",u),e.ThreeLayer=p,e.ThreeRenderer=u,Object.defineProperty(e,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks.three v0.4.1, requires maptalks@>=0.25.1.")});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("maptalks"),require("three")):"function"==typeof define&&define.amd?define(["exports","maptalks","three"],t):t(e.maptalks=e.maptalks||{},e.maptalks,e.THREE)}(this,function(e,t,r){"use strict";function n(e,t){for(var r=Object.getOwnPropertyNames(t),n=0;n<r.length;n++){var o=r[n],a=Object.getOwnPropertyDescriptor(t,o);a&&a.configurable&&void 0===e[o]&&Object.defineProperty(e,o,a)}return e}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):n(e,t))}function s(e){return e.getMaxNativeZoom()}var c={renderer:"gl",doubleBuffer:!0,glOptions:null},h=Math.PI/180,p=function(e){function n(){return o(this,n),a(this,e.apply(this,arguments))}return i(n,e),n.prototype.draw=function(){this.renderScene()},n.prototype.drawOnInteracting=function(){this.renderScene()},n.prototype.coordinateToVector3=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.getMap();if(!n)return null;var o=n.coordinateToPoint(e,s(n));return new r.Vector3(o.x,o.y,-t)},n.prototype.distanceToVector3=function(e,n,o){var a=this.getMap(),i=s(a),c=o||a.getCenter(),h=a.locate(c,e,n),p=a.coordinateToPoint(c,i),u=a.coordinateToPoint(h,i),l=Math.abs(u.x-p.x)*t.Util.sign(e),f=Math.abs(u.y-p.y)*t.Util.sign(n);return new r.Vector3(l,f,0)},n.prototype.toShape=function(e){var n=this;if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map(function(e){return n.toShape(e)});var o=e.getCenter(),a=this.coordinateToVector3(o),i=e.getShell().map(function(e){return n.coordinateToVector3(e).sub(a)}),s=new r.Shape(i),c=e.getHoles();return c&&c.length>0&&(s.holes=c.map(function(e){var t=e.map(function(e){return n.coordinateToVector3(e).sub(a)});return new r.Shape(t)})),s},n.prototype.toExtrudeMesh=function(e,n,o,a){var i=this;if(!e)return null;if(e instanceof t.MultiPolygon)return e.getGeometries().map(function(e){return i.toExtrudeGeometry(e,n,o)});if(a){var s=e.getCoordinates();s.forEach(function(e){for(var t=e.length-1;t>=1;t--)e[t].equals(e[t-1])&&e.splice(t,1)}),e.setCoordinates(s)}var c=this.toShape(e),h=this.coordinateToVector3(e.getCenter());n=this.distanceToVector3(n,n).x;var p=new r.ExtrudeGeometry(c,{amount:n,bevelEnabled:!0}),u=new r.BufferGeometry;u.fromGeometry(p);var l=new r.Mesh(u,o);return l.position.set(h.x,h.y,-n),l},n.prototype.clearMesh=function(){var e=this.getScene();if(!e)return this;for(var t=e.children.length-1;t>=0;t--)e.children[t]instanceof r.Mesh&&e.remove(e.children[t]);return this},n.prototype.lookAt=function(e){var t=this._getRenderer();return t&&t.context.lookAt(e),this},n.prototype.getCamera=function(){var e=this._getRenderer();return e?e.camera:null},n.prototype.getScene=function(){var e=this._getRenderer();return e?e.scene:null},n.prototype.renderScene=function(){var e=this._getRenderer();return e?e.renderScene():this},n.prototype.getThreeRenderer=function(){var e=this._getRenderer();return e?e.context:null},n.prototype._getFovRatio=function(){var e=this.getMap().getFov();return Math.tan(e/2*h)},n}(t.CanvasLayer);p.mergeOptions(c);var u=function(e){function n(){return o(this,n),a(this,e.apply(this,arguments))}return i(n,e),n.prototype.getPrepareParams=function(){return[this.scene,this.camera]},n.prototype.getDrawParams=function(){return[this.scene,this.camera]},n.prototype._drawLayer=function(){e.prototype._drawLayer.apply(this,arguments),this.renderScene()},n.prototype.hitDetect=function(){return!1},n.prototype.onCanvasCreate=function(){e.prototype.onCanvasCreate.call(this),this.layer.onCanvasCreate(this.context,this.scene,this.camera)},n.prototype.initContext=function(){var e,n=this.getMap(),o=n.getSize(),a=this.layer.options.renderer;"gl"===a?((e=new r.WebGLRenderer(t.Util.extend({canvas:this.canvas,alpha:!0,preserveDrawingBuffer:!0},this.layer.options.glOptions))).autoClear=!1,e.clear()):"canvas"===a&&(e=new r.CanvasRenderer(t.Util.extend({canvas:this.canvas,alpha:!0},this.layer.options.glOptions))),e.setSize(this.canvas.width,this.canvas.height),e.setClearColor(new r.Color(1,1,1),0),e.canvas=this.canvas,this.context=e;var i=n.getScale(n.getMinZoom())/n.getScale(s(n))*o.height/2/this.layer._getFovRatio(),c=this.scene=new r.Scene,h=n.getFov(),p=this.camera=new r.PerspectiveCamera(h,o.width/o.height,1,i);c.add(p)},n.prototype.resizeCanvas=function(e){if(this.canvas){var r;r=e||this.getMap().getSize();var n=t.Browser.retina?2:1;this.canvas.height=n*r.height,this.canvas.width=n*r.width,this.camera.aspect=this.canvas.width/this.canvas.height,this.camera.updateProjectionMatrix(),this.context.setSize(this.canvas.width,this.canvas.height)}},n.prototype.clearCanvas=function(){this.canvas&&this.context.clear()},n.prototype.prepareCanvas=function(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null},n.prototype.renderScene=function(){this._locateCamera(),this.context.render(this.scene,this.camera),this.completeRender()},n.prototype.remove=function(){delete this._drawContext,e.prototype.remove.call(this)},n.prototype._locateCamera=function(){var e=this.getMap(),t=e.getSize(),n=e.getScale(),o=this.camera,a=e.coordinateToPoint(e.getCenter(),s(e)),i=e.getPitch()*h,c=e.getBearing()*h,p=this.layer._getFovRatio(),u=-n*t.height/2/p;o.position.z=u*Math.cos(i);var l=Math.sin(i)*u;o.position.x=a.x+l*Math.sin(c),o.position.y=a.y-l*Math.cos(c),o.up.set(Math.sin(c),-Math.cos(c),0),o.lookAt(new r.Vector3(a.x,a.y,0)),o.updateProjectionMatrix()},n}(t.renderer.CanvasLayerRenderer);p.registerRenderer("canvas",u),p.registerRenderer("gl",u),e.ThreeLayer=p,e.ThreeRenderer=u,Object.defineProperty(e,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks.three v0.4.2, requires maptalks@>=0.25.1.")});

@@ -242,3 +242,3 @@ import * as maptalks from 'maptalks';

var gl;
if (renderer === 'webgl') {
if (renderer === 'gl') {
gl = new THREE.WebGLRenderer(maptalks.Util.extend({

@@ -245,0 +245,0 @@ 'canvas' : this.canvas,

{
"name": "maptalks.three",
"version": "0.4.1",
"version": "0.4.2",
"description": "A maptalks Layer to render with THREE.js.",

@@ -5,0 +5,0 @@ "license": "MIT",

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