Blitz3D+ Command Reference

CanvasMouseY ( canvas )

Parameters

canvas - canvas gadget to measure against

Description

Returns the mouse position down a canvas, in physical canvas pixels.

Requires Extended language mode.

Gives the current pointer y position measured from the canvas's top edge, in the canvas's own render-target pixels - the same units as CanvasPixelHeight and your drawing. Pair it with CanvasMouseX for editor picking: the pair maps 1:1 onto the canvas pixels, so CameraPick on a 3D viewport or brush painting on a 2D canvas hits exactly where the cursor is, even under DPI scaling.

Note the difference from event coordinates: mouse events ($201-$206) on the shared queue report logical 96-DPI positions, while CanvasMouseY polls the physical pixel position right now. When the pointer is outside the canvas the value simply goes negative or beyond the canvas height.

The world editor shell sample shows the canvas viewport this is designed for.

See also: CanvasMouseX, CanvasPixelHeight, CreateCanvas, EventY, CameraPick.

Index