diff --git a/src/js/core/application/Video/service/VideoElementToCanvasElementService.ts b/src/js/core/application/Video/service/VideoElementToCanvasElementService.ts index e3ca3c86..fc5daed9 100644 --- a/src/js/core/application/Video/service/VideoElementToCanvasElementService.ts +++ b/src/js/core/application/Video/service/VideoElementToCanvasElementService.ts @@ -26,6 +26,7 @@ export const execute = ( return canvas; } + console.log(video.duration); video.currentTime = sec; context.drawImage(video, 0, 0, width, height); diff --git a/src/js/core/application/Video/usecase/VideoCreateDisplayObjectElementUseCase.ts b/src/js/core/application/Video/usecase/VideoCreateDisplayObjectElementUseCase.ts index edc17775..47dcec52 100644 --- a/src/js/core/application/Video/usecase/VideoCreateDisplayObjectElementUseCase.ts +++ b/src/js/core/application/Video/usecase/VideoCreateDisplayObjectElementUseCase.ts @@ -36,10 +36,10 @@ export const execute = async ( ): Promise => { const movieClip = work_space.scene; - const sec = Math.min( + const sec = Math.min(instance.duration, Math.min( character.endFrame, movieClip.currentFrame - 1 - ) / work_space.stage.fps; + ) / work_space.stage.fps); const cacheKey = character.cacheKey + "_" + sec; let canvas = $getCacheCanvas(work_space.id, instance.id, cacheKey); diff --git a/src/js/core/domain/model/Video.ts b/src/js/core/domain/model/Video.ts index f1d7ea9c..c97dd5a3 100644 --- a/src/js/core/domain/model/Video.ts +++ b/src/js/core/domain/model/Video.ts @@ -114,6 +114,18 @@ export class Video extends Instance } } + /** + * @description 映像の幅を返却 + * Returns the width of the image + * + * @member {number} + * @public + */ + get duration (): number + { + return this._$video ? this._$video.duration : 0; + } + /** * @description データを読み込み、再生可能になったら完了 * When data is loaded and ready for playback, it is done. diff --git a/src/js/tool/application/TextTool/usecase/TextToolDrawRectPointerUpEventUseCase.ts b/src/js/tool/application/TextTool/usecase/TextToolDrawRectPointerUpEventUseCase.ts index 8a092e94..e445602f 100644 --- a/src/js/tool/application/TextTool/usecase/TextToolDrawRectPointerUpEventUseCase.ts +++ b/src/js/tool/application/TextTool/usecase/TextToolDrawRectPointerUpEventUseCase.ts @@ -69,5 +69,5 @@ export const execute = async (event: PointerEvent): Promise => const x = left - $getScreenOffsetLeft(); const y = top - $getScreenOffsetTop(); - console.log(x, $getScrollLimitY); + console.log(x, y); }; \ No newline at end of file