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

Add resizing

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-03-02 20:33:19 +01:00
parent a3f7e5f031
commit 5877b3e00d

View File

@@ -19,6 +19,7 @@ import React from 'react';
import CallHandler from '../../../CallHandler'; import CallHandler from '../../../CallHandler';
import CallView from './CallView'; import CallView from './CallView';
import dis from '../../../dispatcher/dispatcher'; import dis from '../../../dispatcher/dispatcher';
import {Resizable} from "re-resizable";
import ResizeNotifier from "../../../utils/ResizeNotifier"; import ResizeNotifier from "../../../utils/ResizeNotifier";
interface IProps { interface IProps {
@@ -80,11 +81,51 @@ export default class CallViewForRoom extends React.Component<IProps, IState> {
return call; return call;
} }
onResizeStart = () => {
this.props.resizeNotifier.startResizing();
}
onResize = () => {
this.props.resizeNotifier.notifyTimelineHeightChanged();
}
onResizeStop = () => {
this.props.resizeNotifier.stopResizing();
}
public render() { public render() {
if (!this.state.call) return null; if (!this.state.call) return null;
// We subtract 8 as it the margin-bottom of the mx_CallViewForRoom_ResizeWrapper
const maxHeight = this.props.maxVideoHeight - 8;
return <CallView call={this.state.call} pipMode={false} return (
onResize={this.props.onResize} maxVideoHeight={this.props.maxVideoHeight} <div className="mx_CallViewForRoom">
/>; <Resizable
minHeight={300}
maxHeight={maxHeight}
enable={{
top: false,
right: false,
bottom: true,
left: false,
topRight: false,
bottomRight: false,
bottomLeft: false,
topLeft: false,
}}
onResizeStart={this.onResizeStart}
onResize={this.onResize}
onResizeStop={this.onResizeStop}
className="mx_CallViewForRoom_ResizeWrapper"
handleClasses={{bottom: "mx_CallViewForRoom_ResizeHandle"}}
>
<CallView
call={this.state.call}
pipMode={false}
onResize={this.props.onResize}
/>
</Resizable>
</div>
);
} }
} }