Fix negative value error when chnge placement

This commit is contained in:
Vitor Mateus De Almeida 2020-07-03 15:49:28 -03:00
parent f7c89458ca
commit c373c86c62

View File

@ -50,24 +50,17 @@ class WebcamDraggable extends PureComponent {
this.onFullscreenChange = this.onFullscreenChange.bind(this);
this.onResizeStop = this.onResizeStop.bind(this);
this.onResizeStart = this.onResizeStart.bind(this);
this.handleLayoutSizesSets = this.handleLayoutSizesSets.bind(this);
}
componentDidMount() {
document.addEventListener('fullscreenchange', this.onFullscreenChange);
}
componentDidUpdate(prevProps) {
const { layoutContextState } = this.props;
const { webcamsAreaSize } = layoutContextState;
// if ((webcamsAreaSize.width !== prevProps.layoutContextState.webcamsAreaSize.width
// || webcamsAreaSize.height !== prevProps.layoutContextState.webcamsAreaSize.height)) {
// this.setWebcamsAreaResizable(webcamsAreaSize.width, webcamsAreaSize.height);
// }
window.addEventListener('layoutSizesSets', this.handleLayoutSizesSets);
}
componentWillUnmount() {
window.removeEventListener('resize', this.debouncedOnResize);
document.removeEventListener('fullscreenchange', this.onFullscreenChange);
window.removeEventListener('layoutSizesSets', this.handleLayoutSizesSets);
}
onFullscreenChange() {
@ -201,6 +194,13 @@ class WebcamDraggable extends PureComponent {
return false;
}
handleLayoutSizesSets() {
const { layoutContextState } = this.props;
const { webcamsAreaSize } = layoutContextState;
this.setWebcamsAreaResizable(webcamsAreaSize.width, webcamsAreaSize.height);
}
calculatePosition() {
const { layoutContextState } = this.props;
const { mediaBounds } = layoutContextState;