@mapgis/mapbox-gl-draw-radius 16.2.0 → 16.4.0
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/radius-mode.js +5 -8
package/package.json
CHANGED
package/src/radius-mode.js
CHANGED
|
@@ -50,10 +50,10 @@ function createGeoJSONCircle(
|
|
|
50
50
|
const km = radiusInKm;
|
|
51
51
|
|
|
52
52
|
const ret = [];
|
|
53
|
-
|
|
53
|
+
const distanceX = km / 111.32;
|
|
54
54
|
// const distanceY = km / 110.574;
|
|
55
|
-
const distanceX =
|
|
56
|
-
|
|
55
|
+
// const distanceX =
|
|
56
|
+
// km / (111.32 * Math.cos((coords.latitude * Math.PI) / 180));
|
|
57
57
|
const distanceY = km / 110.574;
|
|
58
58
|
|
|
59
59
|
let theta;
|
|
@@ -223,17 +223,14 @@ RadiusMode.onStop = function (state) {
|
|
|
223
223
|
|
|
224
224
|
// remove last added coordinate
|
|
225
225
|
state.line.removeCoordinate("0");
|
|
226
|
-
if (state.
|
|
227
|
-
const geojson = state.line.toGeoJSON();
|
|
228
|
-
this.deleteFeature([state.line.id], { silent: true });
|
|
229
|
-
|
|
226
|
+
if (state.circle.isValid()) {
|
|
230
227
|
this.map.fire("draw.create", {
|
|
231
228
|
features: [state.circle.toGeoJSON()],
|
|
232
229
|
});
|
|
233
230
|
} else {
|
|
234
|
-
this.deleteFeature([state.line.id], { silent: true });
|
|
235
231
|
this.changeMode("simple_select", {}, { silent: true });
|
|
236
232
|
}
|
|
233
|
+
this.deleteFeature([state.line.id], { silent: true });
|
|
237
234
|
};
|
|
238
235
|
|
|
239
236
|
RadiusMode.toDisplayFeatures = function (state, geojson, display) {
|