Simplify logic for startResizing width calculation (#269)

* Apply Red's suggestion and move width logic to getWidth

* remove unnecessary

* a little more

* remove comment
This commit is contained in:
Evan Simkowitz 2024-01-30 22:34:00 -08:00 committed by GitHub
parent 81a9e74991
commit 5ce7b92232
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1301,7 +1301,7 @@ class ResizableSidebar extends React.Component<ResizableSidebarProps> {
const mainSidebarModel = GlobalModel.mainSidebarModel; const mainSidebarModel = GlobalModel.mainSidebarModel;
const collapsed = mainSidebarModel.getCollapsed(); const collapsed = mainSidebarModel.getCollapsed();
this.resizeStartWidth = collapsed ? MagicLayout.MainSidebarMinWidth : mainSidebarModel.getWidth(); this.resizeStartWidth = mainSidebarModel.getWidth();
document.addEventListener("mousemove", this.onMouseMove); document.addEventListener("mousemove", this.onMouseMove);
document.addEventListener("mouseup", this.stopResizing); document.addEventListener("mouseup", this.stopResizing);