This commit is contained in:
李志鹏
2026-01-23 15:41:43 +08:00
parent 2ee200e1ba
commit 55ede508cb
2 changed files with 10 additions and 4 deletions

View File

@@ -25,6 +25,7 @@
O_FLIPX: "object.flipX",
O_FLIPY: "object.flipY",
O_BLENDMODE: "object.blendMode",
O_FILL_REPEAT: "object.fill_repeat",
};
const ACTIONS = {
ADD: "add",
@@ -202,9 +203,9 @@
let scaleY = ((cheight / image.height) * item.scale[1]) / 5;
let scale = cwidth > cheight ? scaleX : scaleY;
let offsetX =
(item.location[0] * cwidth) / props.width - (image.width * scale) / 2;
(item.location[0] * cwidth) / props.width + (image.width * scale) / 2;
let offsetY =
(item.location[1] * cheight) / props.height -
(item.location[1] * cheight) / props.height +
(image.height * scale) / 2;
let angle = item.angle;
let gapX = item.object.gapX;
@@ -223,7 +224,7 @@
ctx.drawImage(image, 0, 0);
let pattern = new fabric.Pattern({
source: tcanvas,
repeat: "repeat",
repeat: item.object?.fill_repeat || "repeat",
patternTransform,
offsetX, // 水平偏移
offsetY, // 垂直偏移
@@ -281,6 +282,7 @@
case KEYS.FILL_SCALEY:
case KEYS.FILL_GAPX:
case KEYS.FILL_GAPY:
case KEYS.O_FILL_REPEAT:
let pattern = await setFill(
list.value.find((v) => v.token === item.token)
);