mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
new-poly: removed leaflet-editable
This commit is contained in:
parent
630ed43525
commit
34f99771b1
8 changed files with 15 additions and 15 deletions
|
@ -1,6 +1,6 @@
|
||||||
import { Map } from '$modules/Map';
|
import { Map } from '$modules/Map';
|
||||||
import { NewPoly } from '$modules/NewPoly';
|
import { NewPoly } from '$modules/NewPoly';
|
||||||
import { Poly } from '$modules/Poly';
|
// import { Poly } from '$modules/Poly';
|
||||||
import { MODES } from '$constants/modes';
|
import { MODES } from '$constants/modes';
|
||||||
import { Stickers } from '$modules/Stickers';
|
import { Stickers } from '$modules/Stickers';
|
||||||
import { Router } from '$modules/Router';
|
import { Router } from '$modules/Router';
|
||||||
|
@ -287,12 +287,12 @@ export class Editor {
|
||||||
this.setInitialData();
|
this.setInitialData();
|
||||||
this.owner = { id };
|
this.owner = { id };
|
||||||
|
|
||||||
if (this.poly.latlngs && this.poly.latlngs.length > 1) this.poly.poly.enableEdit();
|
if (this.poly.latlngs && this.poly.latlngs.length > 1) this.poly.poly.editor.enable();
|
||||||
this.stickers.startEditing();
|
this.stickers.startEditing();
|
||||||
};
|
};
|
||||||
|
|
||||||
stopEditing = () => {
|
stopEditing = () => {
|
||||||
this.poly.poly.disableEdit();
|
this.poly.poly.editor.disable();
|
||||||
this.stickers.stopEditing();
|
this.stickers.stopEditing();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { map, tileLayer } from 'leaflet';
|
import { map, tileLayer } from 'leaflet';
|
||||||
import 'leaflet/dist/leaflet.css';
|
import 'leaflet/dist/leaflet.css';
|
||||||
import 'leaflet-editable';
|
// import 'leaflet-editable';
|
||||||
import { PROVIDER } from '$config/frontend';
|
import { PROVIDER } from '$config/frontend';
|
||||||
import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers';
|
import { DEFAULT_PROVIDER, PROVIDERS } from '$constants/providers';
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ export class NewPoly {
|
||||||
];
|
];
|
||||||
|
|
||||||
this.poly.setLatLngs(summary);
|
this.poly.setLatLngs(summary);
|
||||||
this.poly.enableEdit();
|
this.poly.editor.enable();
|
||||||
this.poly.editor.reset();
|
this.poly.editor.reset();
|
||||||
this.updateMarks();
|
this.updateMarks();
|
||||||
};
|
};
|
||||||
|
|
|
@ -165,7 +165,7 @@ export class Poly {
|
||||||
|
|
||||||
clearAll = () => {
|
clearAll = () => {
|
||||||
this.poly.setLatLngs([]);
|
this.poly.setLatLngs([]);
|
||||||
this.poly.disableEdit();
|
// this.poly.disableEdit();
|
||||||
|
|
||||||
this.updateMarks();
|
this.updateMarks();
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { marker } from 'leaflet';
|
import { marker } from 'leaflet';
|
||||||
import 'leaflet-editable';
|
// import 'leaflet-editable';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { DomMarker } from '$utils/DomMarker';
|
import { DomMarker } from '$utils/DomMarker';
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ export class Sticker {
|
||||||
className: 'sticker-container',
|
className: 'sticker-container',
|
||||||
});
|
});
|
||||||
|
|
||||||
this.marker = marker(latlng, { icon: mark });
|
this.marker = marker(latlng, { icon: mark, draggable: true });
|
||||||
|
|
||||||
this.element.addEventListener('mouseup', this.onDragStop);
|
this.element.addEventListener('mouseup', this.onDragStop);
|
||||||
this.element.addEventListener('mouseup', this.preventPropagations);
|
this.element.addEventListener('mouseup', this.preventPropagations);
|
||||||
|
@ -89,7 +89,7 @@ export class Sticker {
|
||||||
window.addEventListener('mousemove', this.onDrag);
|
window.addEventListener('mousemove', this.onDrag);
|
||||||
window.addEventListener('mouseup', this.onDragStop);
|
window.addEventListener('mouseup', this.onDragStop);
|
||||||
|
|
||||||
this.marker.disableEdit();
|
// this.marker.disableEdit();
|
||||||
};
|
};
|
||||||
|
|
||||||
preventPropagations = e => {
|
preventPropagations = e => {
|
||||||
|
@ -110,7 +110,7 @@ export class Sticker {
|
||||||
|
|
||||||
this.lockMapClicks(false);
|
this.lockMapClicks(false);
|
||||||
|
|
||||||
this.marker.enableEdit();
|
// this.marker.enableEdit();
|
||||||
};
|
};
|
||||||
|
|
||||||
onDrag = e => {
|
onDrag = e => {
|
||||||
|
|
|
@ -35,7 +35,7 @@ export class Stickers {
|
||||||
this.stickers.push(marker);
|
this.stickers.push(marker);
|
||||||
|
|
||||||
marker.marker.addTo(this.map);
|
marker.marker.addTo(this.map);
|
||||||
marker.marker.enableEdit();
|
// marker.marker.enableEdit();
|
||||||
};
|
};
|
||||||
|
|
||||||
deleteStickerByReference = ref => {
|
deleteStickerByReference = ref => {
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import L from 'leaflet';
|
import L from 'leaflet';
|
||||||
|
|
||||||
import 'leaflet-editable';
|
// import 'leaflet-editable';
|
||||||
import 'leaflet.markercluster';
|
// import 'leaflet.markercluster';
|
||||||
import 'leaflet.markercluster.webpack';
|
// import 'leaflet.markercluster.webpack';
|
||||||
import 'leaflet-geometryutil';
|
import 'leaflet-geometryutil';
|
||||||
|
|
||||||
import { mapStyles } from '$constants/mapStyles';
|
import { mapStyles } from '$constants/mapStyles';
|
||||||
|
|
|
@ -133,7 +133,7 @@ const insertVertex = ({ e, updatePolyCoords }) => {
|
||||||
}
|
}
|
||||||
// если точка найдена, добавляем её в отрезок
|
// если точка найдена, добавляем её в отрезок
|
||||||
if (pos.length>1) {
|
if (pos.length>1) {
|
||||||
poly.editor.disable();
|
// poly.editor.disable();
|
||||||
latlngs.splice(pos[1],0,e.latlng);
|
latlngs.splice(pos[1],0,e.latlng);
|
||||||
poly.setLatLngs(latlngs);
|
poly.setLatLngs(latlngs);
|
||||||
poly.editor.initVertexMarkers();
|
poly.editor.initVertexMarkers();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue