diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-08 02:51:21 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-08 02:51:21 -0400 |
commit | 1a8a370f67c3076d1b47c3bd8c3929d65badcfeb (patch) | |
tree | c5453718d6b8cd60d53a8eb74e13c33d5c524c23 /src/client/views/StyleProvider.tsx | |
parent | 921c3b95b22d5e4125435abb45cd322fc170ccb3 (diff) | |
parent | a61d794b7018f0ac9723ce2d3b93547ba11f444b (diff) |
Merge branch 'nathan-starter' of https://github.com/brown-dash/Dash-Web into nathan-starter
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r-- | src/client/views/StyleProvider.tsx | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index 3ecfc8ba3..e6e95e86c 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -83,6 +83,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & const isOpen = property.includes(':open'); const boxBackground = property.includes(':box'); const { + DocumentView: docView, fieldKey: fieldKeyProp, styleProvider, pointerEvents, @@ -91,18 +92,18 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & containerViewPath, childFilters, hideCaptions, - // eslint-disable-next-line camelcase - layout_showTitle, + showTitle, childFiltersByRanges, renderDepth, docViewPath, - DocumentView: docView, LayoutTemplateString, disableBrushing, NativeDimScaling, PanelWidth, PanelHeight, + isSelected, } = props || {}; // extract props that are not shared between fieldView and documentView props. + const componentView = docView?.()?.ComponentView; const fieldKey = fieldKeyProp ? fieldKeyProp + '_' : isCaption ? 'caption_' : ''; const isInk = () => layoutDoc?._layout_isSvg && !LayoutTemplateString; const lockedPosition = () => doc && BoolCast(doc._lockedPosition); @@ -149,7 +150,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & return undefined; case StyleProp.DocContents: return undefined; case StyleProp.WidgetColor: return isAnnotated ? Colors.LIGHT_BLUE : 'dimgrey'; - case StyleProp.Opacity: return docView?.().ComponentView?.isUnstyledView?.() ? 1 : Cast(doc?._opacity, "number", Cast(doc?.opacity, 'number', null)); + case StyleProp.Opacity: return componentView?.isUnstyledView?.() ? 1 : Cast(doc?._opacity, "number", Cast(doc?.opacity, 'number', null)); case StyleProp.FontColor: return StrCast(doc?.[fieldKey + 'fontColor'], StrCast(Doc.UserDoc().fontColor, color())); case StyleProp.FontSize: return StrCast(doc?.[fieldKey + 'fontSize'], StrCast(Doc.UserDoc().fontSize)); case StyleProp.FontFamily: return StrCast(doc?.[fieldKey + 'fontFamily'], StrCast(Doc.UserDoc().fontFamily)); @@ -160,13 +161,13 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & case StyleProp.ShowTitle: return ( (doc && - !docView?.().ComponentView?.isUnstyledView?.() && + !componentView?.isUnstyledView?.() && !LayoutTemplateString && !doc.presentation_targetDoc && - layout_showTitle?.() !== '' && + showTitle?.() !== '' && StrCast( doc._layout_showTitle, - layout_showTitle?.() || + showTitle?.() || (!Doc.IsSystem(doc) && [DocumentType.COL, DocumentType.FUNCPLOT, DocumentType.LABEL, DocumentType.RTF, DocumentType.IMG, DocumentType.VID].includes(doc.type as any) ? doc.author === ClientUtils.CurrentUserEmail() ? StrCast(Doc.UserDoc().layout_showTitle) @@ -291,7 +292,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & } } case StyleProp.PointerEvents: - if (docView?.().ComponentView?.dontRegisterView?.()) return 'all'; + if (componentView?.dontRegisterView?.()) return 'all'; if (StrCast(doc?.pointerEvents)) return StrCast(doc!.pointerEvents); // honor pointerEvents field (set by lock button usually) if it's not a keyValue view of the Doc if (SnappingManager.ExploreMode || doc?.layout_unrendered) return isInk() ? 'visiblePainted' : 'all'; if (pointerEvents?.() === 'none') return 'none'; @@ -307,7 +308,7 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & </div> ); const paint = () => !doc?.onPaint ? null : ( - <div className={`styleProvider-paint${docView?.().IsSelected ? "-selected":""}`} onClick={e => togglePaintView(e, doc, props)}> + <div className={`styleProvider-paint${isSelected?.() ? "-selected":""}`} onClick={e => togglePaintView(e, doc, props)}> <FontAwesomeIcon icon='pen' size="lg" /> </div> ); |