PeachDrawing.Skia

SkiaLinkMap Class

The links and named places a SkiaCanvas was told about while a document was painted. A Skia canvas draws pixels, so a link is not part of the picture: the host asks this map what is under the pointer and, when the user clicks, activates it.

public sealed class SkiaLinkMap

Inheritance System.Object → SkiaLinkMap

Remarks

Positions are in the canvas’s layout units. A host that has a pointer position in the coordinates of its own SKCanvas - the pixels of the surface, before the matrix the host set on it (a DPI scale, a zoom) - uses HitTestDevice(double, double) instead. The map holds no native resources and outlives its canvas, so a host can hit-test after the painting callback has returned. Nothing is ever launched while a document is painted, only when TryActivateAsync(double, double) is called.

Properties  
Cursors The areas that ask for a pointer of their own, in the order they were added; a later one is on top.
Destinations The named places, and how far below the top of the page each is, in layout units.
Links The links, in the order they were added; a later link is on top.
Semantics The areas the document described to assistive technology, in reading order.
Methods  
ActivateAsync(SkiaLink) Follows link: an address is opened with Launcher (if there is one, the scheme is allowed and the event is not cancelled); a link to a place in the document only raises LinkActivating and leaves the scrolling to the host.
CursorAt(double, double) The topmost area asking for a pointer at x, y in layout units, or null when the document asks for none there (the host shows its own).
CursorAtDevice(double, double) Like CursorAt(double, double), for a position in the host’s own pointer coordinates (see HitTestDevice(double, double)).
HitTest(double, double) The topmost link at x, y in layout units, or null.
HitTestDevice(double, double) Like HitTest(double, double), for a position in the coordinates of the host’s own SKCanvas (a pointer position), which the matrix the host had set on it maps onto layout units.
SemanticAt(double, double) The innermost described area at x, y in layout units, or null: what a screen reader that is pointed at the page, as by touch, lands on.
SemanticAtDevice(double, double) Like SemanticAt(double, double), for a position in the host’s own pointer coordinates (see HitTestDevice(double, double)).
TryActivateAsync(double, double) Follows the topmost link at the position, if there is one (layout units).
TryGetDestination(string, double) How far below the top of the page the place called name is, in layout units.
Events  
LinkActivating Raised before a link is followed. Set Cancel to handle it yourself.