Skip to content

CanvasUi implementation - #2354

Merged
andrewfb merged 11 commits into
cinder:masterfrom
andrewfb:canvasUi
Sep 28, 2025
Merged

andrewfb merged 11 commits into
cinder:masterfrom
andrewfb:canvasUi

Conversation

@andrewfb

Copy link
Copy Markdown
Collaborator

This is a continuation of work @paulhoux started with PR #2326, implementing a CanvasUi class, similar to CameraUi but for 2D canvas manipulation.

This PR includes two samples, one exercising most of the functionality, CanvasUi, and another showing how to implement a mini-map paired with CanvasUi called CanvasUiMinimap.

The implementation allows customization of hotkeys and mouse interactions, but by default uses middle, right, or alt-left clicking for panning, leaving left click for selecting. It also supports several hotkeys for zoom by default.

One key concept is the notion of a bounded vs. unbounded canvas. The former is required for "fitting" functionality, which allows automatic zoom to fit height, width, etc to the window. An unbounded canvas cannot be fit to a window but allows an infinite canvas.

It's challenging for a class like this to be "all things to all men" but I believe this addresses most of the common features typically needed and should simplify samples at the very least.
Screenshot From 2025-09-17 19-16-31
Screenshot From 2025-09-17 19-40-27

Tested on macOS, MSW and Linux.

@andrewfb
andrewfb merged commit 6fce019 into cinder:master Sep 28, 2025
@andrewfb andrewfb mentioned this pull request Sep 28, 2025
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