aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/StyleProvider.tsx
diff options
context:
space:
mode:
authorNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-08-29 04:06:15 -0400
committerNathan-SR <144961007+Nathan-SR@users.noreply.github.com>2024-08-29 04:06:15 -0400
commit85c0b1105dbdd4037872ecfc6b921551e1939eb8 (patch)
tree136bd37439f678ae383a5c054983b360faee662f /src/client/views/StyleProvider.tsx
parentf320fd9c5b387339fe9893b0c2d91b4396fc4552 (diff)
Dataviz crash hopefully fixed; prototype func for generating templates; radius NaN bug handled
Diffstat (limited to 'src/client/views/StyleProvider.tsx')
-rw-r--r--src/client/views/StyleProvider.tsx5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/client/views/StyleProvider.tsx b/src/client/views/StyleProvider.tsx
index 3ecb101f8..bb0883cc0 100644
--- a/src/client/views/StyleProvider.tsx
+++ b/src/client/views/StyleProvider.tsx
@@ -56,11 +56,14 @@ export function styleFromLayoutString(doc: Doc, props: FieldViewProps, scale: nu
}
export function border(doc: Doc, pw: number, ph: number, rad: number = 0, inset: number = 0) {
+ if (!rad) rad = 0;
const width = pw * inset;
const height = ph * inset;
const radius = Math.min(rad, (pw - 2 * width) / 2, (ph - 2 * height) / 2);
+ console.log(pw, ph, rad, inset)
+
return `
M ${width + radius} ${height}
L ${pw - width - radius} ${height}
@@ -206,8 +209,10 @@ export function DefaultStyleProvider(doc: Opt<Doc>, props: Opt<FieldViewProps &
case StyleProp.BorderPath: {
const docWidth = Number(doc?._width);
const borderWidth = Number(StrCast(doc?.borderWidth));
+ //console.log(borderWidth);
const ratio = borderWidth / docWidth;
const borderRadius = Number(StrCast(layoutDoc?._layout_borderRounding).replace('px', ''));
+ console.log(StrCast(layoutDoc?._layout_borderRounding), borderRadius, typeof borderRadius)
const radiusRatio = borderRadius / docWidth;
const radius = radiusRatio * ((2 * borderWidth) + docWidth);