fix(util): extent

This commit is contained in:
thinkinggis 2019-03-14 15:04:47 +08:00
parent eda3042b3f
commit 0ee3ce958d
3 changed files with 17 additions and 12 deletions

View File

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

View File

@ -89,6 +89,7 @@ export default class Layer extends Base {
const zoom = this.scene.getZoom();
object.material.setUniformsValue('u_time', this.scene._engine.clock.getElapsedTime());
object.material.setUniformsValue('u_zoom', zoom);
this._preRender();
};
// 更新
@ -280,7 +281,11 @@ export default class Layer extends Base {
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) {
const { featureId } = e;
this._activeIds = featureId;
@ -624,7 +629,7 @@ export default class Layer extends Base {
this.scene.off('zoomchange', this._zoomchangeHander);
this.destroyed = true;
}
_preRender() {
preRender() {
}
}

View File

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