Skip to content

Refactor PieControl into focused visual, animation, and selection helpers#38

Merged
danielchalmers merged 1 commit into
mainfrom
copilot/split-piecontrol-backend-helpers
May 23, 2026
Merged

Refactor PieControl into focused visual, animation, and selection helpers#38
danielchalmers merged 1 commit into
mainfrom
copilot/split-piecontrol-backend-helpers

Conversation

Copilot AI commented May 23, 2026

Copy link
Copy Markdown
Contributor

PieControl.xaml.cs had accumulated rendering support, animation behavior, and keyboard selection logic in one file, making it harder to reason about without changing UI behavior. This refactor splits those responsibilities into focused helpers while keeping the control API, bindings, and menu interactions unchanged.

  • What moved

    • Extracted slice and center visual models into PieSliceVisual and PieCenterVisual
    • Extracted brush/opacity/click-scale animation behavior and reduced-motion handling into PieAnimationService
    • Extracted keyboard selection state, directional selection, wrapping, and invalid-selection reset into PieSelectionController
  • What stayed in PieControl

    • WPF event wiring
    • dependency properties and existing public events
    • render orchestration and existing layout/visual-builder integration
  • Behavior-preserving wiring changes

    • PieControl now delegates keyboard navigation to PieSelectionController and visual transitions to PieAnimationService
    • Existing events remain unchanged:
      • SliceClicked
      • CenterClicked
      • SliceEditRequested
      • CenterContextMenuRequested
  • Coverage added

    • Added focused pure tests for PieSelectionController covering:
      • first directional selection choosing the nearest slice by angle
      • left/up backward wrapping
      • right/down forward wrapping
      • resetting selection when the selected index is no longer present
_selectionController.HandleArrowKey(key, GetSelectionItems());

if (_selectionController.SelectedIndex == PieSelectionController.NoSelection)
{
    return;
}

_animationService.ApplyBrushColor(
    sliceVisual.FillBrush,
    _renderState.HoverColor,
    animate,
    _renderState.HoverDuration,
    _renderState.StandardEasing);

Agent-Logs-Url: https://github.com/danielchalmers/RadialActions/sessions/96f60921-934d-4030-86fb-33482e0b02a5

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
@danielchalmers danielchalmers marked this pull request as ready for review May 23, 2026 16:05
@danielchalmers danielchalmers merged commit 0d4be3e into main May 23, 2026
1 check passed
@danielchalmers danielchalmers deleted the copilot/split-piecontrol-backend-helpers branch May 23, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants