From 2f9ed7522d0615dfc27b7382be8b66eb341722da Mon Sep 17 00:00:00 2001 From: bobzel Date: Tue, 26 Jul 2022 11:16:39 -0400 Subject: made width a playground field so shared views can open annotation pane. made title shrink for annotation button only when title doesn't add a margin. Fixed closing annotation view in lightbox not to make docuent shrink to minimum size by using percents, not pixels. --- src/client/views/MainView.tsx | 1 + src/client/views/nodes/DocumentView.tsx | 2 +- src/client/views/nodes/formattedText/FormattedTextBox.tsx | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/client/views/MainView.tsx b/src/client/views/MainView.tsx index a85460137..4dc8a2e4a 100644 --- a/src/client/views/MainView.tsx +++ b/src/client/views/MainView.tsx @@ -171,6 +171,7 @@ export class MainView extends React.Component { 'curPage', 'viewType', 'chromeHidden', + 'width', 'nativeWidth', ]); // can play with these fields on someone else's } diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx index 7032abba2..2ad8b8af0 100644 --- a/src/client/views/nodes/DocumentView.tsx +++ b/src/client/views/nodes/DocumentView.tsx @@ -1229,7 +1229,7 @@ export class DocumentViewInternal extends DocComponent { - const prevWidth = this.sidebarWidth(); + const prevWidth = 1 - this.sidebarWidth() / Number(getComputedStyle(this._ref.current!).width.replace('px', '')); if (preview) this._showSidebar = true; else this.layoutDoc._showSidebar = (this.layoutDoc._sidebarWidthPercent = StrCast(this.layoutDoc._sidebarWidthPercent, '0%') === '0%' ? '50%' : '0%') !== '0%'; - this.layoutDoc._width = !preview && this.SidebarShown ? NumCast(this.layoutDoc._width) * 2 : Math.max(20, NumCast(this.layoutDoc._width) - prevWidth); + this.layoutDoc._width = !preview && this.SidebarShown ? NumCast(this.layoutDoc._width) * 2 : Math.max(20, NumCast(this.layoutDoc._width) * prevWidth); }; sidebarDown = (e: React.PointerEvent) => { const batch = UndoManager.StartBatch('sidebar'); -- cgit v1.2.3-70-g09d2