Prep basic methods for dragging

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-05-02 16:26:41 +02:00
parent c97bbe11a9
commit f64a950195
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 23 additions and 0 deletions

View File

@ -184,6 +184,29 @@ export default class CallPreview extends React.Component<IProps, IState> {
});
}
private onStartMoving = (event: React.MouseEvent) => {
this.setState({moving: true});
this.initX = event.pageX - this.lastX;
this.initY = event.pageY - this.lastY;
}
private onMoving = (event: React.MouseEvent) => {
if (!this.state.moving) return;
this.lastX = event.pageX - this.initX;
this.lastY = event.pageY - this.initY;
this.setState({
translationX: this.lastX,
translationY: this.lastY,
});
}
private onEndMoving = () => {
this.setState({moving: false});
}
public render() {
if (this.state.primaryCall) {
return (