Files
units-ui/components
Sebastian Krüger 08026893d3 fix: keep source unit stable during drag - bars now update correctly
Critical fix: stopped switching selectedUnit during drag.

Problem:
- We were switching selectedUnit to the dragged unit
- This changed the conversion base
- All units maintained proportional relationships in log scale
- Bars didn't visually change size because ratios stayed the same
- On drag end, bars would snap back

Root cause: Switching source unit doesn't change bar proportions!
Example:
- Start: 1 meter → 3.28 feet (feet bar at 50% in log scale)
- Drag feet bar: switch to feet as source
- Now: 3.28 feet → 1 meter (meter bar at 50% in log scale)
- Proportions are IDENTICAL! No visual change!

Solution: Keep selectedUnit stable, only change inputValue
- Convert dragged value back to currently selected unit
- Update inputValue with converted amount
- selectedUnit stays unchanged
- All conversions scale proportionally from same base
- Bars resize because absolute values change!

How it works now:
- Dragging "feet" bar with "meters" selected
- Calculate new feet value from drag position
- Convert feet → meters: convertUnit(feetValue, 'ft', 'm')
- Update inputValue with meter equivalent
- All bars recalculate from meters (same base)
- Bars resize correctly because meter input changed!

Result: Bars now properly resize during drag AND stay at position on release!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-08 10:59:57 +01:00
..