This commit is contained in:
李志鹏
2026-01-29 17:16:31 +08:00
parent 33aaf0b600
commit 59422e54d8
10 changed files with 163 additions and 84 deletions

View File

@@ -132,8 +132,8 @@
const offsetY = object.fill?.offsetY;
const twidth = object.fill_?.width;
const theight = object.fill_?.height;
const x = ((offsetX - (twidth * scale) / 2) * 100) / object.width;
const y = ((offsetY - (theight * scale) / 2) * 100) / object.height;
const x = ((offsetX + (twidth * scale) / 2) * 100) / object.width;
const y = ((offsetY + (theight * scale) / 2) * 100) / object.height;
return { x, y };
});
const inputFillOffset = (e) => setFillOffset(e, true);
@@ -143,8 +143,8 @@
const object = props.object;
const patternTransform = object.fill?.patternTransform;
const scale = getTransformScaleAngle(patternTransform).scale;
const x = (left / 100) * object.width + (object.fill_?.width * scale) / 2;
const y = (top / 100) * object.height + (object.fill_?.height * scale) / 2;
const x = (left / 100) * object.width - (object.fill_?.width * scale) / 2;
const y = (top / 100) * object.height - (object.fill_?.height * scale) / 2;
emit(isInput ? "inputFillOffset" : "changeFillOffset", { x, y });
};
</script>

View File

@@ -315,6 +315,7 @@
layerManager: props.layerManager,
layers: layers,
lastSelectLayerId: lastSelectLayerId,
isCommand,
});
if (isCommand) {
props.commandManager.execute(cmd);
@@ -336,6 +337,7 @@
const finalState = computeAngleState(angle, obj, initialState);
transformObject(obj, initialState, finalState, false);
if (!obj.hasOwnProperty("oldState")) obj.oldState = initialState;
props.canvasManager.beforeChangeCanvas([obj]);
};
const changeAngle = (angle, obj) => {
var initialState;
@@ -428,6 +430,7 @@
});
obj.set("fill", pattern);
props.canvas.renderAll();
props.canvasManager.beforeChangeCanvas([obj]);
};
const changeFillAngle = (angle, obj) => {
const fill = obj.get("fill");
@@ -447,6 +450,7 @@
});
obj.set("fill", pattern);
props.canvas.renderAll();
props.canvasManager.beforeChangeCanvas([obj]);
};
const changeFillOffset = (value, obj) => {
const pattern = new fabric.Pattern({
@@ -466,6 +470,7 @@
});
obj.set("fill", pattern);
props.canvas.renderAll();
props.canvasManager.beforeChangeCanvas([obj]);
};
const changeFillScale = (scale, obj) => {
const fill = obj.get("fill");
@@ -498,7 +503,8 @@
newGapY: gapY,
record: true,
});
cmd.execute();
cmd.execute(false);
props.canvasManager.beforeChangeCanvas([obj]);
};
const changeFillGap = (gapX, gapY, obj) => {
if (obj.oldFill_) {