drawnui-react 0.1.0-preview.36 โ†’ 0.1.0-preview.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +87 -13
  2. package/SKIPPED.md +6 -5
  3. package/dist/controls/AnimatedFramesRenderer.d.ts +2 -0
  4. package/dist/controls/AnimatedFramesRenderer.js +2 -0
  5. package/dist/controls/DrawnGame.d.ts +5 -1
  6. package/dist/controls/DrawnGame.js +22 -4
  7. package/dist/controls/SkiaCarousel.d.ts +1 -1
  8. package/dist/controls/SkiaCarousel.js +36 -4
  9. package/dist/controls/SkiaDrawer.d.ts +13 -0
  10. package/dist/controls/SkiaDrawer.js +40 -7
  11. package/dist/controls/SkiaEditor.d.ts +3 -1
  12. package/dist/controls/SkiaEditor.js +5 -0
  13. package/dist/controls/SkiaGif.d.ts +4 -0
  14. package/dist/controls/SkiaGif.js +13 -2
  15. package/dist/controls/SkiaImage.d.ts +5 -0
  16. package/dist/controls/SkiaImage.js +33 -4
  17. package/dist/controls/SkiaLabel.d.ts +7 -1
  18. package/dist/controls/SkiaLabel.js +9 -3
  19. package/dist/controls/SkiaLayout.js +3 -1
  20. package/dist/controls/SkiaLottie.js +1 -1
  21. package/dist/controls/SkiaRadioButton.d.ts +2 -0
  22. package/dist/controls/SkiaRadioButton.js +10 -0
  23. package/dist/controls/SkiaScroll.js +18 -9
  24. package/dist/controls/SkiaShaderCarousel.d.ts +6 -1
  25. package/dist/controls/SkiaShaderCarousel.js +22 -5
  26. package/dist/controls/SkiaSprite.d.ts +3 -0
  27. package/dist/controls/SkiaSprite.js +18 -10
  28. package/dist/controls/SkiaSvg.d.ts +4 -0
  29. package/dist/controls/SkiaSvg.js +27 -3
  30. package/dist/controls/SnappingLayout.js +2 -1
  31. package/dist/core/Accessibility.d.ts +41 -5
  32. package/dist/core/Accessibility.js +190 -9
  33. package/dist/core/Canvas.d.ts +49 -2
  34. package/dist/core/Canvas.js +152 -11
  35. package/dist/core/Gestures.d.ts +47 -0
  36. package/dist/core/Gestures.js +93 -0
  37. package/dist/core/ImageEffects.d.ts +2 -0
  38. package/dist/core/ImageEffects.js +2 -0
  39. package/dist/core/KeyboardManager.d.ts +20 -0
  40. package/dist/core/KeyboardManager.js +58 -15
  41. package/dist/core/PopupWindows.d.ts +2 -0
  42. package/dist/core/PopupWindows.js +2 -0
  43. package/dist/core/SkiaControl.d.ts +31 -1
  44. package/dist/core/SkiaControl.js +61 -5
  45. package/dist/core/Tooltips.d.ts +2 -0
  46. package/dist/core/Tooltips.js +10 -0
  47. package/dist/react/SkiaShell.js +32 -12
  48. package/dist/react/index.d.ts +4 -1
  49. package/dist/react/index.js +34 -16
  50. package/dist/react/reconciler.d.ts +18 -0
  51. package/dist/react/reconciler.js +31 -1
  52. package/package.json +16 -2
package/README.md CHANGED
@@ -1,15 +1,15 @@
1
- # DrawnUi.React
1
+ # DrawnUI for React
2
2
 
