Interface IPluginCanvas
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
A rectangle the plugin paints, shown over the world and under every window, taking no input unless it opted in through AcceptsPointerInput. Painting is retained: the host keeps what was last painted and calls the paint callback again only after Invalidate(), at most once per frame, on the tick thread, with a painter that is valid only for the duration of that call.
A paint callback that keeps running over its budget on several frames in a row, throws, or leaves a clip pushed is dropped for the rest of the session and the canvas hidden; the client's log says why. Disposing the canvas removes it. On a host that draws nothing the canvas is accepted, IsAvailable is false and the paint callback is never called.
public interface IPluginCanvas : IDisposable
- Inherited Members
Properties
Anchor
Which corner or edge of the screen the canvas is measured from. Set it to move the canvas.
PluginCanvasAnchor Anchor { get; set; }
Property Value
CanvasId
The plugin's own name for this canvas, as registered.
string CanvasId { get; }
Property Value
Height
The canvas's height in pixels, as registered.
int Height { get; }
Property Value
IsAvailable
Whether the host draws this canvas at all: false without a window.
bool IsAvailable { get; }
Property Value
IsVisible
Whether the canvas is shown. Set it to show or hide the canvas; what was painted is kept while hidden.
bool IsVisible { get; set; }
Property Value
Offset
How far from the anchor the canvas sits, in pixels. Set it to move the canvas.
PluginPoint Offset { get; set; }
Property Value
PointerHandler
Where pointer events go, on a canvas registered with AcceptsPointerInput. Null, the default, and the canvas is click-through whatever the descriptor said: nobody is listening, so nothing is taken. Set, and every press, held move, release and wheel turn over the canvas arrives here, on the tick thread, in the canvas's own pixels.
The handler is measured like the paint callback: one that keeps running over its budget on several events in a row, or throws, is dropped for the rest of the session and the canvas goes back to click-through; painting continues and the client's log says why. Setting the handler on a canvas that did not opt in, or on a host without a window, keeps the value and delivers nothing; a host that predates pointer input answers null and ignores the set.
Action<PluginPointerEvent>? PointerHandler { get; set; }
Property Value
Width
The canvas's width in pixels, as registered.
int Width { get; }
Property Value
Methods
Invalidate()
Asks for the paint callback to run again, on the next frame at the earliest. Calling it several times before that frame paints once.
void Invalidate()
ReleasePointer()
Ends the press the canvas is holding, if any: no further Move or Up arrives for it, and no Cancelled is sent for a release the plugin asked for. Safe to call from inside the handler and at any other time; does nothing when nothing is held, on a canvas without input, or on a host without a window.
void ReleasePointer()