mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
fixed stickers editing
This commit is contained in:
parent
f2758843bf
commit
76d6cb3717
4 changed files with 17 additions and 3 deletions
|
@ -20,7 +20,7 @@
|
||||||
todo check osrm is up
|
todo check osrm is up
|
||||||
|
|
||||||
todo maybe: map preview on save
|
todo maybe: map preview on save
|
||||||
todo maybe: stickers clusterization?
|
done maybe: stickers clusterization?
|
||||||
|
|
||||||
## DONE
|
## DONE
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ export class Editor {
|
||||||
// map, editor: this,
|
// map, editor: this,
|
||||||
// });
|
// });
|
||||||
|
|
||||||
this.stickers = new Stickers({ map, lockMapClicks, triggerOnChange });
|
this.stickers = new Stickers({ map, lockMapClicks, triggerOnChange, editor: this });
|
||||||
this.router = new Router({
|
this.router = new Router({
|
||||||
map, lockMapClicks, setRouterPoints: this.setRouterPoints, changeMode, pushPolyPoints
|
map, lockMapClicks, setRouterPoints: this.setRouterPoints, changeMode, pushPolyPoints
|
||||||
});
|
});
|
||||||
|
|
|
@ -60,6 +60,9 @@ export class Sticker {
|
||||||
onMouseDown={this.onDelete}
|
onMouseDown={this.onDelete}
|
||||||
onTouchStart={this.onDelete}
|
onTouchStart={this.onDelete}
|
||||||
/>
|
/>
|
||||||
|
{
|
||||||
|
console.log('A?')
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</React.Fragment>,
|
</React.Fragment>,
|
||||||
this.element
|
this.element
|
||||||
|
|
|
@ -5,10 +5,11 @@ import icons from '$sprites/icon.svg';
|
||||||
import { clusterIcon } from '$utils/clusterIcon';
|
import { clusterIcon } from '$utils/clusterIcon';
|
||||||
|
|
||||||
export class Stickers {
|
export class Stickers {
|
||||||
constructor({ map, lockMapClicks, triggerOnChange }) {
|
constructor({ map, lockMapClicks, triggerOnChange, editor }) {
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.layer = layerGroup();
|
this.layer = layerGroup();
|
||||||
this.triggerOnChange = triggerOnChange;
|
this.triggerOnChange = triggerOnChange;
|
||||||
|
this.editor = editor;
|
||||||
|
|
||||||
this.clusterLayer = L.markerClusterGroup({
|
this.clusterLayer = L.markerClusterGroup({
|
||||||
spiderfyOnMaxZoom: false,
|
spiderfyOnMaxZoom: false,
|
||||||
|
@ -20,6 +21,8 @@ export class Stickers {
|
||||||
iconCreateFunction: clusterIcon,
|
iconCreateFunction: clusterIcon,
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
|
this.clusterLayer.on('animationend', this.onSpiderify);
|
||||||
|
|
||||||
this.lockMapClicks = lockMapClicks;
|
this.lockMapClicks = lockMapClicks;
|
||||||
this.stickers = [];
|
this.stickers = [];
|
||||||
|
|
||||||
|
@ -70,6 +73,14 @@ export class Stickers {
|
||||||
|
|
||||||
dumpData = () => this.stickers.map(sticker => sticker.dumpData());
|
dumpData = () => this.stickers.map(sticker => sticker.dumpData());
|
||||||
|
|
||||||
|
onSpiderify = () => {
|
||||||
|
if (this.editor.getEditing()) {
|
||||||
|
this.startEditing();
|
||||||
|
} else {
|
||||||
|
this.stopEditing();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
startEditing = () => {
|
startEditing = () => {
|
||||||
this.stickers.map(sticker => sticker.startEditing());
|
this.stickers.map(sticker => sticker.startEditing());
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue