Skip to content

Commit 18caafd

Browse files
fix: transform and scale
1 parent b1f5018 commit 18caafd

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

packages/webgal/src/Core/controller/stage/pixi/PixiController.ts

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,6 @@ export default class PixiStage {
625625
thisFigureContainer.zIndex = metadata.zIndex;
626626
}
627627
}
628-
629-
thisFigureContainer.pivot.set(0, this.stageHeight / 2);
630-
631628
// 挂载
632629
this.figureContainer.addChild(thisFigureContainer);
633630
this.figureObjects.push({
@@ -665,21 +662,20 @@ export default class PixiStage {
665662
models.forEach((model) => {
666663
const scaleX = stageWidth / model.width;
667664
const scaleY = stageHeight / model.height;
668-
const targetScale = Math.min(scaleX, scaleY) * 1.5;
665+
const targetScale = Math.min(scaleX, scaleY);
669666
const targetWidth = model.width * targetScale;
670-
// const targetHeight = model.height * targetScale;
671-
672-
model.scale.set(targetScale);
673-
model.anchor.set(0.5);
674-
675667
const targetHeight = model.height * targetScale;
668+
model.scale.x = targetScale;
669+
model.scale.y = targetScale;
670+
model.anchor.set(0.5);
671+
model.position.x = 0;
672+
model.position.y = stageHeight / 2;
676673

677674
let baseY = stageHeight / 2;
678675
if (targetHeight < stageHeight) {
679-
baseY = stageHeight / 2 + (stageHeight - targetHeight) / 2;
676+
baseY = stageHeight / 2 + stageHeight - targetHeight / 2;
680677
}
681678
thisFigureContainer.setBaseY(baseY);
682-
683679
if (pos === 'center') {
684680
thisFigureContainer.setBaseX(stageWidth / 2);
685681
} else if (pos === 'left') {
@@ -688,9 +684,7 @@ export default class PixiStage {
688684
thisFigureContainer.setBaseX(stageWidth - targetWidth / 2);
689685
}
690686

691-
model.position.x = 0;
692-
model.position.y = stageHeight / 1.2;
693-
687+
thisFigureContainer.pivot.set(0, stageHeight / 2);
694688
let motionToSet = motion;
695689
let animation_index = 0;
696690
let priority_number = 3;

0 commit comments

Comments
 (0)