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

Listen for mousemove on document scale

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-05-02 20:57:18 +02:00
parent 241e626e96
commit 53b8fd3072

View File

@@ -126,12 +126,14 @@ export default class CallPreview extends React.Component<IProps, IState> {
public componentDidMount() {
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
document.addEventListener("mousemove", this.onMoving);
this.dispatcherRef = dis.register(this.onAction);
MatrixClientPeg.get().on(CallEvent.RemoteHoldUnhold, this.onCallRemoteHold);
}
public componentWillUnmount() {
MatrixClientPeg.get().removeListener(CallEvent.RemoteHoldUnhold, this.onCallRemoteHold);
document.removeEventListener("mousemove", this.onMoving);
if (this.roomStoreToken) {
this.roomStoreToken.remove();
}
@@ -191,7 +193,7 @@ export default class CallPreview extends React.Component<IProps, IState> {
this.initY = event.pageY - this.lastY;
}
private onMoving = (event: React.MouseEvent) => {
private onMoving = (event: React.MouseEvent | MouseEvent) => {
if (!this.state.moving) return;
this.lastX = event.pageX - this.initX;