From 159687d41ab9265744fda2ca50e30f0f3434686c Mon Sep 17 00:00:00 2001 From: bobzel Date: Fri, 11 Dec 2020 21:39:24 -0500 Subject: fixe documentdecoration selection of menu items in left sidebar --- src/client/views/DocumentDecorations.tsx | 6 +++++- src/client/views/StyleProvider.tsx | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx index 5c7f5d9e4..f256aff40 100644 --- a/src/client/views/DocumentDecorations.tsx +++ b/src/client/views/DocumentDecorations.tsx @@ -602,7 +602,11 @@ export class DocumentDecorations extends React.Component<{ boundsLeft: number, b {`${this.selectionTitle}`} ; - const leftBounds = this.props.boundsLeft; + let inMainMenuPanel = false; + for (let node = seldoc.ContentDiv; node && !inMainMenuPanel; node = node?.parentNode as any) { + if (node.className === "mainView-mainContent") inMainMenuPanel = true; + } + const leftBounds = inMainMenuPanel ? 0 : this.props.boundsLeft; const topBounds = this.props.boundsTop; bounds.x = Math.max(leftBounds, bounds.x - this._resizeBorderWidth / 2) + this._resizeBorderWidth / 2; bounds.y = Math.max(topBounds, bounds.y - this._resizeBorderWidth / 2 - this._titleHeight) + this._resizeBorderWidth / 2 + this._titleHeight; diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index f51e94cfd..b01733f30 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -77,7 +77,7 @@ export function DefaultStyleProvider(doc: Opt, props: Opt = StrCast(doc?._backgroundColor, StrCast(doc?.backgroundColor)); + const docColor: Opt = StrCast(doc?._backgroundColor, StrCast(doc?.backgroundColor)); if (docColor) return docColor; if (MainView.Instance.LastButton === doc) return darkScheme() ? "dimgrey" : "lightgrey"; switch (doc?.type) { -- cgit v1.2.3-70-g09d2