From c4d76090a3c68fe7e73e660cb89db2014fde1813 Mon Sep 17 00:00:00 2001 From: drawcall Date: Mon, 6 Sep 2021 18:11:03 +0800 Subject: [PATCH] feat: FFVideo add initScale --- lib/node/video.js | 12 +++++++----- package.json | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/node/video.js b/lib/node/video.js index bb8ac316..9661ade9 100755 --- a/lib/node/video.js +++ b/lib/node/video.js @@ -131,7 +131,7 @@ class FFVideo extends FFImage { * @private */ createDisplay() { - const { width = 300, height = 200 } = this.conf; + const [width, height] = this.getWH(); this.display = new Sprite(); this.display.attr({ width, height }); this.setAnchor(0.5); @@ -223,13 +223,15 @@ class FFVideo extends FFImage { * @private */ drawCoverImage() { + const { display } = this; const [width, height] = this.getWH(); const frame = this.materials.getSourceRect(width, height); - // const orig = new Rectangle(0, 0, width, height); - // const trim = new Rectangle(0, 0, width, height); const texture = new Texture(new BaseTexture(), frame); - this.display.texture = texture; - this.display.attr({ width, height }); + + display.texture = texture; + display.attr({ width, height }); + display.initScale && display.initScale.copy(display.scale); + this.drawing(); } diff --git a/package.json b/package.json index b04896d4..c1d5b56a 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ffcreator", - "version": "4.5.2", + "version": "4.5.5", "description": "FFCreator is a lightweight and flexible short video production library", "main": "lib/index.js", "scripts": {