Move moving out of state
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>pull/21833/head
parent
6fb3bdbcd0
commit
946317ddf8
|
@ -60,9 +60,6 @@ interface IState {
|
||||||
// Position of the CallPreview
|
// Position of the CallPreview
|
||||||
translationX: number;
|
translationX: number;
|
||||||
translationY: number;
|
translationY: number;
|
||||||
|
|
||||||
// True if the CallPreview is being dragged
|
|
||||||
moving: boolean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Splits a list of calls into one 'primary' one and a list
|
// Splits a list of calls into one 'primary' one and a list
|
||||||
|
@ -121,7 +118,6 @@ export default class CallPreview extends React.Component<IProps, IState> {
|
||||||
secondaryCall: secondaryCalls[0],
|
secondaryCall: secondaryCalls[0],
|
||||||
translationX: UIStore.instance.windowWidth - DEFAULT_X_OFFSET - PIP_VIEW_WIDTH,
|
translationX: UIStore.instance.windowWidth - DEFAULT_X_OFFSET - PIP_VIEW_WIDTH,
|
||||||
translationY: DEFAULT_Y_OFFSET,
|
translationY: DEFAULT_Y_OFFSET,
|
||||||
moving: false,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,6 +125,7 @@ export default class CallPreview extends React.Component<IProps, IState> {
|
||||||
|
|
||||||
private initX = 0;
|
private initX = 0;
|
||||||
private initY = 0;
|
private initY = 0;
|
||||||
|
private moving = false;
|
||||||
|
|
||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
CallHandler.sharedInstance().addListener(CallHandlerEvent.CallChangeRoom, this.updateCalls);
|
CallHandler.sharedInstance().addListener(CallHandlerEvent.CallChangeRoom, this.updateCalls);
|
||||||
|
@ -240,14 +237,14 @@ export default class CallPreview extends React.Component<IProps, IState> {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
this.setState({moving: true});
|
this.moving = true;
|
||||||
|
|
||||||
this.initX = event.pageX - this.state.translationX;
|
this.initX = event.pageX - this.state.translationX;
|
||||||
this.initY = event.pageY - this.state.translationY;
|
this.initY = event.pageY - this.state.translationY;
|
||||||
};
|
};
|
||||||
|
|
||||||
private onMoving = (event: React.MouseEvent | MouseEvent) => {
|
private onMoving = (event: React.MouseEvent | MouseEvent) => {
|
||||||
if (!this.state.moving) return;
|
if (!this.moving) return;
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -256,7 +253,7 @@ export default class CallPreview extends React.Component<IProps, IState> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private onEndMoving = () => {
|
private onEndMoving = () => {
|
||||||
this.setState({moving: false});
|
this.moving = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
|
|
Loading…
Reference in New Issue