Prep state and props for dragging

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-05-02 16:26:03 +02:00
parent 8948c7419c
commit c97bbe11a9
No known key found for this signature in database
GPG key ID: 9760693FDD98A790

View file

@ -50,6 +50,13 @@ interface IState {
// Any other call we're displaying: only if the user is on two calls and not viewing either of the rooms
// they belong to
secondaryCall: MatrixCall;
// Position of the CallPreview
translationX: number;
translationY: number;
// True if the CallPreview is being dragged
moving: boolean;
}
// Splits a list of calls into one 'primary' one and a list
@ -106,9 +113,17 @@ export default class CallPreview extends React.Component<IProps, IState> {
roomId,
primaryCall: primaryCall,
secondaryCall: secondaryCalls[0],
translationX: 0,
translationY: 0,
moving: false,
};
}
private initX = 0;
private initY = 0;
private lastX = 0;
private lastY = 0;
public componentDidMount() {
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
this.dispatcherRef = dis.register(this.onAction);