diff options
author | bobzel <zzzman@gmail.com> | 2025-08-08 12:54:45 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2025-08-08 12:54:45 -0400 |
commit | b3aa4a5b0bbbb87d041b9515bddedbcbf8ae9fc5 (patch) | |
tree | 8622701837c9085d0e7f911e94b745e45b6025db /src/client/views/StyleProvider.tsx | |
parent | 8ec4e4fbd42be8ba6606d78da25c33f69d30ed63 (diff) |
fixed sizing of arrows and dashes to relate to stroke width. Made link's use fill to set color and default to backgorundColor
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r-- | src/client/views/StyleProvider.tsx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx index b52f17102..ca089a2fc 100644 --- a/src/client/views/StyleProvider.tsx +++ b/src/client/views/StyleProvider.tsx @@ -83,7 +83,6 @@ export function SetFilterOpener(func: () => void) { export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & DocumentViewProps>, property: string) { const remoteDocHeader = 'author;author_date;noMargin'; const isCaption = property.includes(':caption'); - const isAnchor = property.includes(':anchor'); const isNonTransparent = property.includes(':nonTransparent'); const isNonTransparentLevel = isNonTransparent ? Number(property.replace(/.*:nonTransparent([0-9]+).*/, '$1')) : 0; // property.includes(':nonTransparent'); const isAnnotated = property.includes(':annotated'); @@ -251,14 +250,16 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & const dataKey = doc ? Doc.LayoutDataKey(doc) : ''; const usePath = StrCast(doc?.[dataKey + '_usePath']); const alternate = usePath.includes(':hover') ? ( isHovering?.() ? '_' + usePath.replace(':hover','') : '') : usePath ? "_" +usePath:usePath; - let docColor:Opt<string> = layoutDoc && - StrCast(alternate ? layoutDoc['backgroundColor' + alternate]:undefined, + const colorKey = doc?.layout_isSvg ? "fillColor" : "backgroundColor"; + const docColorFn = (key: string) => layoutDoc && + StrCast(alternate ? layoutDoc[key + alternate]:undefined, DocCast(doc.rootDocument) - ? StrCast(layoutDoc.backgroundColor, StrCast(DocCast(doc.rootDocument)!.backgroundColor)) // for nested templates: use template's color, then root doc's color + ? StrCast(layoutDoc[key], StrCast(DocCast(doc.rootDocument)![key])) // for nested templates: use template's color, then root doc's color : layoutDoc === doc - ? StrCast(doc.backgroundColor) - : StrCast(StrCast(Doc.GetT(layoutDoc, 'backgroundColor', 'string', true), StrCast(doc.backgroundColor, StrCast(layoutDoc.backgroundColor)) // otherwise, use expanded template coloor, then root doc's color, then template's inherited color - ))); + ? StrCast(doc[key]) + : StrCast(StrCast(Doc.GetT(layoutDoc, key, 'string', true), StrCast(doc[key], StrCast(layoutDoc[key])) // otherwise, use expanded template coloor, then root doc's color, then template's inherited color + ))) + let docColor = docColorFn(colorKey); // prettier-ignore switch (layoutDoc?.type) { @@ -266,11 +267,11 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps & case DocumentType.PRES: docColor = docColor || 'transparent'; break; case DocumentType.FONTICON: docColor = boxBackground ? undefined : docColor || SnappingManager.userBackgroundColor; break; case DocumentType.RTF: docColor = docColor || StrCast(Doc.UserDoc().textBackgroundColor, Colors.LIGHT_GRAY); break; - case DocumentType.LINK: docColor = (isAnchor ? docColor : undefined); break; case DocumentType.INK: docColor = doc?.stroke_isInkMask ? 'rgba(0,0,0,0.7)' : undefined; break; case DocumentType.EQUATION: docColor = docColor || StrCast(Doc.UserDoc().textBackgroundColor, 'transparent'); break; case DocumentType.LABEL: docColor = docColor || Colors.LIGHT_GRAY; break; case DocumentType.BUTTON: docColor = docColor || Colors.LIGHT_GRAY; break; + case DocumentType.LINK: docColor = docColor || docColorFn('backgroundColor'); break; case DocumentType.IMG: case DocumentType.WEB: case DocumentType.PDF: |