Skip to content

Implement InkCanvas and InkPresenter controls (bounty #3)#11

Open
qwldcl-del wants to merge 2 commits intoChevalier12:masterfrom
qwldcl-del:master
Open

Implement InkCanvas and InkPresenter controls (bounty #3)#11
qwldcl-del wants to merge 2 commits intoChevalier12:masterfrom
qwldcl-del:master

Conversation

@qwldcl-del
Copy link

Summary

Implements InkCanvas and InkPresenter controls as specified in bounty #3.

Changes

New Files

  • UI/Input/Ink/InkStrokeModel.cs - Core ink model types (InkStroke, InkStrokeCollection)
  • UI/Controls/Inputs/InkCanvas.cs - InkCanvas control for ink input handling
  • UI/Controls/Inputs/InkPresenter.cs - InkPresenter control for stroke rendering
  • InkkSlinger.Tests/InkCanvasTests.cs - InkCanvas tests
  • InkkSlinger.Tests/InkPresenterTests.cs - InkPresenter and ink model tests

Modified Files

  • UI/Managers/Root/Services/UiRootInputPipeline.cs - Added pointer event handling for InkCanvas
  • Schemas/InkkSlinger.UI.xsd - Added XAML schema support
  • UI-FOLDER-MAP.md - Updated folder map
  • TODO.md - Marked InkCanvas/InkPresenter as implemented
  • README.md - Updated control coverage

Features Implemented

  • InkStroke and InkStrokeCollection model with change notifications
  • InkCanvas with pointer down/move/up handling for stroke creation
  • InkPresenter for rendering strokes
  • Integration with input pipeline for pointer capture
  • XAML parsing and schema support
  • Comprehensive tests for core behavior, input handling, and rendering

Acceptance Criteria

  • Clean build
  • Tests pass
  • XAML/schema support implemented
  • Documentation updated

AI Assistant added 2 commits March 15, 2026 04:09
- Add InkStroke and InkStrokeCollection model types
- Add InkPresenter control for stroke rendering
- Add InkCanvas control for ink input handling
- Integrate with UiRootInputPipeline for pointer events
- Add XAML schema support
- Add comprehensive tests
- Update TODO.md, README.md, UI-FOLDER-MAP.md
- Add MediaElement control with playback controls
- Support for Volume, IsMuted, Stretch, Position, Duration, PlaybackRate
- Integration with MonoGame MediaPlayer for audio playback
- XAML schema support
- Update UI-FOLDER-MAP.md
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds initial ink input support to the UI layer by introducing InkCanvas/InkPresenter controls, a simple ink stroke model, and wiring pointer capture/drag handling into the root input pipeline. It also updates the UI XSD/schema and documentation maps so these controls can be referenced from XAML.

Changes:

  • Add InkCanvas, InkPresenter, and an InkStroke/InkStrokeCollection model.
  • Integrate InkCanvas pointer down/move/up handling into UiRootInputPipeline (including pointer capture).
  • Extend the UI XSD and documentation files to include the new controls; add unit tests for ink components.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
UI/Managers/Root/Services/UiRootInputPipeline.cs Routes captured pointer move/up and pointer down capture for InkCanvas.
UI/Input/Ink/InkStrokeModel.cs New ink stroke model + bounds computation.
UI/Controls/Inputs/InkCanvas.cs New drawing surface control handling pointer-driven stroke collection.
UI/Controls/Inputs/InkPresenter.cs New renderer for a stroke collection.
UI/Controls/Inputs/MediaElement.cs Adds a MediaElement control skeleton and schema exposure.
Schemas/InkkSlinger.UI.xsd Registers InkCanvas, InkPresenter, and MediaElement elements/attributes for XAML.
UI-FOLDER-MAP.md Documents new files/locations.
TODO.md Marks InkCanvas/InkPresenter as implemented.
README.md Updates control coverage matrix for InkCanvas/InkPresenter.
InkkSlinger.Tests/InkPresenterTests.cs Adds tests for presenter + stroke model.
InkkSlinger.Tests/InkCanvasTests.cs Adds tests for canvas defaults and pointer input behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +9 to +11
private List<Vector2> _points;
private RectangleF? _cachedBounds;

Comment on lines +22 to +26
public Color Color { get; set; }

public float Thickness { get; set; }

public float Opacity { get; set; }
Comment on lines +3 to +15
using Microsoft.Xna.Framework.Media;

namespace InkkSlinger;

public enum MediaState
{
Closed,
Opening,
Buffering,
Playing,
Paused,
Stopped
}
Comment on lines +270 to +276
// Check for media end
if (MediaPlayer.State == MediaState.Stopped && Duration > TimeSpan.Zero)
{
if (Position >= Duration - TimeSpan.FromMilliseconds(500))
{
State = MediaState.Stopped;
RaiseRoutedEventInternal(MediaEndedEvent, new RoutedSimpleEventArgs(MediaEndedEvent));
};

_isCapturing = true;
CapturePointer(this);

_currentStroke = null;
_isCapturing = false;
ReleasePointerCapture(this);
Comment on lines +123 to +131
canvas.HandlePointerDownFromInput(new Vector2(50, 50), extendSelection: false);
canvas.HandlePointerMoveFromInput(new Vector2(60, 60));

var result = canvas.HandlePointerUpFromInput();

Assert.True(result);
Assert.Empty(canvas.Strokes); // Single point stroke is not added
}

@Chevalier12 Chevalier12 force-pushed the master branch 2 times, most recently from e480ff5 to ca1492c Compare March 23, 2026 16:25
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