Skip to content

Dev - #27

Merged
NiceArti merged 5 commits into
mainfrom
dev
Aug 4, 2026
Merged

Dev#27
NiceArti merged 5 commits into
mainfrom
dev

Conversation

@NiceArti

@NiceArti NiceArti commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request improves stroke rendering and canvas interaction behavior across desktop and touch devices.

It adds rendering support for dotted strokes, restores shape-accurate hover outlines, prevents browser navigation gestures while interacting with the canvas, and enables one-finger camera panning on touch devices.

Motivation

Canvas interaction should remain predictable and consistent across different input devices.

Previously:

  • StrokeStyle.Dotted was available in the stroke configuration but was not rendered.
  • Hover feedback used the node bounding box instead of its actual geometry.
  • Horizontal trackpad gestures over the canvas could trigger browser back navigation.
  • Touch devices could not pan the world with one finger.

These issues made the canvas feel less precise and less suitable for editor-style workflows.

Changes

  • Added dotted stroke rendering using the existing geometric dashed-stroke pipeline.

    • Dots use round caps.
    • Stroke width defines the visual dot diameter.
    • Gap controls spacing between dots.
    • Color and gradient stroke fills remain supported.
  • Prevented default wheel and trackpad browser behavior only over registered input surfaces.

  • Added local overscroll-behavior and touch-action handling for canvas surfaces.

  • Added one-finger touch panning through the existing Pointer Events input system.

  • Added pointer delta accumulation and active-pointer filtering.

  • Preserved pointer capture while panning outside the initial canvas bounds.

  • Restored precise hover outlines based on ShapePathCommand geometry instead of world bounding-box corners.

  • Added hover contour handling for:

    • straight path segments;
    • quadratic curves;
    • elliptical arcs;
    • closed subpaths.
  • Kept existing mouse, trackpad, keyboard, and dashed-stroke behavior intact.

Testing

Tested manually in the Playground.

Verified:

  • Dotted strokes render on rectangular, rounded, elliptical, polygonal, and star-shaped nodes.
  • Dotted strokes work with different stroke widths and gap values.
  • Dotted strokes work with stroke alignment and gradient fills.
  • Existing dashed strokes continue to render correctly.
  • Horizontal trackpad gestures pan the canvas without triggering browser navigation.
  • Browser navigation and scrolling continue to work outside the canvas surface.
  • One-finger touch movement pans the world camera.
  • Pointer capture preserves an active touch gesture outside the canvas bounds.
  • Hover outlines follow the actual geometry of ellipses, rounded rectangles, polygons, stars, and curved paths.
  • Text hover and debug rendering remain functional.

Public API

  • No public API changes
  • Public API was added or changed
  • Breaking change

The existing stroke-style and input APIs are reused. The changes are limited to renderer and interaction behavior.

Visual changes

Recommended attachments:

  • Screenshot or recording of dotted strokes using color and gradient fills.
  • Recording of trackpad panning without browser back navigation.
  • Recording of one-finger touch panning.
  • Before-and-after comparison showing bounding-box hover versus shape-accurate hover.

Checklist

  • The project builds successfully
  • Type checking passes
  • Linting passes
  • Tests pass
  • Relevant behavior was tested in the Playground
  • New behavior has tests where practical
  • Documentation was updated where necessary
  • CHANGELOG.md was updated where necessary
  • No unrelated refactoring was included

NiceArti added 5 commits July 31, 2026 10:43
- move rect and ellipse rendering to the shared canvas shape renderer
- remove obsolete rect and ellipse canvas renderers
- introduce reusable shape path commands
- add stroke path geometry with outer and inner contours
- support inside, center and outside stroke alignment
- support independent stroke widths
- preserve corner radius geometry for strokes
- add gradient rendering for stroke areas
- reuse gradient paint pipeline for fill and stroke
- decouple transform overlay bounds from visual stroke bounds
- align focus, hover, resize and rotate handles with intrinsic shape OBB
- keep stroke as a visual extension without affecting transform bounds
- Added functions to resolve stroke pattern contours, edges, geometry, intervals, offsets, and paths.
- Introduced new types for stroke styles, including dashed, dotted, and custom styles.
- Enhanced the RendererCanvasShape to support rendering different stroke styles based on user-defined properties.
- Refactored stroke rendering logic to accommodate new stroke styles and properties.
- Improved handling of stroke alignment and caps during rendering.
…tate management

refactor(ellipse): remove unused arc calculations and streamline inner arc logic
refactor(renderer): clean up stroke segment type definition in RendererCanvasShape
fix(renderer): update hover renderer to handle screen contours and improve shape rendering
refactor(corner-radius): remove unused normalization function from HandleCornerRadius
@NiceArti
NiceArti merged commit f0957bf into main Aug 4, 2026
1 check failed
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.

1 participant