Light mode preview with dark lines
Browse files
app.py
CHANGED
|
@@ -110,36 +110,36 @@ def gcode_to_svg(gcode: str) -> str:
|
|
| 110 |
if len(current_path) > 1:
|
| 111 |
paths.append(current_path)
|
| 112 |
|
| 113 |
-
# Build SVG
|
| 114 |
w = BOUNDS["right"] - BOUNDS["left"]
|
| 115 |
h = BOUNDS["top"] - BOUNDS["bottom"]
|
| 116 |
padding = 20
|
| 117 |
|
| 118 |
svg = f'''<svg xmlns="http://www.w3.org/2000/svg"
|
| 119 |
viewBox="{BOUNDS["left"] - padding} {-BOUNDS["top"] - padding} {w + 2*padding} {h + 2*padding}"
|
| 120 |
-
style="background: #
|
| 121 |
<!-- Work area border -->
|
| 122 |
<rect x="{BOUNDS["left"]}" y="{-BOUNDS["top"]}" width="{w}" height="{h}"
|
| 123 |
-
fill="
|
| 124 |
<!-- Center crosshair -->
|
| 125 |
-
<line x1="0" y1="{-BOUNDS["top"]}" x2="0" y2="{-BOUNDS["bottom"]}" stroke="#
|
| 126 |
-
<line x1="{BOUNDS["left"]}" y1="0" x2="{BOUNDS["right"]}" y2="0" stroke="#
|
| 127 |
<!-- Grid -->
|
| 128 |
<defs>
|
| 129 |
<pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse">
|
| 130 |
-
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="#
|
| 131 |
</pattern>
|
| 132 |
</defs>
|
| 133 |
<rect x="{BOUNDS["left"]}" y="{-BOUNDS["top"]}" width="{w}" height="{h}" fill="url(#grid)"/>
|
| 134 |
'''
|
| 135 |
|
| 136 |
-
# Draw paths
|
| 137 |
for path in paths:
|
| 138 |
if len(path) < 2:
|
| 139 |
continue
|
| 140 |
# SVG Y is inverted
|
| 141 |
d = " ".join(f"{'M' if i == 0 else 'L'}{p[0]:.1f},{-p[1]:.1f}" for i, p in enumerate(path))
|
| 142 |
-
svg += f'<path d="{d}" fill="none" stroke="#
|
| 143 |
|
| 144 |
# Stats
|
| 145 |
total_points = sum(len(p) for p in paths)
|
|
|
|
| 110 |
if len(current_path) > 1:
|
| 111 |
paths.append(current_path)
|
| 112 |
|
| 113 |
+
# Build SVG - light mode with dark lines
|
| 114 |
w = BOUNDS["right"] - BOUNDS["left"]
|
| 115 |
h = BOUNDS["top"] - BOUNDS["bottom"]
|
| 116 |
padding = 20
|
| 117 |
|
| 118 |
svg = f'''<svg xmlns="http://www.w3.org/2000/svg"
|
| 119 |
viewBox="{BOUNDS["left"] - padding} {-BOUNDS["top"] - padding} {w + 2*padding} {h + 2*padding}"
|
| 120 |
+
style="background: #fafafa; width: 100%; height: 500px; border-radius: 8px; border: 1px solid #e5e5e5;">
|
| 121 |
<!-- Work area border -->
|
| 122 |
<rect x="{BOUNDS["left"]}" y="{-BOUNDS["top"]}" width="{w}" height="{h}"
|
| 123 |
+
fill="#fff" stroke="#ccc" stroke-width="2"/>
|
| 124 |
<!-- Center crosshair -->
|
| 125 |
+
<line x1="0" y1="{-BOUNDS["top"]}" x2="0" y2="{-BOUNDS["bottom"]}" stroke="#ddd" stroke-width="1"/>
|
| 126 |
+
<line x1="{BOUNDS["left"]}" y1="0" x2="{BOUNDS["right"]}" y2="0" stroke="#ddd" stroke-width="1"/>
|
| 127 |
<!-- Grid -->
|
| 128 |
<defs>
|
| 129 |
<pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse">
|
| 130 |
+
<path d="M 100 0 L 0 0 0 100" fill="none" stroke="#eee" stroke-width="0.5"/>
|
| 131 |
</pattern>
|
| 132 |
</defs>
|
| 133 |
<rect x="{BOUNDS["left"]}" y="{-BOUNDS["top"]}" width="{w}" height="{h}" fill="url(#grid)"/>
|
| 134 |
'''
|
| 135 |
|
| 136 |
+
# Draw paths - dark lines
|
| 137 |
for path in paths:
|
| 138 |
if len(path) < 2:
|
| 139 |
continue
|
| 140 |
# SVG Y is inverted
|
| 141 |
d = " ".join(f"{'M' if i == 0 else 'L'}{p[0]:.1f},{-p[1]:.1f}" for i, p in enumerate(path))
|
| 142 |
+
svg += f'<path d="{d}" fill="none" stroke="#1a1a1a" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>'
|
| 143 |
|
| 144 |
# Stats
|
| 145 |
total_points = sum(len(p) for p in paths)
|