Skip to content

Add SKTouchCanvasView Blazor library with touch event support#357

Closed
Copilot wants to merge 6 commits intomainfrom
copilot/extract-sktouchcanvasview
Closed

Add SKTouchCanvasView Blazor library with touch event support#357
Copilot wants to merge 6 commits intomainfrom
copilot/extract-sktouchcanvasview

Conversation

Copy link
Contributor

Copilot AI commented Feb 25, 2026

  • Create source/SkiaSharp.Extended.UI.Blazor/ library with touch types only (no gesture view, no SKCanvasView wrapper)
    • SKTouchAction enum, SKTouchDeviceType enum, SKTouchEventArgs class
    • SKTouchCanvasView Razor component + SKTouchInterop.js
    • Project file (net9.0;net10.0) + _Imports.razor + README.md
  • Add touch demo page — single canvas with device-colored strokes, action/device counters, event log
  • Add unit tests — 15 tests, all passing
  • Update solution file, NavMenu, solution filters (Pack/Test) for CI
  • Fix Blazor 404 on GitHub Pages by adding .nojekyll to gh-pages root (disables Jekyll which strips _framework/ dirs)

💡 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.

Extract touch event support from PR #352 into a new SkiaSharp.Extended.UI.Blazor
Razor Class Library. Includes SKTouchAction, SKTouchDeviceType, SKTouchEventArgs,
and SKTouchCanvasView component with JS interop for pointer events.

Adds a Touch demo page to the Blazor sample with drawing pad, touch action
counters, and device type detection. Includes 15 unit tests for event args
and MAUI-compatible enum values.

Updates solution filters (Pack/Test) and multi-targets net9.0;net10.0.

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copilot AI changed the title [WIP] Extract SKTouchCanvasView for touch event implementation Add SKTouchCanvasView Blazor library with touch event support Feb 25, 2026
Copilot AI requested a review from mattleibow February 25, 2026 02:54
@mattleibow
Copy link
Collaborator

@copilot please make the demo be a single canvas. Maybe we can have different colors for different device types. Also, we can log the action types as well as have counted for each action.

Also, please maybe record a gif of you interacting with the canvas. I want to see an aesthetic stroke.

… and event log

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot please make the demo be a single canvas. Maybe we can have different colors for different device types. Also, we can log the action types as well as have counted for each action.

Also, plea...

Consolidated into a single canvas in 284fa9a. Strokes are now colored by device type (blue=Mouse, coral=Touch, green=Stylus), with action counters, device counters, and a live event log below the canvas.

Touch demo with strokes

I'm unable to record an animated GIF from this sandboxed environment — you'd need to interact with the running sample at /touch to see the live drawing experience.

@mattleibow mattleibow closed this Feb 26, 2026
@mattleibow mattleibow reopened this Feb 26, 2026
github-actions bot pushed a commit that referenced this pull request Feb 26, 2026
@github-actions
Copy link

📖 Documentation Preview

The documentation for this PR has been deployed and is available at:

🔗 View Staging Documentation

🔗 View Staging Blazor Sample

This preview will be updated automatically when you push new commits to this PR.


This comment is automatically updated by the documentation staging workflow.

@mattleibow
Copy link
Collaborator

@copilot blazor fails to load

blazor.webassembly.js:1 Failed to load resource: the server responded with a status of 404 ()

GitHub Pages uses Jekyll by default, which ignores directories starting
with underscore (like _framework). Adding .nojekyll to the root of the
gh-pages branch disables Jekyll processing so blazor.webassembly.js and
other files in _framework are served correctly.

Applied to all three deployment paths:
- Main site build (docs/_site/.nojekyll in artifact)
- Same-repo PR staging deploy
- Fork PR staging deploy

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 26, 2026

@copilot blazor fails to load

blazor.webassembly.js:1 Failed to load resource: the server responded with a status of 404 ()

The 404 on blazor.webassembly.js was caused by GitHub Pages using Jekyll processing, which strips directories starting with _ (like _framework/). Fixed in ccfbe9c by adding a .nojekyll file to the root of the gh-pages branch in all deployment paths (main build, same-repo staging, and fork PR staging). The CI workflow will re-run and redeploy the staging site with this fix.

github-actions bot pushed a commit that referenced this pull request Feb 26, 2026
Copilot AI added a commit that referenced this pull request Feb 26, 2026
…tory

GitHub Pages uses Jekyll by default which strips directories starting with
underscore (like _framework). A .nojekyll file disables this behavior,
which is required for Blazor WASM apps to load correctly.

Changes copied from PR #357:
- docs-deploy.yml: touch docs/_site/.nojekyll in build step
- docs-deploy.yml: touch .nojekyll + git add in staging deploy
- docs-deploy-fork-pr.yml: touch .nojekyll + git add in staging deploy

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
@mattleibow
Copy link
Collaborator

@copilot clicking/touching and dragging on the canvas does not draw lines.

@mattleibow
Copy link
Collaborator

@copilot navigating away from the touch page resukts in an error but all other pages are fine:

Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
      Unhandled exception rendering component: TypeError: Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element'.
TypeError: Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element'.

mattleibow added a commit that referenced this pull request Feb 26, 2026
* Initial plan

* Add .nojekyll fixes to prevent Jekyll from stripping _framework directory

GitHub Pages uses Jekyll by default which strips directories starting with
underscore (like _framework). A .nojekyll file disables this behavior,
which is required for Blazor WASM apps to load correctly.

Changes copied from PR #357:
- docs-deploy.yml: touch docs/_site/.nojekyll in build step
- docs-deploy.yml: touch .nojekyll + git add in staging deploy
- docs-deploy-fork-pr.yml: touch .nojekyll + git add in staging deploy

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Feb 26, 2026
Copilot AI added a commit that referenced this pull request Feb 26, 2026
…ing and navigation

- Copy all source files from PR #357: SKTouchCanvasView component, touch types,
  JS interop, tests, Touch demo page, nav menu updates, solution/filter updates
- Fix touch/mouse dragging not drawing: auto-invalidate canvas after handled
  touch events in SKTouchCanvasView.OnPointerEvent
- Fix ResizeObserver error on navigation: don't manually dispose inner
  SKCanvasView (let Blazor manage its lifecycle)
- Add setPointerCapture on pointerdown for reliable drag tracking

Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
@mattleibow mattleibow closed this Feb 26, 2026
github-actions bot pushed a commit that referenced this pull request Feb 26, 2026
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