simple test stickers and sticker tip restyling

This commit is contained in:
muerwre 2018-08-23 15:24:22 +07:00
parent 130e62455d
commit 102328a1b2
2 changed files with 37 additions and 19 deletions

View file

@ -3,6 +3,8 @@ import 'leaflet-editable';
import { DomMarker } from '$utils/DomMarker';
import stickers from '$sprites/stickers.svg';
export class Sticker {
constructor({
latlng, deleteSticker, map, lockMapClicks
@ -24,6 +26,8 @@ export class Sticker {
this.stickerArrow.className = 'sticker-arrow';
this.stickerDelete.className = 'sticker-delete';
this.stickerImage.innerHTML = this.generateStickerSVG('green-sm');
this.element.appendChild(this.stickerArrow);
this.element.appendChild(this.stickerImage);
this.element.appendChild(this.stickerDelete);
@ -95,8 +99,8 @@ 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 = 30;
const mrad = 48;
const rad = 44;
const mrad = 76;
const x = ((Math.cos(angle + 3.14) * rad) - 30);
const y = ((Math.sin(angle + 3.14) * rad) - 30);
@ -111,4 +115,12 @@ export class Sticker {
this.stickerArrow.style.transform = `rotate(${angle + 3.14}rad)`;
}
generateStickerSVG = sticker => (
`
<svg width="64" height="64">
<use xlink:href="${stickers}#sticker-${sticker}" x="0" y="0" width="64" height="64" />
</svg>
`
)
}