3
- [DrawnUi](https://drawnui.net) engine ptototype for React, TypeScript on top of
4
- [CanvasKit](https://skia.org/docs/user/modules/canvaskit/) (Skia for the browser), composed with React
5
- through a custom `react-reconciler` renderer.
3
+ ![DrawnUI for React: the Hello app in desktop browsers, on iPhone and on Android](.github/images/banner.png)
6
4
 
7
- Check out latest playbook: [helloreact.drawnui.net](https://helloreact.drawnui.net/) ๐Ÿ‘ˆ
5
+ [![npm](https://img.shields.io/npm/v/drawnui-react/preview.svg)](https://www.npmjs.com/package/drawnui-react)
6
+ ![License](https://img.shields.io/github/license/DrawnUi/DrawnUi.React.svg)
8
7
 
9
- Playground to use and test live: [drawfiddle.com](https://drawfiddle.com/) ๐Ÿ‘ˆ
8
+ Build rich, fluid UI for the web by drawing it. Every control is painted on one hardware-accelerated canvas by
9
+ DrawnUI, the Skia engine behind DrawnUI for .NET and Rust, and you compose it with React: JSX, hooks, state, the
10
+ way you already work.
10
11
 
11
- *Work in progress*: the goal is same API surface and semantics as DrawnUi (.NET) โ€” same control names, same PascalCase
12
- property names, same measure/arrange/paint contract โ€” so knowledge and docs transfer 1:1.
12
+ Live demo: [helloreact.drawnui.net](https://helloreact.drawnui.net) ยท Playground: [drawfiddle.com](https://drawfiddle.com) ยท Docs: [drawnui.net](https://drawnui.net/articles/react/index.html)
13
13
 
14
14
  ```tsx
15
15
  await Super.UseDrawnUi()
@@ -24,9 +24,67 @@ await Super.UseDrawnUi()
24
24
  </Canvas>
25
25
  ```
26
26
 
27
+ ## One family
28
+
29
+ DrawnUI for React is the same engine as [DrawnUI for .NET](https://github.com/DrawnUi/DrawnUi.Net) (MAUI, Blazor,
30
+ WPF, OpenTK, WebAssembly) and [DrawnUI for Rust](https://github.com/DrawnUi/DrawnUi.Rust): the same controls,
31
+ property names, layout and drawing rules. What you learn here works there, and screens move between them.
32
+
33
+ ## What you get, all drawn on one canvas
34
+
35
+ - **Layouts:** stacks, rows, grids, wrap and masonry, layers with any alignment.
36
+ - **Lists that stay smooth:** 100 000 recycled rows, items of different heights, load more at both ends.
37
+ - **Animations:** a frame loop for anything, Lottie and GIF, spritesheets.
38
+ - **Transforms in 2D and 3D:** rotate, scale, skew, perspective and depth; taps still land on the right control.
39
+ - **Gestures:** tap, long press, pan, swipe, drag to reorder, mouse hover, right-click menus.
40
+ - **Shaders:** SkSL effects on any control, shader transitions between images.
41
+ - **Navigation:** shell with pages, popups, modals, toasts, carousel and drawer.
42
+ - **Text:** rich spans, markdown, emoji and symbols, a drawn text editor.
43
+ - **Keyboard:** Tab, arrows, Enter and Escape move through every control, list, menu and dialog.
44
+ - **Accessibility:** screen readers read your drawn UI, names, values and dialogs included.
45
+ - **Games:** a game loop and sprites, with Pong as a sample.
46
+ - **AI-ready:** a [skill file](https://helloreact.drawnui.net/skills/drawnui-react/SKILL.md) teaches coding agents to build with it.
47
+
27
48
  ## MIT, everywhere
49
+
28
50
  DrawnUI is MIT licensed in every language and on every platform: desktop, mobile, web and embedded devices. Ship it in commercial products with no attribution badge, no about screen and no per-device royalty.
29
51
 
52
+ ## What's new in 0.1.0-preview.38
53
+
54
+ - **SkiaScroll size, as in DrawnUI for .NET and Rust:** a `SkiaScroll` without a `WidthRequest` / `HeightRequest` that
55
+ is not `Fill` on that axis sizes to its content on that axis, up to the space it is given. Set `HorizontalOptions` /
56
+ `VerticalOptions` to `Fill` for a scroll that fills its space (a page scroll, a list).
57
+ - **Multi-touch:** a `Panning` while two or more fingers are down carries `Manipulation`: `Scale` (pinch), `Rotation`
58
+ (turn, in degrees), `Center` / `PreviousCenter`, their totals and the finger count. A press that had a second finger
59
+ down is no tap.
60
+ - **Keys, one order everywhere:** the canvas keyboard navigation (activation, arrows in lists and menus, slider steps,
61
+ Escape closing a popup window) gets each key first, then your `KeyboardManager` handlers run with
62
+ `KeyboardManager.IsKeyHandled` telling whether navigation used it. Skip handled keys so one press does one thing.
63
+ - **Desktop menu bars from the keyboard:** Alt alone puts the keyboard on the bar, the arrows go round the titles and
64
+ the lines, Escape closes one level. New for your own menus: `KeyboardWrap` (the arrows go round a group),
65
+ `canvas.SetAccessibilityFocus(control)` (it wins over the canvas' own focus move of the same frame; `undefined`
66
+ keeps the focus where it is), `canvas.KeyboardFocusNode`, `AccessibilityExpanded`.
67
+ - **Frame players:** `SpeedRatio` is the real speed (0.5 plays at half speed, 2 at double) on `SkiaSprite`, `SkiaGif`
68
+ and `SkiaLottie`. `DefaultFrame` and `CurrentFrame` are frame indexes, -1 is the last frame.
69
+ - **Images:** `Aspect="Tile"` repeats a `SkiaImage` or `SkiaSvg` at its natural size over the whole control, starting
70
+ from the copy its alignment places. `AddEffect="Grayscale"` uses the 0.21 / 0.72 / 0.07 luminance weights;
71
+ `BlackAndWhite` keeps 0.2989 / 0.587 / 0.114.
72
+ - **Gradients:** a gradient's `Light` above 1 multiplies each color's lightness, below 1 its red, green and blue, as in
73
+ DrawnUI for .NET. A `SkiaLabel` with a `BackgroundColor` takes its `FillGradient` on the background and keeps its
74
+ `TextColor`; without one the gradient fills the text.
75
+ - **Drawers:** `AutoClose` closes on a press outside the drawer's content, so a full-screen drawer with a smaller panel
76
+ closes from a press above the panel. A touch that lands on a drawer while it slides lets it finish the slide.
77
+ - **Shell modals:** `ModalsCount`, `CanGoBack` and `Navigated` (Pop) follow a modal the moment its close starts,
78
+ whether by `PopModalAsync`, a swipe or `IsOpen = false`; the modal slides out after that.
79
+ - **Carousels:** a second swipe during a shader carousel's transition raises `Stopped` once, at rest, and a move by
80
+ code takes over a queued swipe. `IsUserFocused` is false after every release, a tap included.
81
+ - **Removed controls:** a control removed from the canvas pauses its animations until it is added back; a disposed
82
+ one stops them. A removed text field lets go of the keyboard, and a `DrawnGame` gets keys while it is on a canvas.
83
+ - **Accessibility:** shell popups and modals read as dialogs, a live region's new text is read on the next frame, and
84
+ a menu or list whose items sit in several layouts is walked in reading order.
85
+ - **Tools:** `Canvas.PopupWindowRoots` lists the open popup windows, `Canvas.WasDrawnListeners` runs handlers after
86
+ every drawn frame, and `DesignerSourceOf(control)` gives the React element that created a control in dev builds.
87
+
30
88
  ## Install
31
89
 
32
90
  ```
@@ -98,16 +156,32 @@ with no handler the browser menu shows as before. `e` carries `Location` (points
98
156
  (pixels inside the handling control), `Source` (`"mouse"`, `"touch"` for a long press, `"keyboard"` for the Menu
99
157
  key) and `Native` (the DOM event, for modifiers). Web-only: DrawnUi.Net has no mouse buttons.
100
158
 
159
+ ## Menu bar
160
+
161
+ A desktop menu bar is a row of titles (`Aria.RoleMenuBar`), each opening its menu below it with
162
+ `OpenPopupWindow(canvas, menu, title)`. The demo's menu bar works the way desktop users expect, from the mouse and from
163
+ the keyboard alone: a click opens a menu and the mouse over another title opens that one; Alt alone puts the keyboard
164
+ on the bar and Alt+F opens File; Left / Right go round the titles, Down, Enter or Space open one on its first item; Up /
165
+ Down / Home / End go round its lines, Right / Left move to the next / previous menu, Enter runs the line, Escape closes
166
+ one level and Alt leaves, giving the keyboard back. The keyboard's place shows the selected look in the accent color,
167
+ the hover keeps its lighter look. Screen readers hear menubar, menu and menu item roles, the titles' expanded state
168
+ (`AccessibilityExpanded`) and every line the keys light (`canvas.SetAccessibilityFocus(control)`). Shortcuts (Ctrl+S,
169
+ F1) work with the menus closed too. Code: `samples/demo/pages/MenusPage.tsx`.
170
+
101
171
  ## Accessibility
102
172
 
103
- Same model as DrawnUi.Blazor: the `<canvas>` is `aria-hidden`, an invisible DOM overlay mirrors every
104
- accessible drawn control (`role`, `aria-label`, `title` hint, `aria-pressed`, `aria-live`, `tabindex`), rebuilt
105
- at most once per second from the arranged rects. Keyboard (Tab / Enter / Space) and screen-reader activation
106
- are routed back into the gesture pipeline as a `Tapped` on the control.
173
+ Same model as DrawnUI for .NET in the browser: the `<canvas>` is `aria-hidden`, and an invisible ARIA layer mirrors
174
+ every accessible drawn control (role, name, hint, value, pressed state, live regions). Tab, the arrow keys, Home /
175
+ End, PageUp / PageDown, Enter, Space and Escape move through controls, lists, menus and dialogs; screen-reader
176
+ activation reaches the control as a `Tapped`. A dialog marked `AccessibilityModal` (shell popups and modals are by
177
+ themselves) keeps readers and the keyboard inside it, and a live region's new text is read on the next frame.
107
178
 
108
179
  Per control (C# names): `AccessibilityRole` (enables the node; use `Aria.*`), `AccessibilityLabel`
109
180
  (defaults to the control's text), `AccessibilityHint`, `AccessibilityCanInteract` (defaults to "has a
110
- `Tapped` handler"), `AccessibilityIsPressed`, `AccessibilityLive`. `Aria.RolePresentation` hides a control that
181
+ `Tapped` handler"), `AccessibilityIsPressed`, `AccessibilityExpanded`, `AccessibilityLive`, `KeyboardWrap` (the arrows
182
+ go round a group); `canvas.SetAccessibilityFocus(control)` moves the keyboard and screen-reader focus from app code.
183
+ The canvas navigation gets every key first, then `KeyboardManager` subscribers run with `KeyboardManager.IsKeyHandled`
184
+ telling whether navigation used it, so one press does one thing. `Aria.RolePresentation` hides a control that
111
185
  would otherwise get a default role.
112
186
 
113
187
  App-wide opt-in (React extension): `SkiaLabel.DefaultAccessibilityRole = Aria.RoleText` and
package/SKIPPED.md CHANGED
@@ -10,7 +10,7 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
10
10
  | `UseCache` | partial | `None`, `Operations` / `OperationsFull` (SkPicture replay), `Image` (offscreen surface snapshot, GPU-backed on WebGL, nearest-sampled blit), `ImageDoubleBuffered` (`RenderObjectPrevious` kept and drawn when a new cache cannot be produced yet, `DrawPlaceholder(ctx)` hook when there is none; recording itself is synchronous โ€” no background thread, same as DrawnUi.Blazor with `CanUseCacheDoubleBuffering = false`), `ImageComposite` / `ImageCompositeGPU` (per-child composite, see the `UseCache="ImageComposite"` row below). `GPU` resolves to `Image` and `ImageCompositeGPU` to `ImageComposite`: no separate GPU-only path. `Super.CacheEnabled`, `RenderObject`/`CachedObject`, `InvalidateCache`, `DestroyRenderingObject`, `Canvas.DisposeObject` (deleted after flush). Defaults per C#: `SkiaLabel`/`SkiaSvg` Operations, everything else None. Not ported: `CacheSharing`, `AllowCaching`, offscreen bake threads, cache validity by GRContext. |
11
11
  | Incremental invalidation | partial | `Measure` returns the previous size when `!NeedMeasure` and constraints+scale are unchanged; `Update()`/`InvalidateMeasure()` bubble up and stale every ancestor cache; `Repaint()` keeps caches. Arrange still runs per frame for the whole tree; no dirty regions, no `DirtyChildrenTracker`. Post-animators on a control nested INSIDE a cached ancestor are drawn only when that ancestor re-records. |
12
12
  | Gestures core: `Canvas.Gestures` (Disabled/Enabled/Lock), `ProcessGestures(args, apply)`, `ConsumeGestures`, `Tapped`/`ChildTapped`, `InputTransparent`, `BlockGesturesBelow`, `LockChildrenGestures`, `HitBoxAuto`/`HitIsInside`/`IsGestureForChild`, `SkiaGesturesParameters`/`GestureEventProcessingInfo`/`SkiaGesturesInfo`/`ControlTappedEventArgs` | ported | Pointer events -> per-pointer `OnTouchAction` state machine (port of DrawnUi.Blazor) -> Down/Panning/Tapped/Up, queued and processed at frame start. Tap slop = 16pt like AppoMobi TouchEffect. The control that consumes a gesture keeps receiving it until it lets go (DrawnUi `Canvas.HadInput`, one pointer here instead of C#'s set): without it a drag handle, a slider thumb or a held button stops getting `Panning` the moment the finger leaves its box, and a control that stops consuming hands routing straight back to the tree (a button whose press turns into a scroll pan). Every mouse button is delivered (`Event.Pointer`: `Button`, `ButtonNumber`, `DeviceType`, `PressedButtons`, the AppoMobi.Gestures PointerData): a right click is Down / Up / Tapped with `Button` "Right" plus a `ContextMenu`; handlers that must be primary-only check `e.Parameters.Event.Pointer?.Button`. |
13
- | Gestures: `Pointer` (routed as a gesture; hover itself is ported, see `ReceivesHover`; `LongPressing` is produced since 2026-10-10: `Canvas.LongPressTimeMs` 1500 held still, no Tapped after it), multi-touch pinch, `SoftLock`, `AddGestures` attached props, `OnGestures` delegate | skipped | The enum members exist for parity and are never produced; there is no pinch member at all. Ported instead of skipped: velocity (`Gestures.ts` fills `Distance.Velocity` per move, the scroll / snapping physics run on it) and transform-aware mapping โ€” a child receives the point through the inverse `RenderTransformMatrix` (`TransformPointToLocalSpace`), so rotated / scaled / translated controls hit-test correctly. `ChildOffset` stays zero because that inverse matrix replaces the C# cache-offset math (`TranslateInputCoords`), not because transforms are missing. `Wheel` IS produced (`Canvas.onWheel`). |
13
+ | Gestures: `Pointer` (routed as a gesture; hover itself is ported, see `ReceivesHover`; `LongPressing` is produced since 2026-10-10: `Canvas.LongPressTimeMs` 1500 held still, no Tapped after it), `SoftLock`, `AddGestures` attached props, `OnGestures` delegate | skipped | The enum members exist for parity and are never produced. Multi-touch is ported: a Panning while two or more fingers are down carries `Manipulation` (AppoMobi ManipulationInfo: pinch scale, turn, center, totals, finger count) and a press that had a second finger is no tap. Ported instead of skipped: velocity (`Gestures.ts` fills `Distance.Velocity` per move, the scroll / snapping physics run on it) and transform-aware mapping โ€” a child receives the point through the inverse `RenderTransformMatrix` (`TransformPointToLocalSpace`), so rotated / scaled / translated controls hit-test correctly. `ChildOffset` stays zero because that inverse matrix replaces the C# cache-offset math (`TranslateInputCoords`), not because transforms are missing. `Wheel` IS produced (`Canvas.onWheel`). |
14
14
  | C# multi-subscriber `event`s | changed shape | One callback per event prop (`Tapped={fn}`), same names. `Command*` (ICommand) variants not ported. |
15
15
  | `Opacity`, `TranslationX/Y`, `Rotation`, `ScaleX/Y` (+`Scale`), `SkewX/Y`, `RotationX/Y/Z`, `TranslationZ`, `AnchorX/Y`, `HasTransform`, `RenderTransformMatrix`, `TransformPointToLocalSpace` | ported | Same matrix order as C# `ApplyTransforms` (pivot โ†’ rotation โ†’ scale/skew โ†’ 3D โ†’ translation; 3D = C# `Create3dMatrix`, camera 576 px, TranslationZ as depth), image caches drawn smooth once the final matrix distorts them (C# `WillDrawDistorted`, a picture holding image blits records again when its playback turns distorted or straight), opacity = `saveLayer` alpha over the subtree, gestures mapped through the inverse matrix (`IsGestureForChild`, child receives the local point), accessibility rect = transformed bounds. Animations: `AnimateAsync`, `AnimateRangeAsync`, `FadeToAsync`, `ScaleToAsync`, `TranslateToAsync`, `RotateToAsync` as Promises with `AbortSignal` (one running per kind, like the C# per-property cancellation). Not ported: `Perspective1/2`, `CameraAngle`, `LinkTransforms`, `AddTranslationX/Y`, `UseTranslation*` overrides, `CustomizeLayerPaint`, `SkipRenderingOutOfBounds`. |
16
16
  | `Left` / `Top` | ported (as a translate) | Same paint-time offset in points, but folded into the render matrix (a `canvas.translate`, hit-testing follows) for every control, cached or not; C# applies them only when blitting a cache. |
@@ -29,7 +29,7 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
29
29
  | `LockRatio` | ported | Same as C#: a single set `WidthRequest`/`HeightRequest` drives both sides (`CalculateSizeRequest`), otherwise the constraints are locked with `SmartMax`/`SmartMin` ร— \|ratio\| (sign decides larger/smaller side, infinite side loses). |
30
30
  | `HorizontalFillRatio`/`VerticalFillRatio` | ported | Applied at arrange like C# `DefineAvailableSize` (the Fill box is scaled, alignment stays inside the full box); measure is not affected (C# passes `useModifiers=false` there too). |
31
31
  | `ZIndex` | ported | Static children of a layout are drawn in ZIndex order (stable for equal values), gestures go to the top-most first; the sorted list is cached until a child or a ZIndex changes (C# `GetOrderedSubviews`). Templated cells keep index order. |
32
- | `FillGradient`, `SkiaShape.StrokeGradient` | ported | `SkiaGradient` as a plain object: `Type` Linear (Start/End ratios or CSS `Angle`), Circular / Conical (radius = half the smaller side), Oval (radial scaled to the box), Sweep (around the center, `Value1`/`Value2` angles), `ColorPositions`, `TileMode`, `Light` (< 1 darker, > 1 lighter โ€” HSL lightness, C# uses `MakeDarker/MakeLighter`, exact curve unverified), `Opacity`, `BlendMode`; C# `SetupGradient` paint setup (white base); shaders cached per gradient object and rect (C# `Version` cache: a new React literal replaces the old shaders). `SkiaLabel.FillGradient` paints the glyphs (`GradientByLines` default true = per line bounds, false = the text block) and the background only when `BackgroundColor` is set, like the C# label override. `SkiaLabel` text stroke (`StrokeColor`, `StrokeWidth` points, `StrokeGradient`) and drop shadow (`DropShadowColor`, `DropShadowSize`, `DropShadowOffsetX/Y`) in the C# order shadow โ†’ stroke โ†’ fill, measurement inflated by stroke ร— 2 and shadow size + offset like C#. Not ported: `Background` MAUI brushes, `FillBlendMode`. |
32
+ | `FillGradient`, `SkiaShape.StrokeGradient` | ported | `SkiaGradient` as a plain object: `Type` Linear (Start/End ratios or CSS `Angle`), Circular / Conical (radius = half the smaller side), Oval (radial scaled to the box), Sweep (around the center, `Value1`/`Value2` angles), `ColorPositions`, `TileMode`, `Light` (< 1 darker: red, green and blue ร— `Light`, as C# `MakeDarker`; > 1 lighter: HSL lightness ร— `Light`, clamped, hue and saturation kept, as .NET MAUI `AddLuminosity` and C# f77136c4), `Opacity`, `BlendMode`; C# `SetupGradient` paint setup (white base); shaders cached per gradient object and rect (C# `Version` cache: a new React literal replaces the old shaders). On a `SkiaLabel` it goes to one place (C# 9637994b): the background when the label has a `BackgroundColor` (its text keeps `TextColor`), else the glyphs. `SkiaLabel.FillGradient` paints the glyphs (`GradientByLines` default true = per line bounds, false = the text block) and the background only when `BackgroundColor` is set, like the C# label override. `SkiaLabel` text stroke (`StrokeColor`, `StrokeWidth` points, `StrokeGradient`) and drop shadow (`DropShadowColor`, `DropShadowSize`, `DropShadowOffsetX/Y`) in the C# order shadow โ†’ stroke โ†’ fill, measurement inflated by stroke ร— 2 and shadow size + offset like C#. Not ported: `Background` MAUI brushes, `FillBlendMode`. |
33
33
  | `SkiaShell` | partial (React-level) | `Routes` (route -> JSX page factory), `GoToAsync(route, animated)` / `GoBackAsync(animated)` / `PopToRootAsync` with the SkiaViewSwitcher slide (`PagesAnimationSpeed` 200 ms, pushed pages opaque over the page below, lower pages hidden when idle), `NavigationStack`, `CanGoBack`, `Route`, nav bar with Back + title, `useShell()`; `OpenPopupAsync(content, { animated, closeWhenBackgroundTapped, showOverlay, backgroundColor })` (C# PopupWrapper: dimmed backdrop, scale 0.5โ†’1 + fade over `PopupsAnimationSpeed`, tap outside the content closes), `ClosePopupAsync`, `CloseAllPopups`; `PushModalAsync(content, { useGestures, animated, freezeBackground })` (C# ModalWrapper: full-screen `SkiaDrawer` FromBottom HeaderSize 0, drag-to-close with `useGestures`), `PopModalAsync`; `ShowToast(text | content, ms)` (C# layout: bottom banner, slide + fade 300/250 ms, `ShellDefaults.Toast*`), `CloseAllToasts`; `PopupsCount`/`ModalsCount`/`ToastsCount`; `ShellDefaults` = the C# statics (`PopupBackgroundColor`, `PopupsBackgroundBlur`, `PopupsAnimationSpeed`, `PopupsCancelAnimationsAfterMs`, `ZIndex*`, `Toast*`, tab colors); popups/modals sit on a `SkiaBackdrop` (blur + tint); `Tabs` (C# SkiaViewSwitcher tabs: bottom tab bar, per-tab page stacks, `SelectedTab`, `SelectTabAsync`, `PopTabToRootAsync`); `GoBackAsync` follows C# `GoBackDefault` (top popup, then modal, then page); React extension `UseBrowserHistory` (default true): pages in the URL hash `#/a/b`, one history entry per page / popup / modal, browser Back unwinds in the same order, deep links restore the page stack. Not ported: engine-level shell / `NavigationLayout` view switcher, frozen-screenshot backgrounds, `pixelsScaleInFrom`, `Navigating`/`Navigated`/`RouteChanged` events, `RegisterRoute` by type with arguments, `IHandleGoBack`, insets, `PushAsync(page instance)`; `AnimateTabs` + `TabsAnimationSpeed` (150) ported with the C# SelectLeftTab/SelectRightTab slide (0.75 width, fade, back-ease 0.55) โ€” only the tab roots animate, pages pushed inside the leaving tab drop instantly. Browser history: a `popstate` at the same depth with another hash (a plain `<a href="#/route">` link, a typed hash) rebuilds the stack like a forward navigation. |
34
34
  | Styles / `ConfigureStyles` | ported | `Super.UseDrawnUi().ConfigureStyles(styles => styles.AddStyle({ TargetType, ApplyToDerivedTypes, Setters }))`, the C# `Style` shape with the `Setter` list written as a plain object (`Setters: { FontFamily: "FontText" }`) because controls hold plain properties instead of BindableProperty. Per-class resolution cached, base-type styles applied furthest-first so the nearest wins, exact type last (C# `ResolveStylesForType`). Applied by the reconciler between `new` and the JSX props, so props override; a control built in code-behind is styled on its first `Measure` and keeps values that differ from its class defaults (the React stand-in for C# `ExplicitPropertiesSet`, which needs BindableProperty). Not ported: `BasedOn`, `Class`, `Triggers`, `Behaviors`, the per-control `Style` property, `ConditionalStyle`. |
35
35
  | Animators core: `AnimatorBase` / `SkiaValueAnimator` / `RenderingAnimator` (`IOverlayEffect`), `Canvas.RegisterAnimator`/`AnimatingControls`, `PostAnimators` + `ExecutePostAnimators`, `Easing` (Linear/Cubic*) | ported | Frame-driven: a running animator keeps frames coming, idle canvas draws nothing. An animator started before its control is attached waits in `PendingUnattachedAnimators` and starts on the control's first arrange (C# starts it in `SuperViewChanged`). Frame time = the frame's vsync timestamp, see PARITY "Animators run on vsync time". |
@@ -55,6 +55,7 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
55
55
  | `ContextMenu` (right click / long press / Menu key, React extension) | ported (web-only) | `SkiaControl.ContextMenu` / `Canvas.ContextMenu` handlers with `ContextMenuEventArgs` (`Location` points, `Pixels`, `Local` px in the control, `Source`, `Native`); the DOM `contextmenu` event is routed like a tap (`ProcessContextMenu`: visible non-transparent children top-most first through `TransformPointToLocalSpace`, then the control, then the canvas). `true` = handled, browser menu suppressed; nothing handled = browser menu. Not in DrawnUi.Net. |
56
56
  | Tooltips (`SkiaControl.Tooltip`, `Super.TooltipsFromAccessibility`, `TooltipStyle`) | ported | drawnui-cross 6ar: shows after `ShowDelayMs` on the innermost control with tooltip text, the next one at once within `FollowWindowMs`; attached to the control (centered 6 pt above, below where there is no room) or `AtCursor`, `OffsetX` / `OffsetY`, anchored on screen now, kept inside the canvas; closes on leave, press, wheel, key, content moving under the pointer and window blur, never on touch; no hover, no accessibility node; `CreateTooltip` for custom content. Drawn in the canvas only (a browser page has no windows past its edge). |
57
57
  | Popup windows (`Canvas.OpenPopupWindow` / `ClosePopupWindow` / `ClosePopupWindows` / `IsPopupWindowOpen`, `PopupAnchor`, `PopupWindowOptions`, `PopupWindowClosed`) | ported | drawnui-cross 6at, the DrawnUi.Rust / .NET API (C# names): anchor a point, a rect or a control (below it, flipped where it does not fit, kept inside); drawn over everything, given input and hover first; closes on a press outside (the rest of that press goes nowhere), Escape, the wheel outside, window blur and from code; options `Size`, `CloseOnPointerLeave`, `Passive`; `OnCanvas` / `Cpu` accepted, always on the canvas. React extra: `OpenPopupWindow(canvas, jsx, anchor, options)` renders JSX content and unmounts it on close. |
58
+ | `AccessibilityModal`, `Canvas.ArrowsStartKeyboardNavigation` | ported | drawnui-cross 6av, C# 6e87c9ae / 914428d2 / 981ff09e / 86467ece / 77d1dca4 / 6aee5c51: a shown modal limits screen readers and Tab to its subtree plus popup windows (topmost wins), reads as a dialog with its name, takes the keyboard when it appears with the keyboard in use and gives it back when it goes; the flat overlay's container is the dialog (role, name, aria-modal). With nothing focused (or only a control behind the modal) and the canvas option on, an arrow starts keyboard navigation. SkiaShell popups and modals are such dialogs (the popup wrapper is no Tab stop). Live regions are read on the next frame. |
58
59
  | Keyboard navigation (drawnui-cross 6c) | ported | Through the accessibility overlay, the DrawnUi.Blazor way: Tab / Shift+Tab walk the interactive nodes in reading order, Enter / Space activate (`SkiaAccessibilityManager.Activate`), ArrowLeft / Right / Up / Down, Home / End, PageUp / PageDown go to the focused control first (`OnAccessibilityKey`, `SkiaAccessibilityManager.Key`: `SkiaSlider` steps, `SkiaEditor` keeps them while editing), then to its arrow-key group (`MoveInGroup`). A container with a composite role (`Aria.IsCompositeRole`: list, listbox, grid, toolbar, radiogroup, tablist, menu, menubar) is one Tab stop (roving tabindex, `IsTabStop`, entered on the item focused last); the arrows move by item index (Column: Up / Down, Row: Left / Right, Wrap / Grid / Split: all four, Up / Down by a row), no wrap, items not realized are scrolled in with `ScrollToIndex` and focused once drawn (`OnKeyboardFocusRequested`). `SkiaEditor` is a Tab stop: Tab in takes the caret, Tab / Shift+Tab leave it for the next node (also after a click into it). Focus ring = the overlay element's `:focus-visible` outline; focus scrolls the node into view in every enclosing scroll. Not ported: `FocusedChild` / canvas `KeyboardFocusNode`, Escape leaving the drawn nodes, a canvas-drawn focus ring. |
59
60
  | Canvas draw events | ported | `WillFirstTimeDraw` (once, right before the first frame drawn on a ready surface, with that frame's `{ Canvas, Surface }`), `WasDrawn` (after every frame, no context, like the C# `null`), `WasRendered` (set after the first frame completes, so the first `WasDrawn` still sees `false`, C# order), `CanRender` (surface ready). JSX: `<Canvas WillFirstTimeDraw WasDrawn>`; the engine draws frame 1 in its constructor, so the component hands both callbacks to the constructor's `init`. Not ported: `WillDraw`. |
60
61
  | Rendering stats | partial | `Canvas.FPS` (frames drawn over the last second) and `Canvas.FrameTime` (ms of the last measure + arrange + render, GPU flush excluded) are computed every frame and reachable from React through the `<Canvas>` ref. `SkiaLabelFps` ported (label on top, input-transparent, parent-independent, re-measures itself on draw; its value changes only on frames that running animators request, see PARITY). Not ported: `SkiaLabelFps.ForceRefresh` / `Format` / `MonoForDigits`, `Super.EnableRenderingStats`. |
@@ -77,11 +78,11 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
77
78
  | `SkiaLabel` | partial | Word wrap (+ character break for long words), `MaxLines` with tail ellipsis, `LineBreakMode` (NoWrap / wraps / Tail; Head/Middle behave as Tail), `HorizontalTextAlignment` Start/Center/End, Start and End following each paragraph's direction (a right-to-left paragraph starts at the right; Fill* accepted, not stretched, placed at the paragraph's start), `VerticalTextAlignment`, `LineSpacing`, `LineHeight`, `FontWeight` + `FontAttributes` via faces registered per weight (`AddFont(src, alias, weight)`, nearest weight wins, synthetic bold (`setEmbolden`) when the nearest face is lighter than 600 โ€” C# `Font.Embolden`; italic = synthetic skew when no italic face; empty `FontFamily` = the first registered family, weights included), `TextTransform`, `Padding`, `LinesCount`; text measured with unhinted (linear) advances, the same widths as DrawnUi.Rust on every platform; ink past a line's ends (italic slant, a glyph's negative side bearing such as the hook of "j") is kept by every cache type (drawing room only, widths unchanged); defaults as C# (`FontSize` 12, `TextColor` GreenYellow). `FontFamilyFallback` ported and extended: comma-separated chain (`"FontSymbols,FontSymbols2"`), per-codepoint run segmentation, spaces always stay on the main font; `fonts.AddSymbols()` (`FontSymbols` = Noto Sans Math subset, `FontSymbols2` = Noto Sans Symbols 2 subset) and `fonts.AddEmojis()` (`FontEmoji` = Noto Color Emoji subset: faces, hands, skin tones and the demo emoji) ship the same subsets as DrawnUi.Blazor. A joiner, variation selector, skin tone, keycap or tag keeps the font of the glyph before it (C# JoinsPreviousGlyph). Text shaping where the text needs it (C# `UnicodeNeedsShaping` ranges plus Hebrew, Arabic supplements and emoji sequence characters): Arabic joins, Indic conjuncts and marks, emoji sequences as one glyph, through the CanvasKit paragraph module already in the build (HarfBuzz + ICU, no extra wasm); other text keeps the plain glyph-by-glyph path. Right-to-left lines: runs cut where the bidirectional level changes (ICU levels; the paragraph direction from its first strong letter, explicit embeddings reported as their direction only) and placed in visual order (rule L2). A space keeps the style of the span it was written in; where two spans meet with a space each, both stay (C#). `Spans` ported as `<TextSpan>` children: `Text`, `TextColor`/`FontSize`/`FontFamily` (unset = inherit from the label, like C# HasSetColor/HasSetSize/HasSetFont), `FontWeight`, `IsBold`, `IsItalic`, `Underline`/`UnderlineWidth`, `Strikeout`/`StrikeoutWidth`/`StrikeoutColor` (Red default), `BackgroundColor`, `Tapped` + `ForceCaptureInput` (hit-tested through per-fragment `Rects`, ripple on the label, `OnSpanTapped` overridable), mixed sizes on one line share a baseline. TextSpan not ported: `ParagraphColor`, `CommandTapped`, per-span `LineSpacing`/`LineHeight`, `AutoFindFont`, `DrawingOffset`. `CharacterSpacing` (C#: (value - 1) points after every glyph, measured, wrapped and cut at the drawn width), Chinese / Japanese line breaks between characters with kinsoku (C# FitAtBreak, `CanBreakInsideWord`). Text `StrokeColor`/`StrokeWidth`/`StrokeGradient`, `DropShadow*` and `GradientByLines` ported (C# DrawText order). Not ported: `AutoFont`, `AutoSize`/`AutoSizeText`, `MonoForDigits`, `KeepSpacesOnLineBreaks` (accepted, no effect), `Format`, hyphenation, |
78
79
  | `SkiaHotspot` | ported | Fill/Fill, `Tapped`, `Down`, `Up`, `LockPanning`, `TouchDown`; consumes only Tapped like the C# one. No `AnimationTapped`/ripple/shimmer. |
79
80
  | `SkiaButton` | partial | Default look only: rounded frame radius 8 (hardcoded like the C# default content), centered label, `Text`/`TextColor`/`FontSize`/`FontFamily`/`BackgroundColor`/`IsPressed`/`RespondsToGestures` (`IsDisabled` = its obsolete opposite)/`LockPanning`, `Tapped`/`Down`/`Up`. `RespondsToGestures = false`: no press, no `Tapped`/`Down`/`Up`, a press or tap on it stops there, keyboard skips it, reported disabled (drawnui-cross 6w). `IsPressed` is tracked but has no visual; press feedback = `ApplyEffect="Ripple"`. No `ButtonStyle` platform looks, icons, `TextCase`, elevation, shimmer, `BtnText`/`BtnShape` templating. |
80
- | `SkiaImage` | partial | Effects ported: `AddEffect` (BlackAndWhite/Grayscale, Pastel, Sepia, InvertColors, Tint + `ColorTint`/`EffectBlendMode`, Darken, Lighten, Contrast, Saturation, Brightness, TSL, Gamma โ‰ˆ linear fit โ€” CanvasKit has no table color filter), `Blur` (image filter, mirror tile), `ZoomX/ZoomY`, `HorizontalOffset/VerticalOffset`; C# color matrices use 0..255 translations, CanvasKit 0..1 โ€” converted. `HSL` (hue from `Gamma`, `Saturation`, `Brightness`, tint blend), `Custom` = your own `PaintColorFilter` (C# public fields `PaintColorFilter` / `PaintImageFilter`, the latter replaces `Blur`), `ImageBitmap` (decoded image shared, not owned), `LoadPriority` of the queued `Source` load. Not ported: `UseGradient`/`StartColor`/`EndColor`, sprites, `InflateAmount`, `EraseChangedContent`, `RescaleSource`/`RescalingQuality`. `Source` (URL), `Aspect` (all `TransformAspect` values; `Tile` is a no-op like C#, tiling is `SkiaImageTiles`, same `RescaleAspect` math), `HorizontalAlignment`/`VerticalAlignment`, `Success`/`Error`, `IsLoading`, `LoadedSource`, `DisplayRect`, `AspectScale`; overflow clipped to the box. Not ported: `LoadSourceOnFirstDraw`, `PreviewBase64`, `ImageBitmap`/`LoadedImageSource`, `RescaleSource`/`CacheRescaledSource`/`RescalingQuality`, all adjustments (`Brightness`โ€ฆ`Blur`, `ColorTint`, gradient, `Zoom*`, offsets), sprites, `DrawWhenEmpty`, `EraseChangedContent`, `UseAssembly`. Measure: bounded box taken as is, unbounded axis from source aspect; no `NeedAutoWidth/Height` from Start alignment. |
81
+ | `SkiaImage` | partial | Effects ported: `AddEffect` (BlackAndWhite, Grayscale (the 0.21 / 0.72 / 0.07 weights, as C# Grayscale2), Pastel, Sepia, InvertColors, Tint + `ColorTint`/`EffectBlendMode`, Darken, Lighten, Contrast, Saturation, Brightness, TSL, Gamma โ‰ˆ linear fit โ€” CanvasKit has no table color filter), `Blur` (image filter, mirror tile), `ZoomX/ZoomY`, `HorizontalOffset/VerticalOffset`; C# color matrices use 0..255 translations, CanvasKit 0..1 โ€” converted. `HSL` (hue from `Gamma`, `Saturation`, `Brightness`, tint blend), `Custom` = your own `PaintColorFilter` (C# public fields `PaintColorFilter` / `PaintImageFilter`, the latter replaces `Blur`), `ImageBitmap` (decoded image shared, not owned), `LoadPriority` of the queued `Source` load. Not ported: `UseGradient`/`StartColor`/`EndColor`, sprites, `InflateAmount`, `EraseChangedContent`, `RescaleSource`/`RescalingQuality`. `Source` (URL), `Aspect` (all `TransformAspect` values; `Tile` repeats the image at its natural size from the aligned copy, as C#, same `RescaleAspect` math), `HorizontalAlignment`/`VerticalAlignment`, `Success`/`Error`, `IsLoading`, `LoadedSource`, `DisplayRect`, `AspectScale`; overflow clipped to the box. Not ported: `LoadSourceOnFirstDraw`, `PreviewBase64`, `ImageBitmap`/`LoadedImageSource`, `RescaleSource`/`CacheRescaledSource`/`RescalingQuality`, all adjustments (`Brightness`โ€ฆ`Blur`, `ColorTint`, gradient, `Zoom*`, offsets), sprites, `DrawWhenEmpty`, `EraseChangedContent`, `UseAssembly`. Measure: bounded box taken as is, unbounded axis from source aspect; no `NeedAutoWidth/Height` from Start alignment. |
81
82
  | `SkiaImageManager` | partial | `Instance.LoadImageAsync(url, signal)` (direct), `LoadImageManagedAsync(url, signal, priority)` through the priority queue (High > Normal > Low, `MaxParallelLoads` 5 in flight like the C# semaphore, one fetch per url serves every requester), `PreloadImage` / `PreloadImages(urls, priority)`, `CancelAll`, `GetFromCache`, `CanReload` callback on failure, `QueuedCount` / `RunningCount`, `ReuseBitmaps`, `Clear()`; in-memory cache of decoded images only. No `CacheLongevitySecs` eviction, no platform loaders, no `LoadImageOnlineAsync` retry policy, no `ImageSource` types (urls only). |
82
83
  | `SkiaImageTiles` | ported | `TileWidth` / `TileHeight` (points, nothing drawn until set), `TileAspect` (AspectCover), `TileOffsetX` / `TileOffsetY` (wrap), `TileCacheType` (Image) for the inner tile `SkiaImage` sharing the decoded source, clipped to bounds. |
83
- | `SkiaSvg` | partial | Inline `SvgString` without `xmlns` gets it injected (browsers refuse to decode an `<img>` SVG without it, SkiaSharp does not care) โ€” the C# check-mark markup relies on that. `Source` (URL) / `SvgString`, `Aspect` (default `AspectFitFill`, uses the shared `RescaleAspect` math, not SkiaSvg's own matrix path), alignments, `TintColor` (SrcIn), `Success`/`Error`, `IsLoading`, `DisplayRect`. Rendering: browser decodes the SVG, rasterized at the displayed pixel size and cached per size (CanvasKit npm has no SVG module). Not ported: shadows, FontAwesome duotone colors, `FillGradient`, `Zoom*`/offsets/`InflateAmount`, `IconFilePath`/embedded resources, `UseCache=Operations` default (no caching yet). |
84
- | `SkiaScroll` | partial | `Orientation` Vertical/Horizontal/Both/Neither (Neither: pans never move the viewport, the wheel is not consumed so a parent scroll may take it; programmatic `ScrollTo` still works), single `Content`, `ViewportOffsetX/Y` (points, <= 0), pan with the C# 0.85 delta interpolation, fling on the DrawnUi deceleration curve (`FrictionScrolled`, `ChangeVelocityScrolled`, `MaxVelocity`, edge-cut duration), rubber-band overscroll (`Bounces`, `RubberEffect`) + spring bounce (`RubberDamping`, `MaxBounceVelocity`), mouse wheel (`WheelLineSize` per notch, an event moving by its share of a notch: `Canvas.WheelDeltaPerNotch` 100 CSS px after `deltaMode` lines x 40 / pages x 800, dominant axis, as the C# browser heads; `AutoScrollingSpeedMs` glide for a notch, an event under half a notch moves at once (touchpads, see PARITY); events accumulate onto the running move's exact target, and a restarted glide starts at the event so a fast swipe moves on every frame; `Wheel.IsHorizontal`: a vertical scroll leaves horizontal events, a horizontal scroll takes both, C# ba03cb20), `ScrollTo`/`ScrollToTop`/`ScrollToBottom`/`StopScrolling`, `Scrolled`, `IgnoreWrongDirection`, `RespondsToGestures`, `IsUserPanning`/`IsScrolling`, `ContentSize`, `ContentOffsetBounds`, `OverScrolled`. `Header` / `Footer` (JSX children with `Tag="Header"` / `Tag="Footer"`; the header scrolls in the flow, `HeaderSticky` pins it at the viewport start drawn over the content, `HeaderBehind` draws it under the content, `HeaderParallaxRatio` (1 = with the content, 0.5 = half speed), `ParallaxOverscrollEnabled`, `ContentOffset` between a behind / sticky header and the content; both add to the scroll extent), scroll bars (`ScrollBarsVisibility` None / Vertical / Horizontal / Both creating default `SkiaScrollBar`s, `ScrollBar` / `ScrollBarHorizontal` custom `IScrollBar` controls via `Tag="ScrollBar"` / `"ScrollBarHorizontal"`, `ScrollBarThumbColor` / `ScrollBarTrackColor`; `SkiaScrollBar`: `Dock`, `ThumbColor`, `TrackColor`, `Thickness` 4, `EdgeMargin` 2, `MinThumbSize` 32, `AutoHide` + `HideDelaySecs` 1 + `HideDurationSecs` 0.25, thumb squashed on overscroll, `IsDraggable` + `GrabPadding` 8: the scroll takes a gesture that starts on the bar from down to up, thumb drag keeps the grab point, a track press jumps the thumb under the pointer, the content gets neither the pan nor the tap; a custom `IScrollBar` opts in by implementing `IsDraggable` / `BeginDrag` / `GetDragProgress`; bars are parent-independent (C# `IsParentIndependent`): a thumb resize invalidates the bar alone and the scroll re-measures it on draw, nothing above re-measures), pull to refresh (`RefreshEnabled`, `RefreshCommand` callback, `IsRefreshing` two-way, `RefreshDistanceLimit` 150, `RefreshShowDistance` 50, `RefreshIndicator` `IRefreshIndicator` control via `Tag="RefreshIndicator"`; `RefreshIndicator` base: `Orientation`, `SetDragRatio` slides the view in with the pull and parks it at RefreshShowDistance, `IsRunning` + `OnIsRunningChanged`, `VisibleRatio`), `SnapToChildren` Center / Side after a fling or a release (`Snap`, `CheckNeedToSnap`), `TrackIndexPosition` Start / Center / End + `TrackIndexPositionOffset` reporting `CurrentIndex` / `CurrentIndexChanged`. `ScrollToIndex` Start / Center / End as an open order (C# OrderedScrollToIndex): a row not measured yet is gone to by the estimate and aimed again every frame until its place is measured and the viewport stands on it; a press, the wheel or another scroll drops it; LoadMore waits while it is open. Controls outside the clip are skipped with their subtree (C# stack Virtualisation, for every control; see PARITY). Not ported: zoom (`ViewportZoom`, `ZoomLocked`), `ReverseGestures` (inverted chat), keyboard adaptation, `ResetScrollPositionOnContentSizeChanged`, `ScrollType`, `ScrollingEnded` event, `LottieRefreshIndicator`, virtualization hooks (`Virtualisation`, `UseVirtual`, windowed content bounds); the C# refresh-indicator position curve is replaced by a linear slide-in. |
84
+ | `SkiaSvg` | partial | Inline `SvgString` without `xmlns` gets it injected (browsers refuse to decode an `<img>` SVG without it, SkiaSharp does not care) โ€” the C# check-mark markup relies on that. `Source` (URL) / `SvgString`, `Aspect` (default `AspectFitFill`, uses the shared `RescaleAspect` math, not SkiaSvg's own matrix path; `Tile` repeats the picture at its natural size, one SVG unit per point, from the aligned copy), alignments, `TintColor` (SrcIn), `Success`/`Error`, `IsLoading`, `DisplayRect`. Rendering: browser decodes the SVG, rasterized at the displayed pixel size and cached per size (CanvasKit npm has no SVG module). Not ported: shadows, FontAwesome duotone colors, `FillGradient`, `Zoom*`/offsets/`InflateAmount`, `IconFilePath`/embedded resources, `UseCache=Operations` default (no caching yet). |
85
+ | `SkiaScroll` | partial | Own size as C#: a side without a request that is not `Fill` takes the content's size, up to the space given. `Orientation` Vertical/Horizontal/Both/Neither (Neither: pans never move the viewport, the wheel is not consumed so a parent scroll may take it; programmatic `ScrollTo` still works), single `Content`, `ViewportOffsetX/Y` (points, <= 0), pan with the C# 0.85 delta interpolation, fling on the DrawnUi deceleration curve (`FrictionScrolled`, `ChangeVelocityScrolled`, `MaxVelocity`, edge-cut duration), rubber-band overscroll (`Bounces`, `RubberEffect`) + spring bounce (`RubberDamping`, `MaxBounceVelocity`), mouse wheel (`WheelLineSize` per notch, an event moving by its share of a notch: `Canvas.WheelDeltaPerNotch` 100 CSS px after `deltaMode` lines x 40 / pages x 800, dominant axis, as the C# browser heads; `AutoScrollingSpeedMs` glide for a notch, an event under half a notch moves at once (touchpads, see PARITY); events accumulate onto the running move's exact target, and a restarted glide starts at the event so a fast swipe moves on every frame; `Wheel.IsHorizontal`: a vertical scroll leaves horizontal events, a horizontal scroll takes both, C# ba03cb20), `ScrollTo`/`ScrollToTop`/`ScrollToBottom`/`StopScrolling`, `Scrolled`, `IgnoreWrongDirection`, `RespondsToGestures`, `IsUserPanning`/`IsScrolling`, `ContentSize`, `ContentOffsetBounds`, `OverScrolled`. `Header` / `Footer` (JSX children with `Tag="Header"` / `Tag="Footer"`; the header scrolls in the flow, `HeaderSticky` pins it at the viewport start drawn over the content, `HeaderBehind` draws it under the content, `HeaderParallaxRatio` (1 = with the content, 0.5 = half speed), `ParallaxOverscrollEnabled`, `ContentOffset` between a behind / sticky header and the content; both add to the scroll extent), scroll bars (`ScrollBarsVisibility` None / Vertical / Horizontal / Both creating default `SkiaScrollBar`s, `ScrollBar` / `ScrollBarHorizontal` custom `IScrollBar` controls via `Tag="ScrollBar"` / `"ScrollBarHorizontal"`, `ScrollBarThumbColor` / `ScrollBarTrackColor`; `SkiaScrollBar`: `Dock`, `ThumbColor`, `TrackColor`, `Thickness` 4, `EdgeMargin` 2, `MinThumbSize` 32, `AutoHide` + `HideDelaySecs` 1 + `HideDurationSecs` 0.25, thumb squashed on overscroll, `IsDraggable` + `GrabPadding` 8: the scroll takes a gesture that starts on the bar from down to up, thumb drag keeps the grab point, a track press jumps the thumb under the pointer, the content gets neither the pan nor the tap; a custom `IScrollBar` opts in by implementing `IsDraggable` / `BeginDrag` / `GetDragProgress`; bars are parent-independent (C# `IsParentIndependent`): a thumb resize invalidates the bar alone and the scroll re-measures it on draw, nothing above re-measures), pull to refresh (`RefreshEnabled`, `RefreshCommand` callback, `IsRefreshing` two-way, `RefreshDistanceLimit` 150, `RefreshShowDistance` 50, `RefreshIndicator` `IRefreshIndicator` control via `Tag="RefreshIndicator"`; `RefreshIndicator` base: `Orientation`, `SetDragRatio` slides the view in with the pull and parks it at RefreshShowDistance, `IsRunning` + `OnIsRunningChanged`, `VisibleRatio`), `SnapToChildren` Center / Side after a fling or a release (`Snap`, `CheckNeedToSnap`), `TrackIndexPosition` Start / Center / End + `TrackIndexPositionOffset` reporting `CurrentIndex` / `CurrentIndexChanged`. `ScrollToIndex` Start / Center / End as an open order (C# OrderedScrollToIndex): a row not measured yet is gone to by the estimate and aimed again every frame until its place is measured and the viewport stands on it; a press, the wheel or another scroll drops it; LoadMore waits while it is open. Controls outside the clip are skipped with their subtree (C# stack Virtualisation, for every control; see PARITY). Not ported: zoom (`ViewportZoom`, `ZoomLocked`), `ReverseGestures` (inverted chat), keyboard adaptation, `ResetScrollPositionOnContentSizeChanged`, `ScrollType`, `ScrollingEnded` event, `LottieRefreshIndicator`, virtualization hooks (`Virtualisation`, `UseVirtual`, windowed content bounds); the C# refresh-indicator position curve is replaced by a linear slide-in. |
85
86
  | `SkiaShape` (+ `SkiaFrame`) | partial | `BevelType` Bevel / Emboss + `Bevel` (`Depth`, `LightColor`, `ShadowColor`, `Opacity`; C# `PaintBevelEffect` edge paths for Rectangle, rounded Rectangle, Circle/Ellipse, Polygon, Path via ContourMeasure halves). `Shadows` (`SkiaShadow` X/Y/Blur/Opacity/Color/ShadowOnly, plain literals accepted): fill painted once per shadow with a DropShadow image filter (C# `PaintWithShadowsInternal`), hollow shapes clip their outline away so only the outside shadow remains; caches record the effects margin (`3ยทBlurยทscale ยฑ offset`, C# `MergeShadowMargin`) via `ComputeEffectsMargin`/`ExpandedCacheRect`. Not ported: `PlatformShadow` (MAUI `Shadow` brush), `ExpandDirtyRegion`, bevel/emboss. `Type` Rectangle/Circle/Ellipse/Arc (`Value1` start, `Value2` sweep)/Polygon+Line (`Points` ratios)/Path (`PathData`, fitted + centered), `CornerRadius` (uniform or per-corner), `StrokeWidth` (points, negative = px) drawn inside the bounds, `StrokeColor`, `StrokeCap`, `ClipBackgroundColor`, children laid out inside the stroke and clipped to the shape, `CreateClip` = shape, `FillGradient` fill, `UseCache=Operations` default. Not ported: `Squricle`, `Custom`, `SmoothPoints`, `StrokePath` (dashes), `StrokeGradient`, `StrokeBlendMode`, sub-1px stroke compensation, `MeasuredStrokeAware*` exposure, `LayoutChildren` override hook. |
86
87
  | `SkiaButton` | partial | Now a `SkiaLayout` hosting a `SkiaShape` frame (`Tag="BtnShape"`) + `SkiaLabel` (`Tag="BtnText"`), sized from the label + Padding; `CornerRadius` (default 8), `StrokeColor`/`StrokeWidth`, `BackgroundColor`, text props, `ApplyEffect`, `Tapped`/`Down`/`Up`. Still no `ButtonStyle` looks, icons, `TextCase`, elevation, shimmer, custom templating through tags. |
87
88
  | `SnappingLayout` | ported | `Animated`, `RespondsToGestures`, `IgnoreWrongDirection`, `Bounces`, `RubberDamping`, `RubberEffect`, `AutoVelocityMultiplyPts`, `SnapDistanceRatio`, `SnapPoints`, `CurrentPosition`, `CurrentSnap`, `ContentOffsetBounds`, `IsUserPanning`/`IsUserFocused`, `InTransition`, `Scrolled`/`TransitionChanged`/`Stopped`, `ClampOffset` (rubber), `FindNearestAnchor`, `SelectNextAnchor` (dot product), `ScrollToNearestAnchor`, `ScrollToOffset` (spring `Spring(1+RubberDamping, 200, 0.5ยท(1+RubberDamping))` when `Bounces`, else 0.1โ€“0.8 s from velocity). The settled state is reported when the snap animation stops (C# relies on `ApplyPosition` ticks). Not ported: `AnimatorSpring` reuse, `SnapDistanceRatio` for non-carousel layouts, hover. |
@@ -60,6 +60,8 @@ export declare class AnimatedFramesRenderer extends SkiaControl {
60
60
  protected OnFinished(): void;
61
61
  protected OnStarted(): void;
62
62
  protected ApplySpeed(): void;
63
+ /** Play time of `durationMs` at SpeedRatio: duration / SpeedRatio, 0 or below = normal speed (C# GetPlaybackDurationMs). */
64
+ protected GetPlaybackDurationMs(durationMs: number): number;
63
65
  protected ApplyDefaultFrame(): void;
64
66
  protected OnDisposing(): void;
65
67
  }
@@ -136,6 +136,8 @@ export class AnimatedFramesRenderer extends SkiaControl {
136
136
  OnFinished() { this.Finished?.(this); }
137
137
  OnStarted() { this.Started?.(this); }
138
138
  ApplySpeed() { }
139
+ /** Play time of `durationMs` at SpeedRatio: duration / SpeedRatio, 0 or below = normal speed (C# GetPlaybackDurationMs). */
140
+ GetPlaybackDurationMs(durationMs) { return this.SpeedRatio > 0 ? durationMs / this.SpeedRatio : durationMs; }
139
141
  ApplyDefaultFrame() { if (!this.IsPlaying && this.Animator)
140
142
  this.Seek(this.defaultFrame); }
141
143
  OnDisposing() {
@@ -14,7 +14,11 @@ export declare class DrawnGame extends SkiaLayout {
14
14
  private readonly onKeyDown;
15
15
  private readonly onKeyChar;
16
16
  private readonly onKeyUp;
17
- constructor();
17
+ private keysOn;
18
+ /** The game gets keys while it is on a canvas: from its first layout there until it leaves it. */
19
+ private ListenToKeys;
20
+ protected OnLayoutChanged(): void;
21
+ OnLeftCanvas(): void;
18
22
  protected OnDisposing(): void;
19
23
  protected OnResumed(): void;
20
24
  protected OnPaused(): void;
@@ -1,6 +1,7 @@
1
1
  import { ActionOnTickAnimator } from "../core/Animators";
2
2
  import { KeyboardManager } from "../core/KeyboardManager";
3
3
  import { SkiaLayout } from "./SkiaLayout";
4
+ import { CanvasLeaveWatchers } from "../core/SkiaControl";
4
5
  /**
5
6
  * Mirrors DrawnUi.Gaming DrawnGame (SharedGame/DrawnGame.cs + Game.Input.cs): a layout that runs a game loop.
6
7
  * `StartLoop()` / `StopLoop()`, override `GameLoop(deltaSeconds)` for the game and `OnKeyDown` / `OnKeyUp` for keys
@@ -15,12 +16,29 @@ export class DrawnGame extends SkiaLayout {
15
16
  onKeyDown = (key) => this.OnKeyDown(key);
16
17
  onKeyChar = () => { };
17
18
  onKeyUp = (key) => this.OnKeyUp(key);
18
- constructor() {
19
- super();
20
- KeyboardManager.Subscribe(this.onKeyDown, this.onKeyChar, this.onKeyUp);
19
+ keysOn = false;
20
+ /** The game gets keys while it is on a canvas: from its first layout there until it leaves it. */
21
+ ListenToKeys(on) {
22
+ if (on === this.keysOn)
23
+ return;
24
+ this.keysOn = on;
25
+ if (on) {
26
+ KeyboardManager.Subscribe(this.onKeyDown, this.onKeyChar, this.onKeyUp);
27
+ CanvasLeaveWatchers.add(this);
28
+ }
29
+ else {
30
+ KeyboardManager.Unsubscribe(this.onKeyDown, this.onKeyChar, this.onKeyUp);
31
+ CanvasLeaveWatchers.delete(this);
32
+ }
21
33
  }
34
+ OnLayoutChanged() {
35
+ super.OnLayoutChanged();
36
+ if (!this.keysOn && this.Superview)
37
+ this.ListenToKeys(true);
38
+ }
39
+ OnLeftCanvas() { this.ListenToKeys(false); }
22
40
  OnDisposing() {
23
- KeyboardManager.Unsubscribe(this.onKeyDown, this.onKeyChar, this.onKeyUp);
41
+ this.ListenToKeys(false);
24
42
  this.appLoop?.Dispose();
25
43
  this.appLoop = undefined;
26
44
  super.OnDisposing();
@@ -118,7 +118,7 @@ export declare class SkiaCarousel extends SnappingLayout {
118
118
  private SelectNextAnchorInternal;
119
119
  /** C# FixIndex: a virtual anchor becomes the real one, the position keeps its offset (visually identical, looped drawing wraps). */
120
120
  private FixIndex;
121
- private FixPosition;
121
+ protected FixPosition(): void;
122
122
  protected OnTransitionChanged(): void;
123
123
  protected ScaleSnapVelocity(velocity: SKPoint): SKPoint;
124
124
  protected CreateSnapSpring(): Spring;
@@ -236,6 +236,26 @@ export class SkiaCarousel extends SnappingLayout {
236
236
  ScrollToNearestAnchor(location, velocity) {
237
237
  const t = this.SnapVelocityThreshold;
238
238
  velocity = new SKPoint(Math.abs(velocity.X) < t ? 0 : velocity.X, Math.abs(velocity.Y) < t ? 0 : velocity.Y);
239
+ const home = this.releaseHome;
240
+ if (this.ApplyLoopedLogic && home && this.SnapPoints.length > 1) {
241
+ // a finger release on a looped carousel: one slide at most from the slide the gesture started on, counted along the
242
+ // strip, so across the edge it is the virtual slot next to it. A flick goes one slide its way, a slow drag to the
243
+ // nearest of that slide and its two neighbours. Measured from the slide nearest the release instead, a drag past
244
+ // the middle went the wrong way at the wrap (C# 11196529)
245
+ const step = new SKPoint(this.SnapPoints[1].X - this.SnapPoints[0].X, this.SnapPoints[1].Y - this.SnapPoints[0].Y);
246
+ const stepAxis = this.IsVertical ? step.Y : step.X;
247
+ if (stepAxis !== 0) {
248
+ const vel = this.IsVertical ? velocity.Y : velocity.X;
249
+ const moved = this.IsVertical ? location.Y - home.Y : location.X - home.X;
250
+ const k = vel !== 0 ? Math.sign(vel) * Math.sign(stepAxis) : Math.max(-1, Math.min(1, Math.round(moved / stepAxis)));
251
+ const target = new SKPoint(home.X + step.X * k, home.Y + step.Y * k);
252
+ if (SnappingLayout.Dist(location, target) >= 0.5)
253
+ this.ScrollToOffset(target, velocity, this.CanAnimate);
254
+ else
255
+ this.UpdateReportedPosition();
256
+ return;
257
+ }
258
+ }
239
259
  if (this.ApplyLoopedLogic) {
240
260
  const origin = this.FindNearestAnchorInternal(location, velocity);
241
261
  const target = this.SelectNextAnchor(origin, velocity);
@@ -305,9 +325,17 @@ export class SkiaCarousel extends SnappingLayout {
305
325
  /** C# FixIndex: a virtual anchor becomes the real one, the position keeps its offset (visually identical, looped drawing wraps). */
306
326
  FixIndex() {
307
327
  if (this.IsLooped && this.SnapPoints.length > 1 && this.selectedIndex >= 0 && this.selectedIndex < this.SnapPoints.length) {
308
- const snap = this.GetVirtualAnchor(this.CurrentPosition);
309
- const ox = this.CurrentPosition.X - snap.Location.X, oy = this.CurrentPosition.Y - snap.Location.Y;
310
- const real = this.SnapPoints[this.selectedIndex];
328
+ // the offset is measured from the anchor that stands for the selected slide where the position is now: the slide
329
+ // itself or its virtual copy past an edge. From the nearest anchor of another slide it moved a wrap in progress (the
330
+ // last slide 3% toward the first) onto another pair (C# b75f233a)
331
+ const real = this.SnapPoints[this.selectedIndex], last = this.MaxIndex;
332
+ let anchor = real;
333
+ for (const v of this.GetVirtualSnapPoints()) {
334
+ const standsFor = v.Id === this.selectedIndex || (v.Id === -1 && this.selectedIndex === last) || (v.Id === -2 && this.selectedIndex === 0);
335
+ if (standsFor && SnappingLayout.Dist(v.Location, this.CurrentPosition) < SnappingLayout.Dist(anchor, this.CurrentPosition))
336
+ anchor = v.Location;
337
+ }
338
+ const ox = this.CurrentPosition.X - anchor.X, oy = this.CurrentPosition.Y - anchor.Y;
311
339
  this.CurrentSnap = real;
312
340
  this.CurrentPosition = new SKPoint(real.X + ox, real.Y + oy);
313
341
  }
@@ -556,8 +584,11 @@ export class SkiaCarousel extends SnappingLayout {
556
584
  consumed = passToChildren();
557
585
  if (consumed === this)
558
586
  consumed = null;
559
- if (consumed && !(args.Type === "Up" && this.snapIfNoPanOnUp))
587
+ if (consumed && !(args.Type === "Up" && this.snapIfNoPanOnUp)) {
588
+ if (args.Type === "Up")
589
+ this.IsUserFocused = false; // the finger left, also when a slide took the tap (C# dbf507fd)
560
590
  return consumed;
591
+ }
561
592
  }
562
593
  if (!this.RespondsToGestures || this.ChildrenTotal < 2)
563
594
  return consumedDefault;
@@ -635,6 +666,7 @@ export class SkiaCarousel extends SnappingLayout {
635
666
  this.IsUserPanning = false;
636
667
  this.snapIfNoPanOnUp = false;
637
668
  }
669
+ this.IsUserFocused = false; // every Up ends the finger's hold, a tap included (C# dbf507fd)
638
670
  break;
639
671
  }
640
672
  if (consumed || this.IsUserPanning)
@@ -29,6 +29,13 @@ export declare class SkiaDrawer extends SnappingLayout {
29
29
  constructor();
30
30
  get IsOpen(): boolean;
31
31
  set IsOpen(v: boolean);
32
+ /**
33
+ * The drawer starts moving from open to closed (IsOpen = false, a swipe release, code): raised once the move is under
34
+ * way, before it ends (C# internal ClosingStarted; SkiaShell takes a modal out of its stack here).
35
+ */
36
+ ClosingStarted?: (sender: SkiaDrawer) => void;
37
+ private headingOpen;
38
+ protected ScrollToOffset(target: SKPoint, velocity: SKPoint, animate: boolean): boolean;
32
39
  Open(): void;
33
40
  Close(): void;
34
41
  get Horizontal(): boolean;
@@ -44,5 +51,11 @@ export declare class SkiaDrawer extends SnappingLayout {
44
51
  private ReportFromSnap;
45
52
  CheckTransitionEnded(): boolean;
46
53
  ProcessGestures(args: SkiaGesturesParameters, apply: GestureEventProcessingInfo): SkiaControl | null;
54
+ /**
55
+ * A Down stops a running move to a snap, so a pan can take the drawer from where it is. When the touch ends without a
56
+ * pan, the drawer finishes that move to the snap it was sent to (IsOpen changed in code, or a released swipe), instead
57
+ * of staying between its snaps (C# FinishStoppedMove).
58
+ */
59
+ private FinishStoppedMove;
47
60
  protected DefaultAccessibilityLabel(): string | undefined;
48
61
  }
@@ -35,6 +35,23 @@ export class SkiaDrawer extends SnappingLayout {
35
35
  if (this.SnapPoints.length === 2)
36
36
  this.ScrollToOffset(v ? this.SnapPoints[0] : this.SnapPoints[1], SKPoint.Empty, this.Animated && this.wasDrawn);
37
37
  }
38
+ /**
39
+ * The drawer starts moving from open to closed (IsOpen = false, a swipe release, code): raised once the move is under
40
+ * way, before it ends (C# internal ClosingStarted; SkiaShell takes a modal out of its stack here).
41
+ */
42
+ ClosingStarted;
43
+ // the state of the snap the drawer was last sent to; IsOpen catches up with it when the move ends (C# _headingOpen)
44
+ headingOpen = false;
45
+ ScrollToOffset(target, velocity, animate) {
46
+ const wasHeadingOpen = this.headingOpen;
47
+ if (!super.ScrollToOffset(target, velocity, animate))
48
+ return false;
49
+ const hidden = this.SnapPoints[1];
50
+ this.headingOpen = this.SnapPoints.length < 2 || target.X !== hidden.X || target.Y !== hidden.Y;
51
+ if (wasHeadingOpen && !this.headingOpen)
52
+ this.ClosingStarted?.(this);
53
+ return true;
54
+ }
38
55
  Open() { this.IsOpen = true; }
39
56
  Close() { this.IsOpen = false; }
40
57
  get Horizontal() { return this.Direction === "FromLeft" || this.Direction === "FromRight"; }
@@ -108,14 +125,15 @@ export class SkiaDrawer extends SnappingLayout {
108
125
  const consumedDefault = this.BlockGesturesBelow ? this : null;
109
126
  const scale = this.RenderingScale;
110
127
  const e = args.Event;
111
- // the drawer sits in a full-size layer: touches outside its (translated) box are not ours
112
- const local = apply.MappedLocation;
113
- const hit = this.HitIsInside(local.X + apply.ChildOffset.X, local.Y + apply.ChildOffset.Y);
128
+ // touches outside its content are not ours, also when the drawer is larger than the panel it slides (C# hitContent:
129
+ // CheckChildGestureHit(Content)); a press there closes it with AutoClose
130
+ const point = new SKPoint(apply.MappedLocation.X + apply.ChildOffset.X, apply.MappedLocation.Y + apply.ChildOffset.Y);
131
+ const hitContent = this.GetGestureListeners().some((c) => c.IsVisible && !c.InputTransparent && this.IsGestureForChild(c, point));
114
132
  if (!this.hadDown && args.Type !== "Up") {
115
- if (!hit) {
116
- if (this.AutoClose && this.isOpen && !this.InTransition)
133
+ if (!hitContent) {
134
+ if (this.AutoClose && this.isOpen && !this.InTransition && (args.Type === "Down" || args.Type === "Tapped"))
117
135
  this.IsOpen = false;
118
- return null;
136
+ return consumedDefault; // a drawer that blocks gestures below still does (C# OnSkiaGestureEvent)
119
137
  }
120
138
  }
121
139
  let passed = false;
@@ -192,8 +210,10 @@ export class SkiaDrawer extends SnappingLayout {
192
210
  }
193
211
  case "Up": {
194
212
  this.hadDown = false;
195
- if (this.childWasTapped || !this.IsUserPanning)
213
+ if (this.childWasTapped || !this.IsUserPanning) {
214
+ this.FinishStoppedMove();
196
215
  break;
216
+ }
197
217
  const final = this.velocityAccumulator.CalculateFinalVelocity(3000);
198
218
  const v = this.Horizontal ? new SKPoint(final.X, 0) : new SKPoint(0, final.Y);
199
219
  this.CurrentSnap = this.CurrentPosition;
@@ -210,5 +230,18 @@ export class SkiaDrawer extends SnappingLayout {
210
230
  return passToChildren();
211
231
  return consumedDefault;
212
232
  }
233
+ /**
234
+ * A Down stops a running move to a snap, so a pan can take the drawer from where it is. When the touch ends without a
235
+ * pan, the drawer finishes that move to the snap it was sent to (IsOpen changed in code, or a released swipe), instead
236
+ * of staying between its snaps (C# FinishStoppedMove).
237
+ */
238
+ FinishStoppedMove() {
239
+ const target = this.CurrentSnap, at = this.CurrentPosition;
240
+ if (this.IsSnapAnimating || !this.SnapPoints.some((p) => p.X === target.X && p.Y === target.Y)
241
+ || (Math.abs(at.X - target.X) <= 1 && Math.abs(at.Y - target.Y) <= 1))
242
+ return;
243
+ this.CurrentSnap = at;
244
+ this.ScrollToOffset(target, SKPoint.Empty, this.CanAnimate);
245
+ }
213
246
  DefaultAccessibilityLabel() { return this.isOpen ? "Drawer open" : "Drawer closed"; }
214
247
  }
@@ -1,4 +1,4 @@
1
- import type { DrawingContext, SkiaControl } from "../core/SkiaControl";
1
+ import { type DrawingContext, type SkiaControl } from "../core/SkiaControl";
2
2
  import { type GestureEventProcessingInfo, type SkiaGesturesParameters } from "../core/Gestures";
3
3
  import { type PrebuiltControlStyle } from "../core/ControlStyle";
4
4
  import { type Color, type DrawTextAlignment, type ReturnType, ScaledSize, type SkiaEditorKeyboard, type SkiaGradient, type TextAlignment } from "../core/Types";
@@ -180,6 +180,8 @@ export declare class SkiaEditor extends SkiaShape {
180
180
  PasteFromClipboard(): void;
181
181
  private ReplaceSelection;
182
182
  private SetFocusNative;
183
+ /** Removed from the canvas while focused: the editing ends (caret timer, keys, text proxy). */
184
+ OnLeftCanvas(): void;
183
185
  private OnKeyDown;
184
186
  StubTypeText(value: string): void;
185
187
  StubPressEnter(splitLine?: boolean, shift?: boolean): void;
@@ -1,3 +1,4 @@
1
+ import { CanvasLeaveWatchers } from "../core/SkiaControl";
1
2
  import { SKPoint } from "../core/Gestures";
2
3
  import { Super } from "../core/Super";
3
4
  import { DefaultAccent, ResolveControlStyle } from "../core/ControlStyle";
@@ -723,12 +724,16 @@ export class SkiaEditor extends SkiaShape {
723
724
  KeyboardManager.Subscribe(this.onKeyDown, this.onKeyChar);
724
725
  KeyboardManager.BlurExternalTextInput();
725
726
  TextInputProxy.Attach(this);
727
+ CanvasLeaveWatchers.add(this);
726
728
  }
727
729
  else {
728
730
  TextInputProxy.Detach(this);
729
731
  KeyboardManager.Unsubscribe(this.onKeyDown, this.onKeyChar);
732
+ CanvasLeaveWatchers.delete(this);
730
733
  }
731
734
  }
735
+ /** Removed from the canvas while focused: the editing ends (caret timer, keys, text proxy). */
736
+ OnLeftCanvas() { this.IsFocused = false; }
732
737
  OnKeyDown(key, e) {
733
738
  const shift = KeyboardManager.IsShiftPressed, ctrl = KeyboardManager.IsControlPressed, alt = KeyboardManager.IsAltPressed;
734
739
  const handled = () => e.preventDefault();
@@ -45,6 +45,10 @@ export declare class SkiaGif extends AnimatedFramesRenderer {
45
45
  protected OnAnimatorInitializing(): void;
46
46
  protected ApplySpeed(): void;
47
47
  protected CheckCanStartAnimator(): boolean;
48
+ /** Shows a frame by index, negative = last frame (C# ShowFrame). */
49
+ protected ShowFrame(frame: number): void;
50
+ /** Shows DefaultFrame (a frame index, -1 = last) when not playing. */
51
+ protected ApplyDefaultFrame(): void;
48
52
  SetAnimation(animation: GifAnimation, disposePrevious: boolean): void;
49
53
  ReloadSource(): void;
50
54
  /** Loads (does not apply) a GIF; C# LoadSource. */
@@ -131,9 +131,20 @@ export class SkiaGif extends AnimatedFramesRenderer {
131
131
  if (!this.Animation || !this.Animator)
132
132
  return;
133
133
  const d = this.Animation.DurationMs;
134
- this.Animator.Speed = this.SpeedRatio < 1 ? d * (1 + this.SpeedRatio) : d / this.SpeedRatio;
134
+ this.Animator.Speed = this.GetPlaybackDurationMs(d);
135
135
  }
136
136
  CheckCanStartAnimator() { return (this.Animation?.TotalFrames ?? 0) > 0; }
137
+ /** Shows a frame by index, negative = last frame (C# ShowFrame). */
138
+ ShowFrame(frame) {
139
+ if (!this.Animation)
140
+ return;
141
+ this.Animation.SeekFrame(frame);
142
+ this.InvalidateCache();
143
+ this.RepaintComposition();
144
+ }
145
+ /** Shows DefaultFrame (a frame index, -1 = last) when not playing. */
146
+ ApplyDefaultFrame() { if (!this.IsPlaying && this.Animation)
147
+ this.ShowFrame(this.DefaultFrame); }
137
148
  SetAnimation(animation, disposePrevious) {
138
149
  if (!animation || animation === this.Animation)
139
150
  return;
@@ -143,7 +154,7 @@ export class SkiaGif extends AnimatedFramesRenderer {
143
154
  this.Stop();
144
155
  this.Animation = animation;
145
156
  this.InitializeAnimator();
146
- this.OnAnimatorSeeking(this.DefaultFrame);
157
+ this.ShowFrame(this.DefaultFrame);
147
158
  if (wasPlaying && !this.IsPlaying)
148
159
  this.Start();
149
160
  if (kill && disposePrevious)
@@ -72,4 +72,9 @@ export declare class SkiaImage extends SkiaControl {
72
72
  */
73
73
  protected MeasureAbsolute(widthConstraint: number, heightConstraint: number, scale: number): ScaledSize;
74
74
  protected Paint(ctx: DrawingContext): void;
75
+ private tileShader?;
76
+ private tileShaderKey?;
77
+ /** Repeat shader of the image placed at `display`, kept until the image or its placement changes (C# cached fill shader). */
78
+ private TileShader;
79
+ protected OnDisposing(): void;
75
80
  }