Skip to content

Commit

Permalink
fix(util): extent
Browse files Browse the repository at this point in the history
  • Loading branch information
lzxue committed Mar 14, 2019
1 parent eda3042 commit 0ee3ce9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 7 additions & 2 deletions src/core/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

};
// 更新
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -624,7 +629,7 @@ export default class Layer extends Base {
this.scene.off('zoomchange', this._zoomchangeHander);
this.destroyed = true;
}
_preRender() {
preRender() {

}
}
Expand Down
18 changes: 9 additions & 9 deletions src/util/geo.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 0ee3ce9

Please sign in to comment.