Wire up resizeNotifier

pull/21833/head
Michael Telatynski 2020-09-02 11:13:00 +01:00
parent 243af3c9f2
commit 6178b3c0e2
4 changed files with 33 additions and 12 deletions

View File

@ -1886,15 +1886,19 @@ export default createReactClass({
} }
const auxPanel = ( const auxPanel = (
<AuxPanel room={this.state.room} <AuxPanel
fullHeight={false} room={this.state.room}
userId={this.context.credentials.userId} fullHeight={false}
conferenceHandler={this.props.ConferenceHandler} userId={this.context.credentials.userId}
draggingFile={this.state.draggingFile} conferenceHandler={this.props.ConferenceHandler}
displayConfCallNotification={this.state.displayConfCallNotification} draggingFile={this.state.draggingFile}
maxHeight={this.state.auxPanelMaxHeight} displayConfCallNotification={this.state.displayConfCallNotification}
showApps={this.state.showApps} maxHeight={this.state.auxPanelMaxHeight}
hideAppsDrawer={false} > showApps={this.state.showApps}
hideAppsDrawer={false}
onResize={this.onResize}
resizeNotifier={this.props.resizeNotifier}
>
{ aux } { aux }
</AuxPanel> </AuxPanel>
); );

View File

@ -210,6 +210,7 @@ export default createReactClass({
}, },
onResize: function() { onResize: function() {
debuglog("onResize");
this.checkScroll(); this.checkScroll();
// update preventShrinkingState if present // update preventShrinkingState if present
if (this.preventShrinkingState) { if (this.preventShrinkingState) {
@ -239,7 +240,6 @@ export default createReactClass({
// when scrolled all the way down. E.g. Chrome 72 on debian. // when scrolled all the way down. E.g. Chrome 72 on debian.
// so check difference <= 1; // so check difference <= 1;
return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1; return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1;
}, },
// returns the vertical height in the given direction that can be removed from // returns the vertical height in the given direction that can be removed from

View File

@ -33,6 +33,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import classNames from 'classnames'; import classNames from 'classnames';
import {Resizable} from "re-resizable"; import {Resizable} from "re-resizable";
import {useLocalStorageState} from "../../../hooks/useLocalStorageState"; import {useLocalStorageState} from "../../../hooks/useLocalStorageState";
import ResizeNotifier from "../../../utils/ResizeNotifier";
// The maximum number of widgets that can be added in a room // The maximum number of widgets that can be added in a room
const MAX_WIDGETS = 2; const MAX_WIDGETS = 2;
@ -43,6 +44,7 @@ export default createReactClass({
propTypes: { propTypes: {
userId: PropTypes.string.isRequired, userId: PropTypes.string.isRequired,
room: PropTypes.object.isRequired, room: PropTypes.object.isRequired,
resizeNotifier: PropTypes.instanceOf(ResizeNotifier).isRequired,
showApps: PropTypes.bool, // Should apps be rendered showApps: PropTypes.bool, // Should apps be rendered
hide: PropTypes.bool, // If rendered, should apps drawer be visible hide: PropTypes.bool, // If rendered, should apps drawer be visible
}, },
@ -217,9 +219,10 @@ export default createReactClass({
<PersistentVResizer <PersistentVResizer
id={"apps-drawer_" + this.props.room.roomId} id={"apps-drawer_" + this.props.room.roomId}
minHeight={100} minHeight={100}
maxHeight={this.props.maxHeight - 50} maxHeight={this.props.maxHeight ? this.props.maxHeight - 50 : undefined}
handleClass="mx_AppsContainer_resizerHandle" handleClass="mx_AppsContainer_resizerHandle"
className="mx_AppsContainer" className="mx_AppsContainer"
resizeNotifier={this.props.resizeNotifier}
> >
{ apps } { apps }
{ spinner } { spinner }
@ -230,7 +233,16 @@ export default createReactClass({
}, },
}); });
const PersistentVResizer = ({id, minHeight, maxHeight, className, handleWrapperClass, handleClass, children}) => { const PersistentVResizer = ({
id,
minHeight,
maxHeight,
className,
handleWrapperClass,
handleClass,
resizeNotifier,
children,
}) => {
const [height, setHeight] = useLocalStorageState("pvr_" + id, 100); const [height, setHeight] = useLocalStorageState("pvr_" + id, 100);
const [resizing, setResizing] = useState(false); const [resizing, setResizing] = useState(false);
@ -241,9 +253,13 @@ const PersistentVResizer = ({id, minHeight, maxHeight, className, handleWrapperC
onResizeStart={() => { onResizeStart={() => {
if (!resizing) setResizing(true); if (!resizing) setResizing(true);
}} }}
onResize={() => {
resizeNotifier.notifyTimelineHeightChanged();
}}
onResizeStop={(e, dir, ref, d) => { onResizeStop={(e, dir, ref, d) => {
setHeight(height + d.height); setHeight(height + d.height);
if (resizing) setResizing(false); if (resizing) setResizing(false);
resizeNotifier.notifyTimelineHeightChanged();
}} }}
handleWrapperClass={handleWrapperClass} handleWrapperClass={handleWrapperClass}
handleClasses={{bottom: handleClass}} handleClasses={{bottom: handleClass}}

View File

@ -203,6 +203,7 @@ export default createReactClass({
maxHeight={this.props.maxHeight} maxHeight={this.props.maxHeight}
showApps={this.props.showApps} showApps={this.props.showApps}
hide={this.props.hideAppsDrawer} hide={this.props.hideAppsDrawer}
resizeNotifier={this.props.resizeNotifier}
/>; />;
let stateViews = null; let stateViews = null;