finally saving things

This commit is contained in:
muerwre 2018-08-30 17:10:33 +07:00
parent e0f5d0238a
commit 47e4f4a97d
22 changed files with 277 additions and 38 deletions
src/modules

View file

@ -9,9 +9,11 @@ export class Sticker {
constructor({
latlng, deleteSticker, map, lockMapClicks, sticker, angle = 2.2
}) {
this.latlng = latlng;
this.angle = angle;
this.isDragging = false;
this.map = map;
this.sticker = sticker;
this.deleteSticker = deleteSticker;
this.lockMapClicks = lockMapClicks;
@ -37,7 +39,7 @@ export class Sticker {
className: 'sticker-container',
});
this.sticker = marker(latlng, { icon: mark });
this.marker = marker(latlng, { icon: mark });
this.setAngle(angle);
@ -56,7 +58,7 @@ export class Sticker {
this.preventPropagations(e);
this.isDragging = true;
this.sticker.disableEdit();
this.marker.disableEdit();
this.lockMapClicks(true);
@ -75,7 +77,7 @@ export class Sticker {
this.preventPropagations(e);
this.isDragging = false;
this.sticker.enableEdit();
this.marker.enableEdit();
window.removeEventListener('mousemove', this.onDrag);
window.removeEventListener('mouseup', this.onDragStop);
@ -97,8 +99,6 @@ export class Sticker {
};
setAngle = angle => {
// $(active_sticker.container).css('left',6+x-parseInt(active_sticker.ctrl.css('left'))).css('top',6+y-parseInt(active_sticker.ctrl.css('top')));
//
const rad = 44;
const mrad = 76;
const x = ((Math.cos(angle + 3.14) * rad) - 30);
@ -114,7 +114,7 @@ export class Sticker {
this.stickerDelete.style.top = ay;
this.stickerArrow.style.transform = `rotate(${angle + 3.14}rad)`;
}
};
generateStickerSVG = sticker => (
`
@ -122,5 +122,11 @@ export class Sticker {
<use xlink:href="${stickers}#sticker-${sticker}" x="0" y="0" width="64" height="64" />
</svg>
`
)
);
dumpData = () => ({
angle: this.angle,
latlng: this.latlng,
sticker: this.sticker,
})
}