From 6178b3c0e200fb66613135e71481cda2b15f6c89 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 2 Sep 2020 11:13:00 +0100 Subject: [PATCH] Wire up resizeNotifier --- src/components/structures/RoomView.js | 22 +++++++++++++--------- src/components/structures/ScrollPanel.js | 2 +- src/components/views/rooms/AppsDrawer.js | 20 ++++++++++++++++++-- src/components/views/rooms/AuxPanel.js | 1 + 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/components/structures/RoomView.js b/src/components/structures/RoomView.js index 7605bdbfc0..33df9b4961 100644 --- a/src/components/structures/RoomView.js +++ b/src/components/structures/RoomView.js @@ -1886,15 +1886,19 @@ export default createReactClass({ } const auxPanel = ( - + { aux } ); diff --git a/src/components/structures/ScrollPanel.js b/src/components/structures/ScrollPanel.js index 51113f4f56..5c3067c6eb 100644 --- a/src/components/structures/ScrollPanel.js +++ b/src/components/structures/ScrollPanel.js @@ -210,6 +210,7 @@ export default createReactClass({ }, onResize: function() { + debuglog("onResize"); this.checkScroll(); // update preventShrinkingState if present if (this.preventShrinkingState) { @@ -239,7 +240,6 @@ export default createReactClass({ // when scrolled all the way down. E.g. Chrome 72 on debian. // so check difference <= 1; return Math.abs(sn.scrollHeight - (sn.scrollTop + sn.clientHeight)) <= 1; - }, // returns the vertical height in the given direction that can be removed from diff --git a/src/components/views/rooms/AppsDrawer.js b/src/components/views/rooms/AppsDrawer.js index 1446cd505c..7124d908de 100644 --- a/src/components/views/rooms/AppsDrawer.js +++ b/src/components/views/rooms/AppsDrawer.js @@ -33,6 +33,7 @@ import SettingsStore from "../../../settings/SettingsStore"; import classNames from 'classnames'; import {Resizable} from "re-resizable"; import {useLocalStorageState} from "../../../hooks/useLocalStorageState"; +import ResizeNotifier from "../../../utils/ResizeNotifier"; // The maximum number of widgets that can be added in a room const MAX_WIDGETS = 2; @@ -43,6 +44,7 @@ export default createReactClass({ propTypes: { userId: PropTypes.string.isRequired, room: PropTypes.object.isRequired, + resizeNotifier: PropTypes.instanceOf(ResizeNotifier).isRequired, showApps: PropTypes.bool, // Should apps be rendered hide: PropTypes.bool, // If rendered, should apps drawer be visible }, @@ -217,9 +219,10 @@ export default createReactClass({ { apps } { 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 [resizing, setResizing] = useState(false); @@ -241,9 +253,13 @@ const PersistentVResizer = ({id, minHeight, maxHeight, className, handleWrapperC onResizeStart={() => { if (!resizing) setResizing(true); }} + onResize={() => { + resizeNotifier.notifyTimelineHeightChanged(); + }} onResizeStop={(e, dir, ref, d) => { setHeight(height + d.height); if (resizing) setResizing(false); + resizeNotifier.notifyTimelineHeightChanged(); }} handleWrapperClass={handleWrapperClass} handleClasses={{bottom: handleClass}} diff --git a/src/components/views/rooms/AuxPanel.js b/src/components/views/rooms/AuxPanel.js index 521aeec406..b51e3fefa8 100644 --- a/src/components/views/rooms/AuxPanel.js +++ b/src/components/views/rooms/AuxPanel.js @@ -203,6 +203,7 @@ export default createReactClass({ maxHeight={this.props.maxHeight} showApps={this.props.showApps} hide={this.props.hideAppsDrawer} + resizeNotifier={this.props.resizeNotifier} />; let stateViews = null;