exodeui-react-native 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/engine.ts +31 -27
package/package.json
CHANGED
package/src/engine.ts
CHANGED
|
@@ -2105,11 +2105,11 @@ export class ExodeUIEngine {
|
|
|
2105
2105
|
const svgContent = geometry.svgContent;
|
|
2106
2106
|
if (!svgContent) return;
|
|
2107
2107
|
|
|
2108
|
-
// Extract path data from potentially multiple <path d="..."> tags
|
|
2109
|
-
const pathMatches = svgContent.matchAll(/d="([^"]+)"/g);
|
|
2108
|
+
// Extract path data from potentially multiple <path d="..."> or d='...' tags
|
|
2109
|
+
const pathMatches = svgContent.matchAll(/d=["']([^"']+)["']/g);
|
|
2110
2110
|
const paths: string[] = [];
|
|
2111
2111
|
for (const match of pathMatches) {
|
|
2112
|
-
paths.push(match[1]
|
|
2112
|
+
if (match[1]) paths.push(match[1]);
|
|
2113
2113
|
}
|
|
2114
2114
|
|
|
2115
2115
|
if (paths.length === 0) return;
|
|
@@ -2118,30 +2118,34 @@ export class ExodeUIEngine {
|
|
|
2118
2118
|
const style = state?.style || obj.style || {};
|
|
2119
2119
|
|
|
2120
2120
|
paths.forEach(d => {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2121
|
+
try {
|
|
2122
|
+
const path = Skia.Path.MakeFromSVGString(d);
|
|
2123
|
+
if (!path) return;
|
|
2124
|
+
|
|
2125
|
+
// Draw fill
|
|
2126
|
+
if (style.fill && style.fill.type !== 'None') {
|
|
2127
|
+
const paint = Skia.Paint();
|
|
2128
|
+
const fillCol = style.fill.color || '#ffffff';
|
|
2129
|
+
const fillColStr = typeof fillCol === 'string' ? fillCol.replace(/\s+/g, '') : '#ffffff';
|
|
2130
|
+
try { paint.setColor(Skia.Color(fillColStr)); } catch { paint.setColor(Skia.Color('#ffffff')); }
|
|
2131
|
+
paint.setAlphaf((state?.opacity ?? 1) * (style.fill.opacity ?? 1));
|
|
2132
|
+
paint.setStyle(PaintStyle.Fill);
|
|
2133
|
+
canvas.drawPath(path, paint);
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
// Draw stroke if enabled
|
|
2137
|
+
if (style.stroke && style.stroke.width > 0 && style.stroke.isEnabled !== false) {
|
|
2138
|
+
const paint = Skia.Paint();
|
|
2139
|
+
const strokeCol = style.stroke.color || '#000000';
|
|
2140
|
+
const strokeColStr = typeof strokeCol === 'string' ? strokeCol.replace(/\s+/g, '') : '#000000';
|
|
2141
|
+
try { paint.setColor(Skia.Color(strokeColStr)); } catch { paint.setColor(Skia.Color('#000000')); }
|
|
2142
|
+
paint.setStrokeWidth(style.stroke.width);
|
|
2143
|
+
paint.setAlphaf((state?.opacity ?? 1) * (style.stroke.opacity ?? 1));
|
|
2144
|
+
paint.setStyle(PaintStyle.Stroke);
|
|
2145
|
+
canvas.drawPath(path, paint);
|
|
2146
|
+
}
|
|
2147
|
+
} catch (e) {
|
|
2148
|
+
console.warn(`[ExodeUIEngine] Failed to parse SVG path for ${obj.id}:`, e);
|
|
2145
2149
|
}
|
|
2146
2150
|
});
|
|
2147
2151
|
}
|