Skip to content

Commit 8919665

Browse files
authored
Merge pull request #41 from brsbl/feature/ui-improvements
Revert SVG knob changes
2 parents 4aab609 + 9088121 commit 8919665

1 file changed

Lines changed: 10 additions & 31 deletions

File tree

src/components/ui/Knob.jsx

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,10 @@ const Knob = memo(function Knob({
1717
const range = max - min
1818
const normalized = (value - min) / range
1919

20-
// Render at 2x for crisp display on retina screens
21-
const scale = 2
22-
const viewSize = size * scale
23-
const strokeWidth = 18
24-
2520
// Arc path calculation for the value indicator
26-
// Outer stroke: radius is inner edge, so add half stroke width
27-
const innerRadius = (viewSize - 32) / 2
28-
const radius = innerRadius + strokeWidth / 2
29-
const centerX = viewSize / 2
30-
const centerY = viewSize / 2
21+
const radius = (size - 8) / 2
22+
const centerX = size / 2
23+
const centerY = size / 2
3124

3225
// Calculate arc angles to match background track rotation (135 degrees)
3326
// Background track starts at 135° (bottom-left) and spans 270° to 45° (bottom-right)
@@ -108,31 +101,18 @@ const Knob = memo(function Knob({
108101
aria-label={label}
109102
tabIndex={0}
110103
>
111-
<svg
112-
width={size}
113-
height={size}
114-
viewBox={`0 0 ${viewSize} ${viewSize}`}
115-
style={{ shapeRendering: 'geometricPrecision' }}
116-
>
117-
{/* Clip path for outer stroke effect */}
118-
<defs>
119-
<clipPath id={`knob-clip-${size}`}>
120-
<circle cx={centerX} cy={centerY} r={innerRadius + strokeWidth} />
121-
</clipPath>
122-
</defs>
123-
104+
<svg width={size} height={size} viewBox={`0 0 ${size} ${size}`}>
124105
{/* Background track */}
125106
<circle
126107
cx={centerX}
127108
cy={centerY}
128109
r={radius}
129110
fill="none"
130111
stroke="#3a3a3a"
131-
strokeWidth={strokeWidth}
112+
strokeWidth="4"
132113
strokeLinecap="round"
133114
strokeDasharray={`${radius * Math.PI * 1.5} ${radius * Math.PI * 2}`}
134115
transform={`rotate(135 ${centerX} ${centerY})`}
135-
clipPath={`url(#knob-clip-${size})`}
136116
/>
137117

138118
{/* Value arc */}
@@ -141,28 +121,27 @@ const Knob = memo(function Knob({
141121
d={`M ${startX} ${startY} A ${radius} ${radius} 0 ${largeArc} 1 ${endX} ${endY}`}
142122
fill="none"
143123
stroke="#f5a623"
144-
strokeWidth={strokeWidth}
124+
strokeWidth="4"
145125
strokeLinecap="round"
146-
clipPath={`url(#knob-clip-${size})`}
147126
/>
148127
)}
149128

150129
{/* Center dot / indicator */}
151130
<circle
152131
cx={centerX}
153132
cy={centerY}
154-
r={innerRadius - 6}
133+
r={radius - 8}
155134
fill="#2a2a2a"
156135
/>
157136

158137
{/* Indicator line */}
159138
<line
160139
x1={centerX}
161140
y1={centerY}
162-
x2={centerX + (innerRadius - 16) * Math.cos(endAngle)}
163-
y2={centerY + (innerRadius - 16) * Math.sin(endAngle)}
141+
x2={centerX + (radius - 12) * Math.cos(endAngle)}
142+
y2={centerY + (radius - 12) * Math.sin(endAngle)}
164143
stroke="#f5a623"
165-
strokeWidth="6"
144+
strokeWidth="2"
166145
strokeLinecap="round"
167146
/>
168147
</svg>

0 commit comments

Comments
 (0)