Skip to content

Commit 27d9a71

Browse files
committed
fix: scaleXMode in video attach
1 parent 9c0ef16 commit 27d9a71

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/lib/player/objects/Line.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ export class Line {
359359
tint: number;
360360
}) {
361361
this._attachedVideos.forEach((video) => {
362-
video.updateAttach({ ...params, width: this._line.displayWidth });
362+
video.updateAttach({ ...params });
363363
});
364364
}
365365

src/lib/player/objects/Video.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,8 @@ export class Video extends GameObjects.Container {
185185
scaleX: number;
186186
scaleY: number;
187187
tint: number;
188-
width: number;
189188
}) {
190-
const { x, y, rotation, alpha, scaleX, scaleY, tint, width: lineWidth } = params;
189+
const { x, y, rotation, alpha, scaleX, scaleY, tint } = params;
191190
this.updateTransform(
192191
x * (this._data.attach?.positionXFactor ?? 1) + this._scene.sys.canvas.width / 2,
193192
y * (this._data.attach?.positionYFactor ?? 1) + this._scene.sys.canvas.height / 2,
@@ -205,7 +204,10 @@ export class Video extends GameObjects.Container {
205204
if (this._mask) this._mask.scaleY = scaleY;
206205
}
207206
if (this._mask) {
208-
const width = this._data.attach?.scaleXMode === 2 ? lineWidth : this._video.displayWidth;
207+
const width =
208+
this._data.attach?.scaleXMode === 2
209+
? this._video.displayWidth * scaleX
210+
: this._video.displayWidth;
209211
const height = this._video.displayHeight * (this._data.attach?.scaleYMode === 2 ? scaleY : 1);
210212
this._mask.clear();
211213
// this._mask.fillStyle(0xffff00);

0 commit comments

Comments
 (0)