Prep basic methods for dragging
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
parent
c97bbe11a9
commit
f64a950195
1 changed files with 23 additions and 0 deletions
|
@ -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() {
|
public render() {
|
||||||
if (this.state.primaryCall) {
|
if (this.state.primaryCall) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue