1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-10 09:22:25 +03:00

Prep basic methods for dragging

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-05-02 16:26:41 +02:00
parent c97bbe11a9
commit f64a950195

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 (