Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

maptalks.three

Package Overview
Dependencies
Maintainers
1
Versions
89
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.6.1 to 0.6.2

8

dist/maptalks.three.es.js
/*!
* maptalks.three v0.6.1
* maptalks.three v0.6.2
* LICENSE : MIT
* (c) 2016-2018 maptalks.org
* (c) 2016-2019 maptalks.org
*/

@@ -163,3 +163,3 @@ import { Util, MultiPolygon, CanvasLayer, Browser, renderer } from 'maptalks';

return polygon.getGeometries().map(function (c) {
return _this2.toExtrudeGeometry(c, altitude, material, height);
return _this2.toExtrudeMesh(c, altitude, material, height);
});

@@ -452,2 +452,2 @@ }

typeof console !== 'undefined' && console.log('maptalks.three v0.6.1, requires maptalks@>=0.39.0.');
typeof console !== 'undefined' && console.log('maptalks.three v0.6.2, requires maptalks@>=0.39.0.');
/*!
* maptalks.three v0.6.1
* maptalks.three v0.6.2
* LICENSE : MIT
* (c) 2016-2018 maptalks.org
* (c) 2016-2019 maptalks.org
*/

@@ -166,3 +166,3 @@ (function (global, factory) {

return polygon.getGeometries().map(function (c) {
return _this2.toExtrudeGeometry(c, altitude, material, height);
return _this2.toExtrudeMesh(c, altitude, material, height);
});

@@ -458,4 +458,4 @@ }

typeof console !== 'undefined' && console.log('maptalks.three v0.6.1, requires maptalks@>=0.39.0.');
typeof console !== 'undefined' && console.log('maptalks.three v0.6.2, requires maptalks@>=0.39.0.');
})));

