maptalks.three
Advanced tools
Comparing version 0.7.4 to 0.8.0
@@ -0,0 +0,0 @@ # API |
@@ -0,0 +0,0 @@ const path = require('path'); |
@@ -1301,8 +1301,8 @@ define(['exports'], function (exports) { 'use strict'; | ||
var _preparedData$_d = preparedData[_d], | ||
holes = _preparedData$_d.holes, | ||
vertices = _preparedData$_d.vertices; | ||
var topVertexCount = vertices.length / 2; | ||
_holes = _preparedData$_d.holes, | ||
_vertices = _preparedData$_d.vertices; | ||
var topVertexCount = _vertices.length / 2; | ||
var _start = 0; | ||
var _end = holes && holes.length ? holes[0] : topVertexCount; // Add exterior | ||
var _end = _holes && _holes.length ? _holes[0] : topVertexCount; // Add exterior | ||
@@ -1312,6 +1312,6 @@ | ||
if (holes) { | ||
for (var _h = 0; _h < holes.length; _h++) { | ||
_start = holes[_h]; | ||
_end = holes[_h + 1] || topVertexCount; | ||
if (_holes) { | ||
for (var _h = 0; _h < _holes.length; _h++) { | ||
_start = _holes[_h]; | ||
_end = _holes[_h + 1] || topVertexCount; | ||
addExtrudeSide(data, preparedData[_d], _start, _end, cursors, opts); | ||
@@ -1318,0 +1318,0 @@ } |
39
index.js
@@ -0,1 +1,2 @@ | ||
import './dist/worker'; | ||
import * as maptalks from 'maptalks'; | ||
@@ -16,2 +17,3 @@ import * as THREE from 'three'; | ||
import Lines from './src/Lines'; | ||
import ThreeVectorTileLayer from './src/ThreeVectorTileLayer'; | ||
@@ -335,3 +337,16 @@ const options = { | ||
/** | ||
* | ||
* @param {*} url | ||
* @param {*} options | ||
* @param {*} getMaterial | ||
* @param {*} worker | ||
*/ | ||
toThreeVectorTileLayer(url, options, getMaterial) { | ||
return new ThreeVectorTileLayer(url, options, getMaterial, this); | ||
} | ||
clearMesh() { | ||
@@ -394,3 +409,3 @@ const scene = this.getScene(); | ||
*/ | ||
addMesh(meshes) { | ||
addMesh(meshes, render = true) { | ||
if (!meshes) return this; | ||
@@ -416,3 +431,5 @@ if (!Array.isArray(meshes)) { | ||
this._zoomend(); | ||
this.renderScene(); | ||
if (render) { | ||
this.renderScene(); | ||
} | ||
return this; | ||
@@ -425,3 +442,3 @@ } | ||
*/ | ||
removeMesh(meshes) { | ||
removeMesh(meshes, render = true) { | ||
if (!meshes) return this; | ||
@@ -446,3 +463,5 @@ if (!Array.isArray(meshes)) { | ||
}); | ||
this.renderScene(); | ||
if (render) { | ||
this.renderScene(); | ||
} | ||
return this; | ||
@@ -579,3 +598,3 @@ } | ||
if (parent) { | ||
parent._fire('empty', Object.assign({}, e, { target: parent })); | ||
parent.fire('empty', Object.assign({}, e, { target: parent })); | ||
} | ||
@@ -610,3 +629,3 @@ } | ||
baseObject._mouseover = false; | ||
baseObject._fire('mouseout', Object.assign({}, e, { target: baseObject, type: 'mouseout', selectMesh: null })); | ||
baseObject.fire('mouseout', Object.assign({}, e, { target: baseObject, type: 'mouseout', selectMesh: null })); | ||
baseObject.closeToolTip(); | ||
@@ -616,3 +635,3 @@ } | ||
baseObject._mouseover = false; | ||
baseObject._fire('mouseout', Object.assign({}, e, { target: baseObject, type: 'mouseout' })); | ||
baseObject.fire('mouseout', Object.assign({}, e, { target: baseObject, type: 'mouseout' })); | ||
baseObject.closeToolTip(); | ||
@@ -625,6 +644,6 @@ } | ||
if (!baseObject._mouseover) { | ||
baseObject._fire('mouseover', Object.assign({}, e, { target: baseObject, type: 'mouseover', selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
baseObject.fire('mouseover', Object.assign({}, e, { target: baseObject, type: 'mouseover', selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
baseObject._mouseover = true; | ||
} | ||
baseObject._fire(type, Object.assign({}, e, { target: baseObject, selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
baseObject.fire(type, Object.assign({}, e, { target: baseObject, selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
// tooltip | ||
@@ -641,3 +660,3 @@ const tooltip = baseObject.getToolTip(); | ||
if (baseObject instanceof BaseObject) { | ||
baseObject._fire(type, Object.assign({}, e, { target: baseObject, selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
baseObject.fire(type, Object.assign({}, e, { target: baseObject, selectMesh: (baseObject.getSelectMesh ? baseObject.getSelectMesh() : null) })); | ||
if (type === 'click') { | ||
@@ -644,0 +663,0 @@ const infoWindow = baseObject.getInfoWindow(); |
{ | ||
"name": "maptalks.three", | ||
"version": "0.7.4", | ||
"version": "0.8.0", | ||
"description": "A maptalks Layer to render with THREE.js.", | ||
@@ -32,2 +32,3 @@ "license": "MIT", | ||
"rollup-plugin-commonjs": "^9.1.0", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^3.3.0", | ||
@@ -34,0 +35,0 @@ "rollup-plugin-uglify": "^6.0.0", |
@@ -11,4 +11,3 @@ # maptalks.three | ||
* [Extrude Buildings](https://maptalks.github.io/maptalks.three/demo/buildings.html). | ||
* [Load MTL Model](https://maptalks.github.io/maptalks.three/demo/infantry.html). | ||
* [Demos](https://maptalks.github.io/maptalks.three/demo/index.html). | ||
@@ -137,1 +136,8 @@ ## Install | ||
``` | ||
## Publication | ||
```shell | ||
npm version ${version} | ||
npm publish | ||
npm push master ${version} | ||
``` |
@@ -5,2 +5,3 @@ const resolve = require('rollup-plugin-node-resolve'); | ||
const uglify = require('rollup-plugin-uglify').uglify; | ||
const json = require('rollup-plugin-json'); | ||
const pkg = require('./package.json'); | ||
@@ -16,8 +17,44 @@ | ||
outro = `typeof console !== 'undefined' && console.log('${outro}');`; | ||
const intro = ` | ||
var IS_NODE = typeof exports === 'object' && typeof module !== 'undefined'; | ||
var maptalks = maptalks; | ||
if (IS_NODE) { | ||
maptalks = maptalks || require('maptalks'); | ||
} | ||
var workerLoaded; | ||
function define(_, chunk) { | ||
if (!workerLoaded) { | ||
if(maptalks.registerWorkerAdapter){ | ||
maptalks.registerWorkerAdapter('${pkg.name}', chunk); | ||
workerLoaded = true; | ||
}else{ | ||
console.warn('maptalks.registerWorkerAdapter is not defined,If you need to use ThreeVectorTileLayer,you can npm i maptalks@next,more https://github.com/maptalks/maptalks.js/tree/next'); | ||
} | ||
} else { | ||
var exports = IS_NODE ? module.exports : maptalks; | ||
chunk(exports, maptalks); | ||
} | ||
}`; | ||
function removeGlobal() { | ||
return { | ||
transform(code, id) { | ||
if (id.indexOf('worker.js') === -1) return null; | ||
const commonjsCode = /typeof global/g; | ||
var transformedCode = code.replace(commonjsCode, 'typeof undefined'); | ||
return { | ||
code: transformedCode, | ||
map: { mappings: '' } | ||
}; | ||
} | ||
}; | ||
} | ||
const basePlugins = [ | ||
json(), | ||
resolve({ | ||
module : true, | ||
jsnext : true, | ||
main : true | ||
module: true, | ||
jsnext: true, | ||
main: true | ||
}), | ||
@@ -27,3 +64,4 @@ commonjs(), | ||
// exclude: 'node_modules/**' | ||
}) | ||
}), | ||
removeGlobal() | ||
]; | ||
@@ -33,5 +71,31 @@ | ||
{ | ||
input: 'src/worker/index.js', | ||
plugins: [ | ||
json(), | ||
resolve({ | ||
module: true, | ||
jsnext: true, | ||
main: true | ||
}), | ||
commonjs(), | ||
babel() | ||
], | ||
external: ['maptalks'], | ||
output: { | ||
format: 'amd', | ||
name: 'maptalks', | ||
globals: { | ||
'maptalks': 'maptalks' | ||
}, | ||
extend: true, | ||
file: 'dist/worker.js' | ||
}, | ||
// watch: { | ||
// include: 'src/worker/**' | ||
// } | ||
}, | ||
{ | ||
input: 'index.js', | ||
plugins: basePlugins.concat([uglify()]), | ||
external : ['maptalks', 'three'], | ||
external: ['maptalks', 'three'], | ||
output: { | ||
@@ -42,7 +106,8 @@ 'sourcemap': false, | ||
'banner': banner, | ||
'outro' : outro, | ||
'extend' : true, | ||
'globals' : { | ||
'maptalks' : 'maptalks', | ||
'THREE' : 'three' | ||
'outro': outro, | ||
'intro': intro, | ||
'extend': true, | ||
'globals': { | ||
'maptalks': 'maptalks', | ||
'THREE': 'three' | ||
}, | ||
@@ -55,13 +120,14 @@ 'file': 'dist/maptalks.three.min.js' | ||
plugins: basePlugins, | ||
external : ['maptalks', 'three'], | ||
external: ['maptalks', 'three'], | ||
output: { | ||
'sourcemap': false, | ||
'sourcemap': true, | ||
'format': 'umd', | ||
'name': 'maptalks', | ||
'banner': banner, | ||
'outro' : outro, | ||
'extend' : true, | ||
'globals' : { | ||
'maptalks' : 'maptalks', | ||
'THREE' : 'three' | ||
'outro': outro, | ||
'extend': true, | ||
'intro': intro, | ||
'globals': { | ||
'maptalks': 'maptalks', | ||
'THREE': 'three' | ||
}, | ||
@@ -71,7 +137,6 @@ 'file': 'dist/maptalks.three.js' | ||
}, | ||
{ | ||
input: 'index.js', | ||
plugins: basePlugins, | ||
external : ['maptalks', 'three'], | ||
external: ['maptalks', 'three'], | ||
output: { | ||
@@ -81,3 +146,4 @@ 'sourcemap': false, | ||
'banner': banner, | ||
'outro' : outro, | ||
'outro': outro, | ||
'intro': intro, | ||
'file': pkg.module | ||
@@ -84,0 +150,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
1100539
16724
142
0
13
13