Merge branch 'dev_vite' of ssh://18.167.251.121:10002/aidlab/aida_front into dev_vite

This commit is contained in:
X1627315083
2026-02-02 11:48:12 +08:00

View File

@@ -109,12 +109,19 @@ export class FillRepeatCommand extends Command {
const fdObject = this.canvasManager.getFixedLayerObject();
const bgObject = this.canvasManager.getBackgroundLayerObject();
const tObject = fdObject || bgObject;
const tWidth = tObject.width;
const tHeight = tObject.height;
// const offsetX = object.fill?.hasOwnProperty("offsetX") ? object.fill.offsetX : tObject.width / 2;
// const offsetY = object.fill?.hasOwnProperty("offsetY") ? object.fill.offsetY : tObject.height / 2;
const patternTransform = object.fill?.hasOwnProperty("patternTransform") ? object.fill.patternTransform : createPatternTransform(0.3, 0);
const scaleX_ = tWidth / img.width / 5;
const scaleY_ = tHeight / img.height / 5;
const scale_ = tWidth > tHeight ? scaleX_ : scaleY_;
const patternTransform = object.fill?.hasOwnProperty("patternTransform") ? object.fill.patternTransform : createPatternTransform(scale_, 0);
const scale = getTransformScaleAngle(patternTransform).scale;
const offsetX = tObject.width / 2 - img.width * scale / 2;
const offsetY = tObject.height / 2 - img.height * scale / 2;
const offsetX = tWidth / 2 - img.width * scale / 2;
const offsetY = tHeight / 2 - img.height * scale / 2;
const pattern = new fabric.Pattern({
source: img,
repeat: this.fillRepeat,
@@ -146,10 +153,10 @@ export class FillRepeatCommand extends Command {
let scaleX = tObject.scaleX || 1;
let scaleY = tObject.scaleY || 1;
rect.set({
width: tObject.width,
height: tObject.height,
top: tObject.top - tObject.height * scaleY / 2,
left: tObject.left - tObject.width * scaleX / 2,
width: tWidth,
height: tHeight,
top: tObject.top - tHeight * scaleY / 2,
left: tObject.left - tWidth * scaleX / 2,
scaleX,
scaleY,
});