Merge branch 'pick' into 'master'

fix(util): extent

修复extent计算问题

See merge request !13
This commit is contained in:
thinkinggis 2019-03-14 15:16:35 +08:00
commit e9cb6a8eb5
4 changed files with 17 additions and 15 deletions

View File

@ -8,9 +8,6 @@ node_modules/
demos/assets/ demos/assets/
demos/index.html demos/index.html
demos/* demos/*
<<<<<<< HEAD
rollup/* rollup/*
webpack/* webpack/*
======= src/core/three.js
src/core/three.js
>>>>>>> master

View File

@ -1,6 +1,6 @@
{ {
"name": "@antv/l7", "name": "@antv/l7",
"version": "1.1.0", "version": "1.1.1",
"description": "Large-scale WebGL-powered Geospatial Data Visualization", "description": "Large-scale WebGL-powered Geospatial Data Visualization",
"main": "build/l7.js", "main": "build/l7.js",
"browser": "build/l7.js", "browser": "build/l7.js",

View File

@ -89,6 +89,7 @@ export default class Layer extends Base {
const zoom = this.scene.getZoom(); const zoom = this.scene.getZoom();
object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime()); object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
object.material.setUniformsValue('u_zoom', zoom); object.material.setUniformsValue('u_zoom', zoom);
this.preRender();
}; };
object.onAfterRender = () => { // 每次渲染后改变状态 object.onAfterRender = () => { // 每次渲染后改变状态
@ -282,7 +283,11 @@ export default class Layer extends Base {
this.off('mouseleave', resetHander); this.off('mouseleave', resetHander);
} }
} }
setActive(id, color) {
this._activeIds = id;
this.layerMesh.material.setUniformsValue('u_activeId', id);
this.layerMesh.material.setUniformsValue('u_activeColor', ColorUtil.color2RGBA(color));
}
_addActiveFeature(e) { _addActiveFeature(e) {
const { featureId } = e; const { featureId } = e;
this._activeIds = featureId; this._activeIds = featureId;

View File

@ -12,15 +12,15 @@ export function extent(data) {
return extent; return extent;
} }
function calcExtent(extent, coords) { function calcExtent(extent, coords) {
coords.forEach(coord => { if (Array.isArray(coords[0])) {
if (Array.isArray(coord[0])) { coords.forEach(coord => {
calcExtent(extent, coord); calcExtent(extent, coord);
} else { });
if (extent[0] > coord[0]) extent[0] = coord[0]; } else {
if (extent[1] > coord[1]) extent[1] = coord[1]; if (extent[0] > coords[0]) extent[0] = coords[0];
if (extent[2] < coord[0]) extent[2] = coord[0]; if (extent[1] > coords[1]) extent[1] = coords[1];
if (extent[3] < coord[1]) extent[3] = coord[1]; if (extent[2] < coords[0]) extent[2] = coords[0];
} if (extent[3] < coords[1]) extent[3] = coords[1];
}); }
return extent; return extent;
} }