Implement InkCanvas and InkPresenter controls (bounty #3)#11
Open
qwldcl-del wants to merge 2 commits intoChevalier12:masterfrom
Open
Implement InkCanvas and InkPresenter controls (bounty #3)#11qwldcl-del wants to merge 2 commits intoChevalier12:masterfrom
qwldcl-del wants to merge 2 commits intoChevalier12:masterfrom
Conversation
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
There was a problem hiding this comment.
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 anInkStroke/InkStrokeCollectionmodel. - Integrate
InkCanvaspointer down/move/up handling intoUiRootInputPipeline(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 | ||
| } | ||
|
|
e480ff5 to
ca1492c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements InkCanvas and InkPresenter controls as specified in bounty #3.
Changes
New Files
Modified Files
Features Implemented
Acceptance Criteria