@@ -1,1 +0,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,p,f){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}var a=Math.PI/180,t=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.draw=function(){this.renderScene()},r.drawOnInteracting=function(){this.renderScene()},r.coordinateToVector3=function(e,t){void 0===t&&(t=0);var r=this.getMap();if(!r)return null;var n=r.coordinateToPoint(e,l(r));return new f.Vector3(n.x,n.y,t)},r.distanceToVector3=function(e,t,r){var n=this.getMap(),a=l(n),i=r||n.getCenter(),o=n.locate(i,e,t),s=n.coordinateToPoint(i,a),c=n.coordinateToPoint(o,a),h=Math.abs(c.x-s.x)*p.Util.sign(e),u=Math.abs(c.y-s.y)*p.Util.sign(t);return new f.Vector3(h,u,0)},r.toShape=function(e){var r=this;if(!e)return null;if(e instanceof p.MultiPolygon)return e.getGeometries().map(function(e){return r.toShape(e)});var t=e.getCenter(),n=this.coordinateToVector3(t),a=e.getShell().map(function(e){return r.coordinateToVector3(e).sub(n)}).reverse(),i=new f.Shape(a),o=e.getHoles();return o&&0<o.length&&(i.holes=o.map(function(e){var t=e.map(function(e){return r.coordinateToVector3(e).sub(n)});return new f.Shape(t)})),i},r.toExtrudeMesh=function(e,t,r,n){var a=this;if(!e)return null;if(e instanceof p.MultiPolygon)return e.getGeometries().map(function(e){return a.toExtrudeGeometry(e,t,r,n)});var i=e.getCoordinates();i.forEach(function(e){for(var t=e.length-1;1<=t;t--)e[t].equals(e[t-1])&&e.splice(t,1)}),e.setCoordinates(i);var o=this.toShape(e),s=this.coordinateToVector3(e.getCenter());n=p.Util.isNumber(n)?n:t,n=this.distanceToVector3(n,n).x;var c=this.distanceToVector3(t,t).x,h={bevelEnabled:!1,bevelSize:1};h[93<=parseInt(f.REVISION)?"depth":"amount"]=n;var u=new f.ExtrudeGeometry(o,h);(new f.BufferGeometry).fromGeometry(u);var l=new f.Mesh(u,r);return l.position.set(s.x,s.y,c-n),l},r.clearMesh=function(){var e=this.getScene();if(!e)return this;for(var t=e.children.length-1;0<=t;t--)e.children[t]instanceof f.Mesh&&e.remove(e.children[t]);return this},r.lookAt=function(e){var t=this._getRenderer();return t&&t.context.lookAt(e),this},r.getCamera=function(){var e=this._getRenderer();return e?e.camera:null},r.getScene=function(){var e=this._getRenderer();return e?e.scene:null},r.renderScene=function(){var e=this._getRenderer();return e?e.renderScene():this},r.getThreeRenderer=function(){var e=this._getRenderer();return e?e.context:null},r._getFovRatio=function(){var e=this.getMap().getFov();return Math.tan(e/2*a)},t}(p.CanvasLayer);t.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null});var r=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getPrepareParams=function(){return[this.scene,this.camera]},r.getDrawParams=function(){return[this.scene,this.camera]},r._drawLayer=function(){e.prototype._drawLayer.apply(this,arguments),this.renderScene()},r.hitDetect=function(){return!1},r.createCanvas=function(){e.prototype.createCanvas.call(this),this.createContext()},r.createContext=function(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{var e=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0};e.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,e)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)},r._initThreeRenderer=function(){var e=new f.WebGLRenderer({context:this.gl,alpha:!0});e.autoClear=!1,e.setClearColor(new f.Color(1,1,1),0),e.setSize(this.canvas.width,this.canvas.height),e.clear(),e.canvas=this.canvas,this.context=e;var t=this.scene=new f.Scene,r=this.layer.getMap(),n=r.getFov()*Math.PI/180,a=this.camera=new f.PerspectiveCamera(n,r.width/r.height,r.cameraNear,r.cameraFar);a.matrixAutoUpdate=!1,this._syncCamera(),t.add(a)},r.onCanvasCreate=function(){e.prototype.onCanvasCreate.call(this)},r.resizeCanvas=function(e){if(this.canvas){var t;t=e||this.getMap().getSize();var r=p.Browser.retina?2:1,n=this.canvas;n.height=r*t.height,n.width=r*t.width,this.context.setSize(n.width,n.height)}},r.clearCanvas=function(){this.canvas&&this.context.clear()},r.prepareCanvas=function(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null},r.renderScene=function(){this._syncCamera(),this.context.render(this.scene,this.camera),this.completeRender()},r.remove=function(){delete this._drawContext,e.prototype.remove.call(this)},r._syncCamera=function(){var e=this.getMap();this.camera.matrix.elements=e.cameraWorldMatrix,this.camera.projectionMatrix.elements=e.projMatrix},r._createGLContext=function(e,t){for(var r=["webgl","experimental-webgl"],n=null,a=0;a<r.length;++a){try{n=e.getContext(r[a],t)}catch(e){}if(n)break}return n},t}(p.renderer.CanvasLayerRenderer);function l(e){return e.getGLZoom()}t.registerRenderer("gl",r),e.ThreeLayer=t,e.ThreeRenderer=r,Object.defineProperty(e,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks.three v0.6.1, requires maptalks@>=0.39.0.")});
!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,p,f){"use strict";function n(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t}var a=Math.PI/180,t=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.draw=function(){this.renderScene()},r.drawOnInteracting=function(){this.renderScene()},r.coordinateToVector3=function(e,t){void 0===t&&(t=0);var r=this.getMap();if(!r)return null;var n=r.coordinateToPoint(e,l(r));return new f.Vector3(n.x,n.y,t)},r.distanceToVector3=function(e,t,r){var n=this.getMap(),a=l(n),i=r||n.getCenter(),o=n.locate(i,e,t),s=n.coordinateToPoint(i,a),c=n.coordinateToPoint(o,a),h=Math.abs(c.x-s.x)*p.Util.sign(e),u=Math.abs(c.y-s.y)*p.Util.sign(t);return new f.Vector3(h,u,0)},r.toShape=function(e){var r=this;if(!e)return null;if(e instanceof p.MultiPolygon)return e.getGeometries().map(function(e){return r.toShape(e)});var t=e.getCenter(),n=this.coordinateToVector3(t),a=e.getShell().map(function(e){return r.coordinateToVector3(e).sub(n)}).reverse(),i=new f.Shape(a),o=e.getHoles();return o&&0<o.length&&(i.holes=o.map(function(e){var t=e.map(function(e){return r.coordinateToVector3(e).sub(n)});return new f.Shape(t)})),i},r.toExtrudeMesh=function(e,t,r,n){var a=this;if(!e)return null;if(e instanceof p.MultiPolygon)return e.getGeometries().map(function(e){return a.toExtrudeMesh(e,t,r,n)});var i=e.getCoordinates();i.forEach(function(e){for(var t=e.length-1;1<=t;t--)e[t].equals(e[t-1])&&e.splice(t,1)}),e.setCoordinates(i);var o=this.toShape(e),s=this.coordinateToVector3(e.getCenter());n=p.Util.isNumber(n)?n:t,n=this.distanceToVector3(n,n).x;var c=this.distanceToVector3(t,t).x,h={bevelEnabled:!1,bevelSize:1};h[93<=parseInt(f.REVISION)?"depth":"amount"]=n;var u=new f.ExtrudeGeometry(o,h);(new f.BufferGeometry).fromGeometry(u);var l=new f.Mesh(u,r);return l.position.set(s.x,s.y,c-n),l},r.clearMesh=function(){var e=this.getScene();if(!e)return this;for(var t=e.children.length-1;0<=t;t--)e.children[t]instanceof f.Mesh&&e.remove(e.children[t]);return this},r.lookAt=function(e){var t=this._getRenderer();return t&&t.context.lookAt(e),this},r.getCamera=function(){var e=this._getRenderer();return e?e.camera:null},r.getScene=function(){var e=this._getRenderer();return e?e.scene:null},r.renderScene=function(){var e=this._getRenderer();return e?e.renderScene():this},r.getThreeRenderer=function(){var e=this._getRenderer();return e?e.context:null},r._getFovRatio=function(){var e=this.getMap().getFov();return Math.tan(e/2*a)},t}(p.CanvasLayer);t.mergeOptions({renderer:"gl",doubleBuffer:!1,glOptions:null});var r=function(e){function t(){return e.apply(this,arguments)||this}n(t,e);var r=t.prototype;return r.getPrepareParams=function(){return[this.scene,this.camera]},r.getDrawParams=function(){return[this.scene,this.camera]},r._drawLayer=function(){e.prototype._drawLayer.apply(this,arguments),this.renderScene()},r.hitDetect=function(){return!1},r.createCanvas=function(){e.prototype.createCanvas.call(this),this.createContext()},r.createContext=function(){if(this.canvas.gl&&this.canvas.gl.wrap)this.gl=this.canvas.gl.wrap();else{var e=this.layer.options.glOptions||{alpha:!0,depth:!0,antialias:!0,stencil:!0};e.preserveDrawingBuffer=!0,this.gl=this.gl||this._createGLContext(this.canvas,e)}this._initThreeRenderer(),this.layer.onCanvasCreate(this.context,this.scene,this.camera)},r._initThreeRenderer=function(){var e=new f.WebGLRenderer({context:this.gl,alpha:!0});e.autoClear=!1,e.setClearColor(new f.Color(1,1,1),0),e.setSize(this.canvas.width,this.canvas.height),e.clear(),e.canvas=this.canvas,this.context=e;var t=this.scene=new f.Scene,r=this.layer.getMap(),n=r.getFov()*Math.PI/180,a=this.camera=new f.PerspectiveCamera(n,r.width/r.height,r.cameraNear,r.cameraFar);a.matrixAutoUpdate=!1,this._syncCamera(),t.add(a)},r.onCanvasCreate=function(){e.prototype.onCanvasCreate.call(this)},r.resizeCanvas=function(e){if(this.canvas){var t;t=e||this.getMap().getSize();var r=p.Browser.retina?2:1,n=this.canvas;n.height=r*t.height,n.width=r*t.width,this.context.setSize(n.width,n.height)}},r.clearCanvas=function(){this.canvas&&this.context.clear()},r.prepareCanvas=function(){return this.canvas?this.clearCanvas():this.createCanvas(),this.layer.fire("renderstart",{context:this.context}),null},r.renderScene=function(){this._syncCamera(),this.context.render(this.scene,this.camera),this.completeRender()},r.remove=function(){delete this._drawContext,e.prototype.remove.call(this)},r._syncCamera=function(){var e=this.getMap();this.camera.matrix.elements=e.cameraWorldMatrix,this.camera.projectionMatrix.elements=e.projMatrix},r._createGLContext=function(e,t){for(var r=["webgl","experimental-webgl"],n=null,a=0;a<r.length;++a){try{n=e.getContext(r[a],t)}catch(e){}if(n)break}return n},t}(p.renderer.CanvasLayerRenderer);function l(e){return e.getGLZoom()}t.registerRenderer("gl",r),e.ThreeLayer=t,e.ThreeRenderer=r,Object.defineProperty(e,"__esModule",{value:!0}),"undefined"!=typeof console&&console.log("maptalks.three v0.6.2, requires maptalks@>=0.39.0.")});

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

if (polygon instanceof maptalks.MultiPolygon) {
return polygon.getGeometries().map(c => this.toExtrudeGeometry(c, altitude, material, height));
return polygon.getGeometries().map(c => this.toExtrudeMesh(c, altitude, material, height));
}

@@ -122,0 +122,0 @@ const rings = polygon.getCoordinates();

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

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

@@ -20,5 +20,6 @@ # maptalks.three

## Changes of v0.6.0
## Migration from <=v0.5.x to v0.6.0
* Re-implementated locateCamera, sync with map's projMatrix and viewMatrix
* Re-implementated locateCamera, sync with map's projMatrix and viewMatrix.
* Model's z position is reversed from v0.5.0. So if you have models rendered with v0.5.x, rotation needs to be updated.
* For THREE <= 0.94, material's side need to set to THREE.BackSide or THREE.DoubleSide to render correctly

@@ -25,0 +26,0 @@ * THREE >= 0.95 doesn't need, maybe due to [#14379](https://github.com/mrdoob/three.js/pull/14379)

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