From 4f04ada8891f8035219934801244eaf07192e5be Mon Sep 17 00:00:00 2001 From: Antoine <antoine.roy@tetras-libre.fr> Date: Wed, 24 Jan 2024 15:09:41 +0100 Subject: [PATCH] add Getter et Setter des information sur la taille du canvas video --- src/components/AnnotationsOverlayVideo.js | 14 ++++++++++++++ src/plugins/VideosReferences.js | 14 +++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/components/AnnotationsOverlayVideo.js b/src/components/AnnotationsOverlayVideo.js index 49309ab44..7545824e9 100755 --- a/src/components/AnnotationsOverlayVideo.js +++ b/src/components/AnnotationsOverlayVideo.js @@ -93,6 +93,12 @@ export class AnnotationsOverlayVideo extends Component { this.state = { showProgress: false, + canvasSize : { + canvasHeight:0, + canvasWidth:0, + containerHeight:0, + containerWidth:0, + } }; } @@ -494,9 +500,17 @@ export class AnnotationsOverlayVideo extends Component { /** */ canvasUpdateCallback() { return () => { + const { windowId } = this.props this.canvasOverlay.clear(); this.canvasOverlay.resize(); this.canvasOverlay.canvasUpdate(this.renderAnnotations.bind(this)); + this.setState({canvasSize: { + canvasHeight:this.canvasOverlay.canvasHeight, + canvasWidth:this.canvasOverlay.canvasWidth, + containerHeight:this.canvasOverlay.containerHeight, + containerWidth:this.canvasOverlay.containerWidth, + }}) + VideosReferences.setCanvasSizeInformation(windowId,this); }; } diff --git a/src/plugins/VideosReferences.js b/src/plugins/VideosReferences.js index db859ee35..395577b63 100644 --- a/src/plugins/VideosReferences.js +++ b/src/plugins/VideosReferences.js @@ -1,11 +1,23 @@ export const VideosReferences = { + myAnnotationOverlayVideo:{}, + canvasIIIF: {}, + refs: {}, + canvasSizeInformation : {}, /** */ get(windowId) { return this.refs[windowId]; }, - refs: {}, + getCanvaSizeInformation(){ + return this.canvasSizeInformation + }, /** */ set(windowId, ref) { this.refs[windowId] = ref; + this.canvasIIIF = ref.props + this.myAnnotationOverlayVideo = ref; + }, + + setCanvasSizeInformation(windowId, ref){ + this.canvasSizeInformation = ref.state.canvasSize; }, }; -- GitLab