Improve LHS resize performance

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-10-13 10:30:52 +01:00
parent 340e79179e
commit afacf8c6b7
1 changed files with 5 additions and 6 deletions

View File

@ -218,6 +218,7 @@ class LoggedInView extends React.Component<IProps, IState> {
vertical: "mx_ResizeHandle_vertical", vertical: "mx_ResizeHandle_vertical",
reverse: "mx_ResizeHandle_reverse", reverse: "mx_ResizeHandle_reverse",
}; };
let size;
const collapseConfig = { const collapseConfig = {
toggleSize: 260 - 50, toggleSize: 260 - 50,
onCollapsed: (collapsed) => { onCollapsed: (collapsed) => {
@ -228,21 +229,19 @@ class LoggedInView extends React.Component<IProps, IState> {
dis.dispatch({action: "show_left_panel"}, true); dis.dispatch({action: "show_left_panel"}, true);
} }
}, },
onResized: (size) => { onResized: (_size) => {
window.localStorage.setItem("mx_lhs_size", '' + size); size = _size;
this.props.resizeNotifier.notifyLeftHandleResized(); this.props.resizeNotifier.notifyLeftHandleResized();
}, },
onResizeStart: () => { onResizeStart: () => {
this.props.resizeNotifier.startResizing(); this.props.resizeNotifier.startResizing();
}, },
onResizeStop: () => { onResizeStop: () => {
window.localStorage.setItem("mx_lhs_size", '' + size);
this.props.resizeNotifier.stopResizing(); this.props.resizeNotifier.stopResizing();
}, },
}; };
const resizer = new Resizer( const resizer = new Resizer(this._resizeContainer.current, CollapseDistributor, collapseConfig);
this._resizeContainer.current,
CollapseDistributor,
collapseConfig);
resizer.setClassNames(classNames); resizer.setClassNames(classNames);
return resizer; return resizer;
} }