mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 19:16:41 +07:00
renderer: disabled rendering of empty text
This commit is contained in:
parent
88433bad4a
commit
0c51dc44df
2 changed files with 5 additions and 4 deletions
|
@ -116,6 +116,8 @@ export class Sticker {
|
||||||
onDragStop = e => {
|
onDragStop = e => {
|
||||||
this.preventPropagations(e);
|
this.preventPropagations(e);
|
||||||
|
|
||||||
|
if (!this.marker) return;
|
||||||
|
|
||||||
this.triggerOnChange();
|
this.triggerOnChange();
|
||||||
this.isDragging = false;
|
this.isDragging = false;
|
||||||
this.marker.enableEdit();
|
this.marker.enableEdit();
|
||||||
|
|
|
@ -185,6 +185,7 @@ const measureRect = (x, y, width, height, reversed) => ({
|
||||||
rectH: height + 20,
|
rectH: height + 20,
|
||||||
textX: reversed ? (x - width - 36) : x + 36
|
textX: reversed ? (x - width - 36) : x + 36
|
||||||
});
|
});
|
||||||
|
|
||||||
const composeStickerText = (ctx, x, y, angle, text) => {
|
const composeStickerText = (ctx, x, y, angle, text) => {
|
||||||
const rad = 56;
|
const rad = 56;
|
||||||
const tX = ((Math.cos(angle + Math.PI) * rad) - 30) + x + 28;
|
const tX = ((Math.cos(angle + Math.PI) * rad) - 30) + x + 28;
|
||||||
|
@ -228,10 +229,7 @@ const composeStickerImage = async (ctx, x, y, angle, set, sticker) => {
|
||||||
const tY = ((Math.sin(angle + Math.PI) * rad) - 30) + y - 4;
|
const tY = ((Math.sin(angle + Math.PI) * rad) - 30) + y - 4;
|
||||||
const offsetX = STICKERS[set].layers[sticker].off * 72;
|
const offsetX = STICKERS[set].layers[sticker].off * 72;
|
||||||
|
|
||||||
console.log(STICKERS[set].url);
|
|
||||||
|
|
||||||
return imageFetcher(STICKERS[set].url).then(image => (
|
return imageFetcher(STICKERS[set].url).then(image => (
|
||||||
// ctx.drawImage(image, 0, 0, 72, 72, 100, 100, 72, 72)
|
|
||||||
ctx.drawImage(image, offsetX, 0, 72, 72, tX, tY, 72, 72)
|
ctx.drawImage(image, offsetX, 0, 72, 72, tX, tY, 72, 72)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -242,7 +240,8 @@ export const composeStickers = async ({ stickers, ctx }) => {
|
||||||
|
|
||||||
stickers.map(({ x, y, angle, text }) => {
|
stickers.map(({ x, y, angle, text }) => {
|
||||||
composeStickerArrow(ctx, x, y, angle);
|
composeStickerArrow(ctx, x, y, angle);
|
||||||
composeStickerText(ctx, x, y, angle, text);
|
|
||||||
|
if (text) composeStickerText(ctx, x, y, angle, text);
|
||||||
});
|
});
|
||||||
|
|
||||||
await Promise.all(stickers.map(({
|
await Promise.all(stickers.map(({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue