Skip to content

Commit 93b7699

Browse files
committed
修改所有hpr计算的地方,增加判断
1 parent 95695ad commit 93b7699

File tree

5 files changed

+17
-0
lines changed

5 files changed

+17
-0
lines changed

CHANGLES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ Change Log
55

66
##### Additions :tada:
77
* 所有标绘增加拾取功能
8+
* 修复创建矩形标绘崩溃问题hpr引起
9+
* 发行版增加map,方便调试
10+
* 修改所有hpr计算的地方,增加判断,避免崩溃
811

912
### 1.0.13 - 2019-12-6
1013

src/GeoCircle.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ class GeoCircle extends PlotPolygonBase {
3232
this._polygonPositions.push([...positions[1]]);
3333

3434
const hpr = Tool.Math.hpr(positions[0], positions[1]);
35+
if (!hpr) {
36+
return;
37+
}
3538

3639
const slice = 360;
3740

src/GeoParallelSearch.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class GeoParallelSearch extends PlotPolylineBase {
3131
}
3232
}
3333
const hpr = Tool.Math.hpr(positions[i], positions[i - 1]);
34+
if (!hpr) {
35+
return;
36+
}
3437
Tool.Math.geoMove(positions[i], hpr[0] + Math.PI / 6, Tool.Math.distance(positions[i - 1], positions[i]) * 0.1, this._leftArrowPosition);
3538
Tool.Math.geoMove(positions[i], hpr[0] - Math.PI / 6, Tool.Math.distance(positions[i - 1], positions[i]) * 0.1, this._rightArrowPosition);
3639
positions.push([...positions[i]]);

src/GeoSector.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ class GeoSector extends PlotPolygonBase {
3333

3434
const hpr1 = Tool.Math.hpr(positions[0], positions[1]);
3535
const hpr2 = Tool.Math.hpr(positions[0], positions[2]);
36+
if (!hpr || !hpr2) {
37+
return;
38+
}
3639

3740
const slice = 360;
3841
var angle = 0;

src/GeoSectorSearch.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ class GeoSectorSearch extends PlotPolylineBase {
4343
positions[1],
4444
this._scratchHpr
4545
);
46+
47+
if (!hpr) {
48+
return;
49+
}
50+
4651
for (let i = 0; i < 6; ++i) {
4752
Tool.Math.geoMove(
4853
positions[0],

0 commit comments

Comments
 (0)