Add preventDefault() and stopPropagation()

This avoids text being selected while dragging

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-05-02 21:17:59 +02:00
parent 53b8fd3072
commit fca5347668
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -187,6 +187,9 @@ export default class CallPreview extends React.Component<IProps, IState> {
} }
private onStartMoving = (event: React.MouseEvent) => { private onStartMoving = (event: React.MouseEvent) => {
event.preventDefault();
event.stopPropagation();
this.setState({moving: true}); this.setState({moving: true});
this.initX = event.pageX - this.lastX; this.initX = event.pageX - this.lastX;
@ -194,6 +197,9 @@ export default class CallPreview extends React.Component<IProps, IState> {
} }
private onMoving = (event: React.MouseEvent | MouseEvent) => { private onMoving = (event: React.MouseEvent | MouseEvent) => {
event.preventDefault();
event.stopPropagation();
if (!this.state.moving) return; if (!this.state.moving) return;
this.lastX = event.pageX - this.initX; this.lastX = event.pageX - this.initX;