Phase 4: Sketch-style curve editing with chart zoom, pan, tooltip toggle, and UI polish#92
Phase 4: Sketch-style curve editing with chart zoom, pan, tooltip toggle, and UI polish#92Copilot wants to merge 11 commits into
Conversation
… view integration, and tests Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
…n plan Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
|
@copilot How does the user turn on sketch edit mode for a series? |
Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
The user toggles sketch-edit mode via a ✏ toggle button added to each series column header in the CurveDataPanel (next to the visibility checkbox, lock, and delete buttons). Clicking it activates sketch-edit for that series; clicking it again (or clicking a different series' toggle) deactivates/switches. Only one series can be in sketch-edit mode at a time. When active, a "✏ Sketching: [SeriesName]" indicator appears in the top-left of the chart. The user can then click or click-and-drag on the chart area to draw torque values onto the curve. Added in commit |
|
@copilot Holy moly this works well!
|
…ard +/-) Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
Implemented both features in commit Tooltip toggle:
Sketch-mode zoom:
14 new unit tests cover tooltip auto-toggle, zoom state management, axis narrowing, and reset behavior. |
|
@copilot Two thing:
|
- Wire mouse wheel via tunneling AddHandler to intercept before LiveCharts - Wire keyboard +/- to TorqueChart control directly for reliable focus - Auto-focus chart on pointer enter during sketch mode - Scale and reposition underlay image during zoom so it stays aligned with chart lines (uses base vs current axis ratio for transform) - Capture base axis limits when sketch mode activates - Expose base axis limit properties for view coordinate calculations Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
Fixed both issues in commit Zoom reliability fix:
Underlay image zoom fix:
|
…ing, rearrange header icons - Add TorqueSnapIncrement to PreferencesViewModel and PreferencesWindow UI - Block sketch-edit activation on locked curves (ViewModel + UI handler) - Disable sketch-edit toggle button when curve is locked - Split series header icons into two rows (visibility+lock / sketch+delete) - Add 2 unit tests for locked-curve sketch-edit guard Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
|
@copilot That looks great, thank you. Upon further testing the zoom feature is really useful, and I think we can use it more.
|
…t, middle-double-click reset - Remove IsSketchEditActive guard from ApplyZoom — zoom works anytime - Ctrl+mouse wheel / Ctrl+touchpad scroll to zoom (relative to cursor) - + key (Shift+= or numpad +) to zoom in, - key to zoom out - = key resets zoom to unzoomed view - Middle-mouse double-click resets zoom to unzoomed view - Chart auto-focuses on pointer enter for keyboard zoom always - Zoom no longer resets when sketch-edit mode is deactivated - Rename SketchZoom → Zoom throughout ViewModel, View, and tests Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
Implemented in commits
Zoom now works at all times, not just during sketch mode. Zoom is also preserved when toggling sketch-edit on/off — it no longer resets when you exit sketch mode. |
|
@copilot upon user testing a few notes on this: Bugs:
New features:
|
Bug fixes: - Fix zoom getting locked when activating sketch-edit while zoomed (CaptureBaseAxisLimits no longer overwrites base when already zoomed) - Use _baseLimitsCaptured flag for reliable underlay zoom sync - Reset flag on ResetZoom for clean re-capture on next zoom New features: - Zoom percentage indicator (bottom-right of chart) - Zoom slider (1×–20×) with two-way binding - Middle-mouse button drag to pan the zoomed viewport - PanBy() clamps panning to base axis limits Tests: - 10 new tests for ZoomPercentage, ZoomSliderValue, PanBy, base limits capture flag, and zoom-while-sketching safety Co-authored-by: jordanrobot <119146+jordanrobot@users.noreply.github.com>
All items addressed in commit Bug fixes:
New features:
10 new unit tests cover the new functionality. |
Adds click-and-drag sketch editing on the chart — users draw torque values directly onto a curve series. Mouse X snaps to nearest speed data point; Y rounds to a configurable torque increment.
Sketch editing core
ChartViewModel:SetSketchEditSeries/ClearSketchEditSeriesgate single-series sketch mode;ApplySketchPointsnaps to nearest RPM index, rounds torque toTorqueSnapIncrement, updates model + cachedObservablePoint, firesDataChangedChartViewcode-behind:PointerPressed→PointerMoved→PointerReleaseddrag lifecycle;TryApplySketchAtPixelconverts pixel→data-space via LiveCharts draw margin and axis limitsEditPointCommand/UndoStackpathCurveDataPanelcolumn header activates sketch modeTooltip toggle
ShowTooltips/ChartTooltipPositiononChartViewModel— bound to chart'sTooltipPositionChart zoom (available at all times)
+key (Shift+= or numpad+) — zoom in centered on cursor-key — zoom out centered on cursor=key — reset to unzoomed viewAddHandlerto avoid LiveCharts consuming themTorqueChartwith auto-focus on pointer enter_baseLimitsCapturedflag for reliable synchronizationZoom UI controls
ZoomSliderValue, zooms around the viewport centreMiddle-mouse pan
PanBy(deltaX, deltaY)shifts the viewport in data-space, clamped to base axis limitsTryPixelDeltaToDataDeltaconverts pixel drag deltas to data-space for smooth panningLocked series guard
SetSketchEditSeriesreturns early forcurve.Locked == trueIsEnabled="{Binding !Locked}"Preferences
TorqueSnapIncrementexposed in Preferences window as "Sketch Torque Snap"NumericUpDown(0.01–10, step 0.1)UserPreferences.Clone()andPreferencesViewModel.Save()Header layout
Tests
52 new xUnit tests covering activation/deactivation, snap rounding, nearest-index lookup, data mutation, locked-curve guard, tooltip auto-toggle, zoom level management, zoom without sketch mode, zoom preservation across sketch toggling, axis limit narrowing, zoom percentage, zoom slider, panning, base limits capture flag, and zoom-while-sketching safety.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.