cd-mapgis 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/MapDrawUtil.js +8 -6
package/package.json
CHANGED
package/src/MapDrawUtil.js
CHANGED
|
@@ -42,14 +42,15 @@ export default class MapDrawUtil {
|
|
|
42
42
|
}
|
|
43
43
|
//绘制完成事件
|
|
44
44
|
drawend(fun, stop) {
|
|
45
|
+
let _this = this;
|
|
45
46
|
this.drawObj.on('drawend', (e) => {
|
|
46
|
-
|
|
47
|
+
_this._drawTempLayer([e.feature]);
|
|
47
48
|
try {
|
|
48
49
|
fun(e.feature.getGeometry().getCoordinates());//绘制完成后,将绘制的坐标串传入回调函数
|
|
49
50
|
} catch (ex) {
|
|
50
51
|
console.error(ex);
|
|
51
52
|
}
|
|
52
|
-
if (stop)
|
|
53
|
+
if (stop) _this._closeDrawObj();
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
//关闭工具
|
|
@@ -86,6 +87,7 @@ export default class MapDrawUtil {
|
|
|
86
87
|
tool(toolType) {
|
|
87
88
|
let _sketch = null;
|
|
88
89
|
let _listener = null;
|
|
90
|
+
let _this = this;
|
|
89
91
|
//绘制开始事件
|
|
90
92
|
this.drawObj.on('drawstart', (e) => {
|
|
91
93
|
_sketch = e.feature;
|
|
@@ -93,16 +95,16 @@ export default class MapDrawUtil {
|
|
|
93
95
|
let geom = evt.target;
|
|
94
96
|
var viewTxt;
|
|
95
97
|
if (toolType == "len") {
|
|
96
|
-
viewTxt =
|
|
98
|
+
viewTxt = _this._formatLength(geom.clone());
|
|
97
99
|
} else if (toolType == "area") {
|
|
98
|
-
viewTxt =
|
|
100
|
+
viewTxt = _this._formatArea(geom.clone());
|
|
99
101
|
}
|
|
100
|
-
|
|
102
|
+
_this._viewToolText(viewTxt, geom.getLastCoordinate());
|
|
101
103
|
});
|
|
102
104
|
});
|
|
103
105
|
//绘制完成事件
|
|
104
106
|
this.drawObj.on('drawend', function (e) {
|
|
105
|
-
|
|
107
|
+
_this._drawTempLayer([e.feature]);
|
|
106
108
|
_sketch = null;
|
|
107
109
|
unByKey(_listener);
|
|
108
110
|
});
|