Use UIStore

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
pull/21833/head
Šimon Brandner 2021-06-17 15:52:55 +02:00
parent d89392a1d9
commit ab3ccecc96
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
1 changed files with 6 additions and 5 deletions

View File

@ -27,6 +27,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import { CallEvent, CallState, MatrixCall } from 'matrix-js-sdk/src/webrtc/call'; import { CallEvent, CallState, MatrixCall } from 'matrix-js-sdk/src/webrtc/call';
import { MatrixClientPeg } from '../../../MatrixClientPeg'; import { MatrixClientPeg } from '../../../MatrixClientPeg';
import {replaceableComponent} from "../../../utils/replaceableComponent"; import {replaceableComponent} from "../../../utils/replaceableComponent";
import UIStore from '../../../stores/UIStore';
const PIP_VIEW_WIDTH = 336; const PIP_VIEW_WIDTH = 336;
const PIP_VIEW_HEIGHT = 232; const PIP_VIEW_HEIGHT = 232;
@ -118,7 +119,7 @@ export default class CallPreview extends React.Component<IProps, IState> {
roomId, roomId,
primaryCall: primaryCall, primaryCall: primaryCall,
secondaryCall: secondaryCalls[0], secondaryCall: secondaryCalls[0],
translationX: window.innerWidth - DEFAULT_X_OFFSET - PIP_VIEW_WIDTH, translationX: UIStore.instance.windowWidth - DEFAULT_X_OFFSET - PIP_VIEW_WIDTH,
translationY: DEFAULT_Y_OFFSET, translationY: DEFAULT_Y_OFFSET,
moving: false, moving: false,
}; };
@ -164,8 +165,8 @@ export default class CallPreview extends React.Component<IProps, IState> {
let outTranslationY; let outTranslationY;
// Avoid overflow on the x axis // Avoid overflow on the x axis
if (inTranslationX + width >= window.innerWidth) { if (inTranslationX + width >= UIStore.instance.windowWidth) {
outTranslationX = window.innerWidth - width; outTranslationX = UIStore.instance.windowWidth - width;
} else if (inTranslationX <= 0) { } else if (inTranslationX <= 0) {
outTranslationX = 0; outTranslationX = 0;
} else { } else {
@ -173,8 +174,8 @@ export default class CallPreview extends React.Component<IProps, IState> {
} }
// Avoid overflow on the y axis // Avoid overflow on the y axis
if (inTranslationY + height >= window.innerHeight) { if (inTranslationY + height >= UIStore.instance.windowHeight) {
outTranslationY = window.innerHeight - height; outTranslationY = UIStore.instance.windowHeight - height;
} else if (inTranslationY <= 0) { } else if (inTranslationY <= 0) {
outTranslationY = 0; outTranslationY = 0;
} else { } else {