17 private readonly SKColor _normalColor =
new(80, 150, 255);
18 private readonly SKColor _hoverColor =
new(125, 185, 255);
52 string? nickname =
null)
55 ArgumentNullException.ThrowIfNull(uriLauncher);
56 ArgumentNullException.ThrowIfNull(view);
57 ArgumentNullException.ThrowIfNull(navigateUri);
59 if (!navigateUri.IsAbsoluteUri)
60 throw new ArgumentException(
"The URI must be absolute.", nameof(navigateUri));
62 _uriLauncher = uriLauncher;
64 Label = CreateLabel(renderSurfaceHost, view, bounds, text);
67 CompleteInitialization();
86 string? nickname =
null)
89 ArgumentNullException.ThrowIfNull(uriLauncher);
90 ArgumentNullException.ThrowIfNull(sceneLayer);
91 ArgumentNullException.ThrowIfNull(navigateUri);
93 _uriLauncher = uriLauncher;
96 Label = CreateLabel(renderSurfaceHost, sceneLayer, bounds, text);
99 CompleteInitialization();
102 #endregion constructors
104 #region public properties
116 #endregion public properties
118 #region public methods
125 public async ValueTask
OpenAsync(CancellationToken cancellationToken =
default)
134 await _uriLauncher.OpenAsync(uri, cancellationToken);
143 #endregion public methods
145 #region protected methods
150 base.OnPointerEnter(args);
151 Label.SetColors(_hoverColor, SKColors.Transparent);
157 base.OnPointerLeave(args);
158 Label.SetColors(_normalColor, SKColors.Transparent);
164 base.OnPointerClick(args);
176 base.OnKeyboardInput(args);
182 if (args.
Key is not 13 and not 32)
189 #endregion protected methods
191 #region private methods
193 private void CompleteInitialization()
206 .
SetFont(SKTypeface.Default, 16f, minSize: 10f)
207 .
SetColors(_normalColor, SKColors.Transparent)
217 return new TextBlock(host, layer, view:
null, worldBounds: bounds)
219 .
SetFont(SKTypeface.Default, 16f, minSize: 10f)
220 .
SetColors(_normalColor, SKColors.Transparent)
225 #endregion private methods
SceneLayer? SceneLayer
Gets the scene layer shared by all children in scene-layer mode.
View? View
Gets the view shared by all children in view mode.
virtual DirectComposite Add(IDirectCompositeChild child, bool keepCurrentOffset=true, Vector2? explicitLocalOffsetPx=null)
Adds a composite-compatible direct drawable as a child.
A retained-mode text drawable with wrapping, multi-line ( ) support, horizontal/vertical alignment,...
TextBlock SetFont(SKTypeface typeface, float size, float? minSize=null)
Sets the font face and size (and optional minimum size for auto-shrink).
TextBlock EnableWrapping(bool enable=true)
Enables or disables word wrapping when laying out paragraphs.
TextBlock SetAlignment(SKTextAlign h, VerticalAlign v)
Sets the horizontal and vertical alignment used when drawing the laid-out lines within the bounds.
VerticalAlign
Vertical alignment options for multi-line text within the control's bounds.
TextBlock SetColors(SKColor fg, SKColor bg)
Sets the foreground (text) and background colors using Skia colors.
TextBlock SetText(string text)
Sets the current text content and rebuilds layout as needed. If no reveal animation is active,...
Represents a base class for hosting a render surface, providing functionality for managing rendering ...
Represents a rendered view of a scene, combining a camera position with a viewport configuration to c...
Represents a single layer within a Scene, containing a grid of tiles and supporting various coordinat...
DirectDrawingMode
Specifies where direct drawing operations are applied within the rendering pipeline.