drawnui-react 0.1.0-preview.41 → 0.1.0-preview.43
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.
- package/README.md +89 -7
- package/SKIPPED.md +7 -7
- package/dist/controls/GridStructure.d.ts +9 -1
- package/dist/controls/GridStructure.js +41 -1
- package/dist/controls/SkiaEditor.d.ts +4 -1
- package/dist/controls/SkiaEditor.js +25 -6
- package/dist/controls/SkiaImage.d.ts +5 -0
- package/dist/controls/SkiaImage.js +32 -5
- package/dist/controls/SkiaLabel.d.ts +85 -4
- package/dist/controls/SkiaLabel.js +406 -20
- package/dist/controls/SkiaLabelFps.d.ts +0 -3
- package/dist/controls/SkiaLabelFps.js +1 -11
- package/dist/controls/SkiaLayout.js +33 -2
- package/dist/controls/SkiaScroll.d.ts +51 -2
- package/dist/controls/SkiaScroll.js +150 -9
- package/dist/controls/SkiaShape.d.ts +2 -0
- package/dist/controls/SkiaShape.js +7 -0
- package/dist/controls/SkiaShell.d.ts +282 -0
- package/dist/controls/SkiaShell.js +972 -0
- package/dist/controls/SkiaSprite.js +5 -1
- package/dist/core/Accessibility.d.ts +30 -13
- package/dist/core/Accessibility.js +237 -43
- package/dist/core/Canvas.d.ts +122 -14
- package/dist/core/Canvas.js +585 -47
- package/dist/core/Gestures.d.ts +11 -1
- package/dist/core/Gestures.js +12 -1
- package/dist/core/PopupWindows.js +2 -0
- package/dist/core/Props.d.ts +11 -0
- package/dist/core/Props.js +44 -0
- package/dist/core/ScrollAnimators.d.ts +6 -0
- package/dist/core/ScrollAnimators.js +7 -1
- package/dist/core/SkiaControl.d.ts +24 -4
- package/dist/core/SkiaControl.js +59 -13
- package/dist/core/SkiaEffect.d.ts +12 -1
- package/dist/core/SkiaEffect.js +35 -8
- package/dist/core/SkiaImageManager.d.ts +101 -18
- package/dist/core/SkiaImageManager.js +318 -63
- package/dist/core/Styles.js +7 -1
- package/dist/core/Super.d.ts +4 -0
- package/dist/core/Super.js +4 -9
- package/dist/core/TextInputProxy.d.ts +31 -1
- package/dist/core/TextInputProxy.js +97 -15
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/react/SkiaShell.d.ts +8 -74
- package/dist/react/SkiaShell.js +163 -514
- package/dist/react/index.d.ts +6 -1
- package/dist/react/index.js +51 -40
- package/dist/react/reconciler.d.ts +12 -0
- package/dist/react/reconciler.js +22 -46
- package/package.json +37 -4
package/README.md
CHANGED
|
@@ -49,6 +49,88 @@ property names, layout and drawing rules. What you learn here works there, and s
|
|
|
49
49
|
|
|
50
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.
|
|
51
51
|
|
|
52
|
+
## What's new in 0.1.0-preview.43
|
|
53
|
+
|
|
54
|
+
- **3D add-on:** [`drawnui-react-add3d`](https://www.npmjs.com/package/drawnui-react-add3d) puts real 3D inside the
|
|
55
|
+
drawn UI: glTF models with their animations, a product viewer that turns, zooms and resets, many animated
|
|
56
|
+
characters on a 2D field in one pass, shapes made in code, Lit, Toon and Flat looks. Live demo:
|
|
57
|
+
[add3dreact.drawnui.net](https://add3dreact.drawnui.net), article:
|
|
58
|
+
[drawnui.net/articles/add3d.html](https://drawnui.net/articles/add3d.html).
|
|
59
|
+
- **Text selection:** selectable labels (`AccessibilityTextSelectable`) select as in DrawnUi.Net, drawn in
|
|
60
|
+
`SkiaLabel.TextSelectionColor`: a mouse drag (across several labels, in reading order), a double click for a word, a
|
|
61
|
+
long press on touch with a Copy button; Ctrl+C copies, and the context menu sees the selection
|
|
62
|
+
(`canvas.SelectedText`, `CopyTextSelection()`, `ClearTextSelection()`).
|
|
63
|
+
- **Long press on touch:** a long press raises the context menu on phones and tablets too, in every browser; on
|
|
64
|
+
selectable text it selects the word first, or keeps the selection it presses on.
|
|
65
|
+
- **Long press time:** 0.75 s, the same in every DrawnUI engine; set it with `TouchEffect.LongPressTimeMsDefault`.
|
|
66
|
+
- **Text fields on phones:** a tap opens the on-screen keyboard at once, its return key ends editing in a single-line
|
|
67
|
+
field, and a keyboard the user closed stays closed while the page scrolls.
|
|
68
|
+
- **Fields above the keyboard:** `SkiaScroll.AdaptToKeyboardAuto` (opt-in, with `AdaptToKeyboardGap`) keeps the focused
|
|
69
|
+
field above the on-screen keyboard, the last field of a form too.
|
|
70
|
+
- **Double tap:** a double tap reaches the controls as two taps in iOS Safari too, and counts by when the taps
|
|
71
|
+
happened, so it holds while frames are busy (a 3D viewer's reset).
|
|
72
|
+
- **Screen readers:** the texts inside a button, radio, switch, tab or image are read once, as the control's name;
|
|
73
|
+
inside a scroll the reading and Tab order follow the content.
|
|
74
|
+
- **Password fields:** screen readers hear a password field's placeholder, never the typed text.
|
|
75
|
+
- **React 19.2:** the package declares React 19.2 or newer, the version its renderer runs on.
|
|
76
|
+
- **Right click in a text field:** a right click keeps the caret and the selection, so the context menu sees what was
|
|
77
|
+
selected.
|
|
78
|
+
- **Mouse wheel over text fields:** a focused text field no longer stops the mouse wheel: the page scrolls over the field
|
|
79
|
+
and around it.
|
|
80
|
+
- **Tab at typing speed:** Tab moves on at typing speed when focus scrolls the page.
|
|
81
|
+
- **Reading and Tab order:** the reading and Tab order of a page stays the same while it scrolls: Tab after the last
|
|
82
|
+
control comes back to the top.
|
|
83
|
+
- **Keyboard focus:** when the control with the keyboard focus disappears, the focus moves to the next control.
|
|
84
|
+
- **`FillBlendMode`** on controls and shapes.
|
|
85
|
+
- **Image loads:** a cancelled image load reports a cancel, as in DrawnUi.Net.
|
|
86
|
+
|
|
87
|
+
## What's new in 0.1.0-preview.42
|
|
88
|
+
|
|
89
|
+
- **Images:** images that show the same file or URL share one decoded copy; image memory stays within a budget
|
|
90
|
+
(`SkiaImageManager.CacheBudgetMb`, 128 MB by default), and the images no control shows go first. Cached images
|
|
91
|
+
refresh after 30 minutes or on `RemoveFromCache`, and an image stays on screen as long as a control shows it. The
|
|
92
|
+
image manager follows DrawnUi.Net: `ReuseBitmaps`, `UseCache`, retries of failed loads, `RegisterImage`,
|
|
93
|
+
`IsLoadingLocked`; `LoadImageAsync` is a direct load outside the cache.
|
|
94
|
+
- **Controls on a new canvas:** a control shown on a new canvas redraws its GPU and image caches there.
|
|
95
|
+
- **Changes during a cache recording:** a control that changes while a cached parent records it (shown from another
|
|
96
|
+
control's paint, or from an event raised as it draws) is drawn on the next frame.
|
|
97
|
+
- **Parent-independent controls:** a control marked `IsParentIndependent` lays itself out again in its own slot when its
|
|
98
|
+
content changes, so a live counter in a row shows every new value without laying out the row.
|
|
99
|
+
- **`End` in stacks:** a child with `End` in a row or column sits at the stack's end, as in DrawnUI for Rust (a button
|
|
100
|
+
after a text in a full-width row lines up on the right).
|
|
101
|
+
- **Zoom wheels:** `TouchActionEventArgs.Wheel.IsZoom` tells a Ctrl / Cmd + wheel or a touchpad pinch from a plain wheel.
|
|
102
|
+
- **Add-on packages:** `Registry` and `DrawnProps` let a separate package register its own JSX tags.
|
|
103
|
+
- **`SkiaShell` without React:** the shell is an engine control in `drawnui-react/core`: build it in code with
|
|
104
|
+
controls as pages, popups, modals and toasts. The JSX `<SkiaShell>` works as before on top of it.
|
|
105
|
+
- **Quiet console:** WebGL starts and comes back after a lost context without browser warnings, in Chromium and WebKit.
|
|
106
|
+
- **Dialogs for keyboard and screen readers:** an open dialog reads as one named dialog, the keyboard goes into it
|
|
107
|
+
(also when its buttons show a moment later) and comes back to the control that opened it when it closes, also
|
|
108
|
+
after one dialog hands over to another.
|
|
109
|
+
- **`Super.OpenLink` and `UpdateNonStop()`:** open an address in a new tab, and keep a self-animating control (a
|
|
110
|
+
time-driven shader, a clock) drawing every frame while it is shown, as in DrawnUi .NET.
|
|
111
|
+
- **Layout rules as in DrawnUI for .NET and Rust:** a Fill control with a size request keeps the requested size; a
|
|
112
|
+
layer without a size of its own fits its sized children, and an empty Fill background takes that size; Center with
|
|
113
|
+
unequal margins moves by the full margin difference.
|
|
114
|
+
- **Shader time:** `iTime` counts from the first shader frame, shared by every effect, so animated shaders stay smooth
|
|
115
|
+
however long the page has been open.
|
|
116
|
+
- **Screen readers and opacity:** a control faded to opacity 0 is left out of the screen-reader tree, like a hidden one,
|
|
117
|
+
and is read again when it shows.
|
|
118
|
+
- **Styles with code-behind:** a control built in code keeps every property the code set; a registered style fills in
|
|
119
|
+
only the rest.
|
|
120
|
+
- **Nested scrolls:** a drag that starts on an inner list already at its end scrolls the page around it, so a page full
|
|
121
|
+
of lists drags all the way to its end. The mouse wheel works the same way, as in browsers: one spin stays on the list
|
|
122
|
+
it started on, the next one moves the page.
|
|
123
|
+
- **Paragraph spacing:** text with line breaks gets a quarter line between paragraphs by default (`ParagraphSpacing`
|
|
124
|
+
0.25), as in DrawnUi .NET, and a growing editor (`AutoHeight`) fits each of its lines at its own height.
|
|
125
|
+
- **Line spacing from the font:** fonts with built-in leading keep it between lines (times `LineSpacing`), and
|
|
126
|
+
`LineHeightUniform` gives every line of a label the tallest line's height.
|
|
127
|
+
- **Text placed as in DrawnUi .NET:** label lines are whole pixels high and text sits on the same baseline as in
|
|
128
|
+
DrawnUi .NET; with `LineHeight` the extra space is shared above and below the text.
|
|
129
|
+
- **Sharp at any display scale:** the canvas matches the screen's device pixels exactly at fractional display scales,
|
|
130
|
+
so text and lines stay crisp.
|
|
131
|
+
- **Moving inside a composite cache:** a control moved by its translation inside an `ImageComposite` layer draws at its
|
|
132
|
+
new place right away.
|
|
133
|
+
|
|
52
134
|
## What's new in 0.1.0-preview.41
|
|
53
135
|
|
|
54
136
|
- **System light and dark:** `Canvas.SystemTheme` and `SystemThemeChanged` report the browser's light or dark appearance
|
|
@@ -218,13 +300,13 @@ label readable and every button focusable without touching each control.
|
|
|
218
300
|
The overlay has `pointer-events: none`, so hover and all pointer gestures still reach the canvas — the
|
|
219
301
|
Blazor "accessible control loses hover" limitation does not apply.
|
|
220
302
|
|
|
221
|
-
Text selection (
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
overlay
|
|
303
|
+
Text selection (opt-in, as DrawnUi.Net): `AccessibilityTextSelectable` on a `SkiaLabel` lets the user select and copy
|
|
304
|
+
its text, drawn by the label in `SkiaLabel.TextSelectionColor`. Mouse: drag (across several labels in reading order, a
|
|
305
|
+
drag held past a scroll's edge scrolls it), double click for a word; Ctrl+C / Cmd+C copies, a click elsewhere clears.
|
|
306
|
+
Touch: a long press selects a word and shows a drawn Copy button; drag to extend. A right click or a long press raises
|
|
307
|
+
the control's `ContextMenu` with the selection kept (`canvas.SelectedText`, `CopyTextSelection()`,
|
|
308
|
+
`ClearTextSelection()`). The label takes the mouse press for this, so keep it off on labels inside gesture-driven
|
|
309
|
+
controls. The overlay stays for screen readers and the keyboard only: nothing in it is ever selected in the DOM.
|
|
228
310
|
|
|
229
311
|
## Crawlers and AI agents: static HTML from the accessibility tree
|
|
230
312
|
|
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
|
|
13
|
+
| Gestures: `Pointer` (routed as a gesture; hover itself is ported, see `ReceivesHover`; `LongPressing` is produced: held still for `TouchEffect.LongPressTimeMsDefault` (AppoMobi name, 750 ms, settable; `Canvas.LongPressTimeMs` is its alias), 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. |
|
|
@@ -19,7 +19,7 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
|
|
|
19
19
|
| Disposal (`Dispose` / `OnDisposing`) | ported | The React renderer calls `Dispose()` when an element leaves the tree (`detachDeletedInstance`): caches, gradient shaders, running `*ToAsync` animations, overlay effects, the accessibility node, then the children (static and templated pool); `SkiaScroll`/`SnappingLayout` stop their animators, `SkiaSvg` drops its raster, `SkiaLottie`/`SkiaGif` free the Skottie animation / frames; `Canvas.Dispose` disposes the content. Not ported: `IsDisposing` staged disposal, `Disposing` event, `OnWillDisposeWithChildren`. |
|
|
20
20
|
| Hover: `ReceivesHover` (opt-in; on by default in SkiaButton, SkiaSlider, the toggles, SkiaRadioButton, SkiaCarousel, SkiaDrawer), `IsHovered`, `HoverChanged` (turns `ReceivesHover` on, as C# `OnHovered`) | ported | drawnui-cross 6m: every opted-in control under the mouse is hovered; nothing changes while a scroll, carousel or drawer moves its content, one check at the last pointer position when it stops and after an add / remove, a rebind, a hidden hovered control or an instant scroll jump; pointerleave clears at once; touch never hovers (`Canvas.Hover`, a `HoverManager`). Not ported: C# `SetHover`, `CheckHovered` / `OnHover` / `IsPointerOver` (no Pointer gestures are routed), SkiaSpinner / wheel picker (no such controls). |
|
|
21
21
|
| `KeyboardManager` | ported | Window-level keydown / keyup capture listeners like `drawnui-keyboard.js`: `KeyDown` / `KeyUp` with the DOM `event.code` ("KeyA", "ArrowLeft"; C# maps the same codes to `InputKey`), `KeyChar` for printable keys without Ctrl / Alt / Meta, `IsShiftPressed` / `IsControlPressed` / `IsAltPressed`, `AttachToKeyboard` (idempotent, pointerdown pulls window focus inside iframes), `BlurExternalTextInput`, `IsOwnedByElement` / `IsInputMethodKey` (React additions: a handler acting on keys skips keys a focused DOM element or the input method owns, C# 845b26e9); `Subscribe` / `Unsubscribe` instead of C# events. Not ported: `InputKey` enum (codes are strings). |
|
|
22
|
-
| `SkiaEditor` | partial | SkiaShape host with padding, content `SkiaLabel` (single-line: `HorizontalTextAlignment` Center / End get the field as the label's minimum width, so short text centers and long text still scrolls), placeholder label, caret (blinking 1 s, `CursorColor`, `CanShowCursor`) and selection overlay (`SelectionColor`) painted by the editor, single line (`MaxLines` 1, scrolls horizontally to the caret) / multiline (`MaxLines` != 1, `AutoHeight`) with own scroll offsets instead of the C# inner `SkiaScroll`; `Text` (line breaks normalized, spaces for single line), `PlaceholderText/Color/HorizontalAlignment`, `FontSize` (12) / `FontFamily` / `FontWeight` / `TextColor` / `TextGradient` / `LineHeight` / `Horizontal|VerticalTextAlignment`, `IsPassword` (bullets), `ReturnType` (Send submits multiline), `KeyboardType` / `IsSpellCheckEnabled` / `UseMarkdown` / `UseUnicode` accepted, `CursorPosition`, `SelectionLength`, `IsFocused` (one focused editor at a time), `ControlStyle` (C# `ApplyControlStyleVisuals` palettes over unset values), events `TextChanged` / `FocusChanged` / `CursorMoved` / `TextSubmitted`, `Submit` / `SelectAll` / `SetSelection` / `SelectWord` / `GetSelectedText` / `DeleteSelection` / `InsertAtCursor` / `CutSelection` / `CopySelection` / `PasteFromClipboard` (navigator.clipboard), the Blazor head stubs `StubTypeText` / `StubPressEnter` / `StubBackspace` / `StubDelete` (grapheme clusters via Intl.Segmenter) / `StubMoveCursor` / `StubSelectRange` / `StubSelectAll` / `HandleVerticalArrow`, Ctrl+A / C / X / V, Home / End, Escape blurs, tap places the caret, drag selects, long press selects a word, shift + tap extends. Keys come from `KeyboardManager` like the Blazor / Wasm heads; on top of that (not in DrawnUi.Blazor) a focused editor is mirrored by a hidden DOM textarea (`TextInputProxy`, `inputmode` from `KeyboardType`, `enterkeyhint` from `ReturnType`) so IME composition, the mobile soft keyboard, autocorrect and native paste / cut / undo reach the editor: every input event is diffed against the editor text and replayed through `StubSelectRange` + `StubTypeText` / `StubBackspace` / `StubPressEnter`; while the proxy holds DOM focus, Backspace / Delete / Enter / Ctrl+C / X / V key events are left to it.
|
|
22
|
+
| `SkiaEditor` | partial | SkiaShape host with padding, content `SkiaLabel` (single-line: `HorizontalTextAlignment` Center / End get the field as the label's minimum width, so short text centers and long text still scrolls), placeholder label, caret (blinking 1 s, `CursorColor`, `CanShowCursor`) and selection overlay (`SelectionColor`) painted by the editor, single line (`MaxLines` 1, scrolls horizontally to the caret) / multiline (`MaxLines` != 1, `AutoHeight`) with own scroll offsets instead of the C# inner `SkiaScroll`; `Text` (line breaks normalized, spaces for single line), `PlaceholderText/Color/HorizontalAlignment`, `FontSize` (12) / `FontFamily` / `FontWeight` / `TextColor` / `TextGradient` / `LineHeight` / `Horizontal|VerticalTextAlignment`, `IsPassword` (bullets), `ReturnType` (Send submits multiline), `KeyboardType` / `IsSpellCheckEnabled` / `UseMarkdown` / `UseUnicode` accepted, `CursorPosition`, `SelectionLength`, `IsFocused` (one focused editor at a time), `ControlStyle` (C# `ApplyControlStyleVisuals` palettes over unset values), events `TextChanged` / `FocusChanged` / `CursorMoved` / `TextSubmitted`, `Submit` / `SelectAll` / `SetSelection` / `SelectWord` / `GetSelectedText` / `DeleteSelection` / `InsertAtCursor` / `CutSelection` / `CopySelection` / `PasteFromClipboard` (navigator.clipboard), the Blazor head stubs `StubTypeText` / `StubPressEnter` / `StubBackspace` / `StubDelete` (grapheme clusters via Intl.Segmenter) / `StubMoveCursor` / `StubSelectRange` / `StubSelectAll` / `HandleVerticalArrow`, Ctrl+A / C / X / V, Home / End, Escape blurs, tap places the caret, drag selects, long press selects a word, shift + tap extends. Keys come from `KeyboardManager` like the Blazor / Wasm heads; on top of that (not in DrawnUi.Blazor) a focused editor is mirrored by a hidden DOM textarea (`TextInputProxy`, `inputmode` from `KeyboardType`, `enterkeyhint` from `ReturnType`) so IME composition, the mobile soft keyboard, autocorrect and native paste / cut / undo reach the editor: every input event is diffed against the editor text and replayed through `StubSelectRange` + `StubTypeText` / `StubBackspace` / `StubPressEnter`; while the proxy holds DOM focus, Backspace / Delete / Enter / Ctrl+C / X / V key events are left to it. On touch the field takes the keyboard inside the tap that focuses it (iOS opens it only then), and a touch elsewhere never reopens a keyboard the user closed. Not ported: `SkiaCursor` control + `CursorGradient`, `SkiaEditorSelection` handles, `Superview.FocusedChild`, `CommandOn*`, `SkiaEditorDocument` (rich formatting). Enter in a single-line field: the soft keyboard's return key (done / go / search / send) of a field focused by a tap ends editing and closes the keyboard, as a MAUI single-line field; a physical keyboard's Enter keeps the field focused, as DrawnUi.Blazor. Right-to-left and mixed text: a single-line field starts a right-to-left paragraph at its right edge; the caret, taps, Left / Right (visual moves) and the selection follow the screen, stops at grapheme boundaries (drawnui-cross 6ak, same rules as DrawnUi.Rust). |
|
|
23
23
|
| `SkiaSprite` / `SkiaSpriteSet` | ported | Sprite: `Source` (sheets cached per source, `CachedSpriteSheets`), `Columns` / `Rows` / `MaxFrames`, `FramesPerSecond` (24), `FrameSequence` / `AnimationName` + `CreateAnimationSequence` / `RegisteredAnimations`, `CurrentFrame`, `TotalFrames` / `DurationMs` / `FrameDurationMs` / `FrameWidth` / `FrameHeight`, `ApplyPlacementConfig` (units-per-pixel, size, anchor, offset = C# SpriteFrameImage ResolveFrameMetrics), transparent frame borders trimmed per frame (pixels read once), nearest sampling, AspectFit of the frame, `DisplayRect`, `Success` / `Error`, the AnimatedFramesRenderer playback. Set: `State`, `Define(state, source, columns, rows, fps, repeat, autoPlay, placement)`, `CurrentSprite`, `OnChangeState` hook, hit box from the drawn frame. Not ported: `Display` as a separate SkiaImage child (`SpriteFrameImage`) and the standalone `SkiaSprite(display)` ctor, `RescalingQuality` other than None, `InflateAmount`, `ClearCache` / `RemoveFromCache` (SkiaImageManager owns the images), `SkiaSpriteSet.InvalidateInternal`. Code-behind subclasses (FastRepro `WarriorSprite`) mount through a ref + `AddSubView` and are disposed by the mounting effect. |
|
|
24
24
|
| `IsClippedToBounds`, `ClipEffects` | ported | Clip to `DrawingRect` around content, children and post-animators; `ClipEffects=false` grows the clip by the aggregated effects margin so a child's shadow/glow can escape. Layouts aggregate their children's effects margins (C# `AggregatedEffectsMarginPixels`), cached per control and reset by `InvalidateMeasure`. Not ported: `Clipping` callback, `ClipWith`, `ClipFrom`, platform clips; C# currently ignores `ClipEffects` in its render path (always expands). |
|
|
25
25
|
| `Padding` on base `SkiaControl` | skipped | Only `SkiaLayout.Padding` exists. |
|
|
@@ -29,8 +29,8 @@ 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: 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
|
|
33
|
-
| `SkiaShell` | partial (React
|
|
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#. `FillBlendMode` (the background fill's blend mode; on a `SkiaShape` it also wins over the gradient's own, as C#). Not ported: `Background` MAUI brushes. |
|
|
33
|
+
| `SkiaShell` | partial | An engine control in `drawnui-react/core` (`new SkiaShell()`, `Routes` / `RootContent` / popups / modals / toasts take controls or factories, usable without React); the JSX `<SkiaShell>` is a thin wrapper over it that renders JSX content through portals. `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: `NavigationLayout` view switcher, frozen-screenshot backgrounds, `pixelsScaleInFrom`, `RegisterRoute` by type, `IHandleGoBack`, `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". |
|
|
36
36
|
| `ActionOnTickAnimator` | ported | Runs an action with the frame time on every frame until stopped. |
|
|
@@ -79,17 +79,17 @@ DrawnUi name and semantics; nothing here is a redesign, only an omission.
|
|
|
79
79
|
| `SkiaHotspot` | ported | Fill/Fill, `Tapped`, `Down`, `Up`, `LockPanning`, `TouchDown`; consumes only Tapped like the C# one. No `AnimationTapped`/ripple/shimmer. |
|
|
80
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. |
|
|
81
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. |
|
|
82
|
-
| `SkiaImageManager` |
|
|
82
|
+
| `SkiaImageManager` | ported | As DrawnUi.Net: `LoadImageManagedAsync(url, signal, priority)` caches and goes through the priority queue (High > Normal > Low, `MaxParallelLoads` 5 in flight, one fetch per source serves every requester); `LoadImageAsync(url, signal)` is a direct load outside the cache whose image the caller owns; `ReuseBitmaps` (on: every control on a source shares one decoded image; off: the cache keeps one copy and each caller gets a copy of its own, `GetFromCache` too); `CacheLongevitySecs` (1800) expiry; `CacheBudgetMb` (128, 0 = no limit) of decoded pixels, over it the images no control holds go, used longest ago first (DrawnUI for Rust trim), `Instance.CacheMemoryMb`, `Trim()`; `RemoveFromCache` / `ClearCache` / `AddToCache` / `UpdateInCache` / `GetFromCache` / `GetFromCacheInternal` never delete an image a control holds (`Hold` / `Free`, used by SkiaImage, SkiaSprite and shader-effect textures); keys case-insensitive, local paths normalized; `UseCache`; `EnableHttpRetry` (`HttpRetryMaxAttempts` 3); a failed load resolves to `undefined`; `RegisterImage`, `IsLoadingLocked` (turned off it raises `CanReload`), `HttpBaseAddress`, `IsOffline`; `PreloadImage(s)`, `CancelAll` (only loads waiting for a slot, they resolve to `undefined`). Cancels as the DrawnUi.Net Blazor head: a cached load, or one waiting for `IsLoadingLocked`, whose caller's signal aborts rejects with the abort (an `AbortError`, C# `OperationCanceledException`); with `UseCache` off a cancelled load resolves to `undefined`. |
|
|
83
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. |
|
|
84
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
|
+
| `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. The on-screen keyboard: `AdaptToKeyboardFor` / `AdaptToKeyboardSize` (an app moves a field above it) and the opt-in `AdaptToKeyboardAuto` (off by default, `AdaptToKeyboardGap` 8): the canvas reads the keyboard from the visual viewport, hands the focused field and the covered height to its nearest scroll with the setting, and that scroll gets the covered part as room at its content end while the keyboard is up (the last field rises too) and settles at the end when it closes. |
|
|
86
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. |
|
|
87
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. |
|
|
88
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. |
|
|
89
89
|
| `UseCache="ImageComposite"` / `ImageCompositeGPU`, `Left` / `Top` | ported | ImageComposite keeps its offscreen surface across records; a change deeper than a direct child (a color through props or a color setter = `UpdateDraw`, or `RepaintComposition`) is erased and redrawn by its area (drawnui-cross 6m: the control as drawn before and now, through every ancestor's transform; an effect or a backdrop on the way draws the child whole; a rect change, more than `MaxCompositionAreas` 16 areas or more than `MaxCompositionShare` 0.5 of the composite records whole; `LastCompositeRecord.Areas` / `Changed`; children outside the areas are not traversed); a child that calls `RepaintComposition` (transform / own repaint) is tracked as dirty by its composite ancestors (`TrackChildAsDirty`, `DirtyChildrenInternal`), the next record erases the dirty children's old + new transformed bounds plus the siblings they overlap and paints only those (`IsRenderingWithComposition`, layouts skip the rest); own content, a remeasure, a size / scale change record fully (`LastCompositeRecord` diagnostics). `Left` / `Top` on a cached control blit the cache at the offset without a matrix or save/restore (the translation is still set as `RenderTransformMatrix` so gestures / accessibility map through it); uncached controls keep the matrix path. Not ported: `ExpandDirtyRegion`, C# `CachedObject` surface reuse for plain `Image`. |
|
|
90
90
|
| `SkiaCarousel` | ported | Static `Children` or recycled `ItemsSource` + `ItemTemplate` cells (only visible + neighbour slides realized, `ReleaseExcept` for the looped non-contiguous set); `IsVertical`, `SidesOffset`, `Spacing`, `IsLooped` (virtual anchors -1/-2, wrap by `GoNext`/`GoPrev`/swipe at the borders, unbounded offset along the axis, edge slides drawn on the far side, `FixIndex` teleport after the wrap, `InterruptSnapping` strip shift), `PreloadNeighboors` (default true), `DynamicSize` (auto-sized axis follows the selected slide, re-measured on index change), `SwipeSpeed` (velocity ×SwipeSpeed/2, spring stiffness 200·SwipeSpeed, linear cap 0.25/speedK s, `SinOut`), `LinearSpeedMs` (one slide = LinearSpeedMs), `SelectedIndex` + `SelectedIndexChanged`, `LastIndex`, `MaxIndex`, `ChildrenTotal`/`ChildrenCount`, `IsAtStart`/`IsAtEnd`, `ScrollProgress`, `ScrollAmount`, `TransitionProgress`, `ItemAppearing`/`ItemDisappearing`, `Stopped`, `GoNext`/`GoPrev`/`ScrollTo(index, animate)`, C# gesture rules (velocity dead zone 100, clamp 500, snap-if-no-pan on Up, only the slides drawn on screen receive gestures). `IsRightToLeft` accepted (C# TODO). Not ported: `TransitionDirection`, `SafeIndex`, `ScrolledCommand`/`SelectedIndexChangedCommand`, `SelectedItem`, `CheckConstraints` exception, `OnTemplatesAvailable` background init, hover, pinch. |
|
|
91
91
|
| Templated `Row` / `Wrap` / `Grid`, `Split`, `SkiaDecoratedGrid` | ported | `ItemsSource` + `ItemTemplate` on any layout type: Column stays the virtualized list. Row / Wrap / Grid / a split Column follow `RecyclingTemplate` (drawnui-cross 6b): Enabled measures every item on pooled views (C# measures the structure on one template instance) and binds views only to the slots drawn, their views go back to the pool when the slot leaves the viewport (`VirtualisationInflated` widens it), every slot draws under a cache (C# `GetOnScreenVisibleArea`); Disabled keeps one view per item, never rebound. Changing `RecyclingTemplate` rebuilds the cells. `Split` (column count for Wrap and for a Column, which then lays out like a wrap with fixed slots; a templated Grid places item i at (i % Split, i / Split), `Invert` column-major), `SplitAlign` (true: fixed slot width), `DynamicColumns` (a short last row spreads over the width). `SkiaDecoratedGrid`: `HorizontalLine` / `VerticalLine` gradients painted in `RowSpacing` / `ColumnSpacing` under the children (C# defaults). Not ported: `SplitSpace` (C# TODO), `SplitMax`, `MeasureItemsStrategy` for non-Column templated layouts (every item is measured once per structure). |
|
|
92
|
-
| `AccessibilityTextSelectable`
|
|
92
|
+
| `AccessibilityTextSelectable` | ported | As DrawnUi.Net `SkiaLabel`: the label draws the selection (`TextSelectionColor`) and the Copy button of a touch selection (`CopyButtonText`); mouse drag, double click for a word, touch long press then drag, Ctrl+C / Ctrl+A, `SelectedText` / `SelectionStart` / `SelectionLength` / `Select` / `SelectAll` / `ClearSelection` / `CopySelection`; page selection across labels (`Canvas.SelectedText` / `CopyTextSelection` / `ClearTextSelection`, a drag held past a scroll's edge scrolls it); copies through `Super.SetClipboardText`. The overlay is for screen readers and the keyboard only. |
|
|
93
93
|
| `SkiaShaderCarousel` | ported | Only the selected slide takes gestures (C# `IsSlideHitTestable`): every slide sits on the same rect, so the topmost on-screen one used to catch every tap. `TransitionShader` (url), `TransitionShaderCode`, `TransitionTemplate`, `InterruptedTransitionMs` (50), `TransitionEffect` (`CreateTransitionEffect` factory), `TransitionFromIndex` / `TransitionToIndex`, `FromToChanged`; slides never move (`SlideOffset` hook), looped wrap rules, one gesture = at most one slide, interrupted transition wrapped up first, `RecyclingTemplate` Disabled; the carousel is cached as Image by default (React only, so the overlapping slides are never blitted). Slides MUST use `UseCache="Image"`. |
|
|
94
94
|
| `SkiaDrawer` | ported | `Direction` (FromBottom/Top/Left/Right), `HeaderSize`, `AmplitudeSize`, `AutoClose`, `IsOpen` + `IsOpenChanged`, `StateTransitionComplete`, `Open()`/`Close()`; moves itself with `TranslationX/Y` like C#, so it must be edge-aligned by the parent (`VerticalOptions="End"` for FromBottom); snap points `[open, hidden]` rebuilt on size change; gestures ported (children first, then vertical/horizontal drag, lock-bounce at the open edge, velocity clamp 3000, touches outside the box ignored / `AutoClose`). Not ported: `IsOpenCommand`, hover, the C# +1 px header quirk. |
|
|
95
95
|
| Everything else (`SkiaSwitch`, `SkiaCheckbox`, `SkiaSlider`, `SkiaProgress`, `SkiaCamera`, `SkiaMauiElement`, ...) | skipped | |
|
|
@@ -87,7 +87,15 @@ export declare class SkiaGridStructure {
|
|
|
87
87
|
private CompressStars;
|
|
88
88
|
private static ExpandStarsInSpan;
|
|
89
89
|
private static ZeroOutStars;
|
|
90
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Final measure pass (C# RemeasureChildrenAtFinalCells, 5acd8ae4), run once every track has its final size. Auto rows
|
|
92
|
+
* first, measured at their final width with the star rows yielding: an Auto column that got the grid's width only now
|
|
93
|
+
* (wrapped text, a wrap of buttons on several lines) can make its rows taller than the first pass did, and the star rows
|
|
94
|
+
* were already given the rest of the height. When an Auto row grew the star rows get what is left now, nothing when the
|
|
95
|
+
* Auto rows took it all. Then every visible child is measured at the cell it will be arranged in.
|
|
96
|
+
*/
|
|
91
97
|
RemeasureChildrenAtFinalCells(): void;
|
|
98
|
+
/** Measures the visible children at their cells (only those on single Auto rows when autoRowsOnly); true when an Auto row grew. */
|
|
99
|
+
private MeasureAtFinalCells;
|
|
92
100
|
}
|
|
93
101
|
export {};
|
|
@@ -417,15 +417,54 @@ export class SkiaGridStructure {
|
|
|
417
417
|
static ZeroOutStars(defs) { for (const d of defs)
|
|
418
418
|
if (d.IsStar)
|
|
419
419
|
d.Size = 0; }
|
|
420
|
-
/**
|
|
420
|
+
/**
|
|
421
|
+
* Final measure pass (C# RemeasureChildrenAtFinalCells, 5acd8ae4), run once every track has its final size. Auto rows
|
|
422
|
+
* first, measured at their final width with the star rows yielding: an Auto column that got the grid's width only now
|
|
423
|
+
* (wrapped text, a wrap of buttons on several lines) can make its rows taller than the first pass did, and the star rows
|
|
424
|
+
* were already given the rest of the height. When an Auto row grew the star rows get what is left now, nothing when the
|
|
425
|
+
* Auto rows took it all. Then every visible child is measured at the cell it will be arranged in.
|
|
426
|
+
*/
|
|
421
427
|
RemeasureChildrenAtFinalCells() {
|
|
428
|
+
if (this.Rows.some((r) => r.IsStar) && isFinite(this.heightConstraint)) {
|
|
429
|
+
const starSizes = this.Rows.map((r) => r.Size);
|
|
430
|
+
SkiaGridStructure.ZeroOutStars(this.Rows);
|
|
431
|
+
if (this.MeasureAtFinalCells(true)) {
|
|
432
|
+
if (this.heightConstraint - this.GridHeight() > 0)
|
|
433
|
+
this.ResolveStarRows(this.heightConstraint);
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
for (let n = 0; n < this.Rows.length; n++)
|
|
437
|
+
if (this.Rows[n].IsStar)
|
|
438
|
+
this.Rows[n].Size = starSizes[n];
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
this.MeasureAtFinalCells(false);
|
|
442
|
+
}
|
|
443
|
+
/** Measures the visible children at their cells (only those on single Auto rows when autoRowsOnly); true when an Auto row grew. */
|
|
444
|
+
MeasureAtFinalCells(autoRowsOnly) {
|
|
445
|
+
let autoRowGrew = false;
|
|
422
446
|
for (const cell of this.cells) {
|
|
423
447
|
const child = this.children[cell.ViewIndex];
|
|
424
448
|
if (!child.IsVisible)
|
|
425
449
|
continue;
|
|
450
|
+
if (autoRowsOnly && !this.SizesAutoRow(cell))
|
|
451
|
+
continue;
|
|
426
452
|
const rect = this.GetCellBoundsFor(child);
|
|
427
453
|
if (rect.Width <= 0 || rect.Height <= 0)
|
|
428
454
|
continue;
|
|
455
|
+
if (autoRowsOnly) {
|
|
456
|
+
// the height the row can grow to, as in MeasureKnownCells: unbounded for a vertical Fill child (it would take the
|
|
457
|
+
// whole constraint), the result held to the space the row can have
|
|
458
|
+
let grown = this.MeasurePx(child, rect.Width, this.HeightOnAutoRow(cell, child)).Height;
|
|
459
|
+
const available = this.AvailableHeight(cell);
|
|
460
|
+
if (isFinite(available) && grown > available)
|
|
461
|
+
grown = available;
|
|
462
|
+
if (grown > this.Rows[cell.Row].Size) {
|
|
463
|
+
this.Rows[cell.Row].Update(grown);
|
|
464
|
+
autoRowGrew = true;
|
|
465
|
+
}
|
|
466
|
+
continue;
|
|
467
|
+
}
|
|
429
468
|
// on an Auto row a child that is not Fill vertically keeps the height the row can grow to, as in
|
|
430
469
|
// MeasureKnownCells: the same request returns at once, and wrapped text is not cut to the row
|
|
431
470
|
const height = this.SizesAutoRow(cell) && !SkiaGridStructure.NeedFillY(child) ? Math.max(rect.Height, this.AvailableHeight(cell)) : rect.Height;
|
|
@@ -435,5 +474,6 @@ export class SkiaGridStructure {
|
|
|
435
474
|
if (cell.RowSpan === 1 && this.Rows[cell.Row].IsAuto && m.Height > this.Rows[cell.Row].Size)
|
|
436
475
|
this.Rows[cell.Row].Update(m.Height);
|
|
437
476
|
}
|
|
477
|
+
return autoRowGrew;
|
|
438
478
|
}
|
|
439
479
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type DrawingContext,
|
|
1
|
+
import { type DrawingContext, 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";
|
|
@@ -154,6 +154,8 @@ export declare class SkiaEditor extends SkiaShape {
|
|
|
154
154
|
private VisualTarget;
|
|
155
155
|
private LabelPoint;
|
|
156
156
|
protected Paint(ctx: DrawingContext): void;
|
|
157
|
+
/** The press now down is not the main button's. */
|
|
158
|
+
private otherButtonPress;
|
|
157
159
|
ProcessGestures(args: SkiaGesturesParameters, apply: GestureEventProcessingInfo): SkiaControl | null;
|
|
158
160
|
/** The canvas gives or takes the focus (a tap elsewhere): an editor always takes it. */
|
|
159
161
|
SetFrameworkFocus(focus: boolean): boolean;
|
|
@@ -165,6 +167,7 @@ export declare class SkiaEditor extends SkiaShape {
|
|
|
165
167
|
OnAccessibilityActivated(): void;
|
|
166
168
|
/** While editing, arrows, Home / End and PageUp / PageDown belong to the text: they never move a surrounding group. */
|
|
167
169
|
OnAccessibilityKey(_key: string): boolean;
|
|
170
|
+
/** The typed text, else the placeholder. A password field never exposes its text: only the placeholder (C# SkiaEditor). */
|
|
168
171
|
protected DefaultAccessibilityLabel(): string | undefined;
|
|
169
172
|
Submit(): void;
|
|
170
173
|
private ExecuteSubmit;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CanvasLeaveWatchers } from "../core/SkiaControl";
|
|
1
|
+
import { CanvasLeaveWatchers, SkiaControl } from "../core/SkiaControl";
|
|
2
2
|
import { SKPoint } from "../core/Gestures";
|
|
3
3
|
import { Super } from "../core/Super";
|
|
4
4
|
import { DefaultAccent, ResolveControlStyle } from "../core/ControlStyle";
|
|
@@ -358,12 +358,13 @@ export class SkiaEditor extends SkiaShape {
|
|
|
358
358
|
if (this.placeholder.IsVisible)
|
|
359
359
|
this.placeholder.Measure(innerW, Infinity, scale);
|
|
360
360
|
const lineH = this.Label.MeasuredLineHeight || this.placeholder.MeasuredLineHeight || this.GetSingleLineHeightPts() * scale;
|
|
361
|
-
let
|
|
361
|
+
let contentH = lineH * (this.maxLines > 0 ? this.maxLines : 1);
|
|
362
362
|
if (this.AutoHeight && this.IsMultiline) {
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
// the visible lines as the label lays them out: each its own height, with line and paragraph spacing between
|
|
364
|
+
const boxes = this.Label.GetLineBoxes();
|
|
365
|
+
const k = this.maxLines > 0 ? Math.min(boxes.length, this.maxLines) : boxes.length;
|
|
366
|
+
contentH = k > 0 ? boxes[k - 1].Top + boxes[k - 1].Height - boxes[0].Top : lineH;
|
|
365
367
|
}
|
|
366
|
-
const contentH = lineH * lines;
|
|
367
368
|
const width = isFinite(w) ? w : labelSize.Pixels.Width + px;
|
|
368
369
|
return ScaledSize.FromPixels(width, Math.ceil(contentH) + py, scale);
|
|
369
370
|
}
|
|
@@ -588,7 +589,21 @@ export class SkiaEditor extends SkiaShape {
|
|
|
588
589
|
}
|
|
589
590
|
}
|
|
590
591
|
// ---- gestures (C# ProcessGestures: tap places the caret, drag selects, long press selects the word) ----
|
|
592
|
+
/** The press now down is not the main button's. */
|
|
593
|
+
otherButtonPress = false;
|
|
591
594
|
ProcessGestures(args, apply) {
|
|
595
|
+
// a press with another mouse button (a right click for the context menu) leaves the caret and the selection as they
|
|
596
|
+
// are, also as it drags or is held; it still focuses the field (DrawnUi.Net b6d65b8b)
|
|
597
|
+
if (args.Type === "Down")
|
|
598
|
+
this.otherButtonPress = !SkiaControl.IsPrimaryPointer(args);
|
|
599
|
+
if (this.otherButtonPress && (args.Type === "Down" || args.Type === "Panning" || args.Type === "LongPressing")) {
|
|
600
|
+
if (args.Type === "Down") {
|
|
601
|
+
this.dragSelecting = false;
|
|
602
|
+
if (!this.isFocused)
|
|
603
|
+
this.IsFocused = true;
|
|
604
|
+
}
|
|
605
|
+
return this;
|
|
606
|
+
}
|
|
592
607
|
switch (args.Type) {
|
|
593
608
|
case "Down": {
|
|
594
609
|
const p = this.LabelPoint(args, apply);
|
|
@@ -640,8 +655,11 @@ export class SkiaEditor extends SkiaShape {
|
|
|
640
655
|
}
|
|
641
656
|
case "Up":
|
|
642
657
|
this.dragSelecting = false;
|
|
658
|
+
this.otherButtonPress = false;
|
|
643
659
|
return this;
|
|
644
660
|
case "Tapped": return this;
|
|
661
|
+
// the field scrolls its text only to follow the caret: the wheel is the page's, over the field too
|
|
662
|
+
case "Wheel": return null;
|
|
645
663
|
}
|
|
646
664
|
return this;
|
|
647
665
|
}
|
|
@@ -656,7 +674,8 @@ export class SkiaEditor extends SkiaShape {
|
|
|
656
674
|
this.OnAccessibilityFocused(true); }
|
|
657
675
|
/** While editing, arrows, Home / End and PageUp / PageDown belong to the text: they never move a surrounding group. */
|
|
658
676
|
OnAccessibilityKey(_key) { return this.IsFocused; }
|
|
659
|
-
|
|
677
|
+
/** The typed text, else the placeholder. A password field never exposes its text: only the placeholder (C# SkiaEditor). */
|
|
678
|
+
DefaultAccessibilityLabel() { return (!this.isPassword && this.text) || this.placeholderText || undefined; }
|
|
660
679
|
// ---- editing API (C# names) ----
|
|
661
680
|
Submit() {
|
|
662
681
|
if (this.IsMultiline && !this.ShouldSubmitOnEnter) {
|
|
@@ -44,6 +44,11 @@ export declare class SkiaImage extends SkiaControl {
|
|
|
44
44
|
/** C# ImageBitmap: show an already decoded image (shared, not owned) instead of loading a Source. */
|
|
45
45
|
get ImageBitmap(): Image | undefined;
|
|
46
46
|
set ImageBitmap(image: Image | undefined);
|
|
47
|
+
/**
|
|
48
|
+
* Shows an image: the control holds it while it draws it (the image manager never deletes an image a control holds,
|
|
49
|
+
* and deletes a copy of its own once the control lets it go: SkiaImageManager.Hold / Free).
|
|
50
|
+
*/
|
|
51
|
+
private Show;
|
|
47
52
|
IsLoading: boolean;
|
|
48
53
|
/** Where the scaled image was drawn last frame, canvas pixels. */
|
|
49
54
|
DisplayRect: SKRect;
|
|
@@ -69,9 +69,21 @@ export class SkiaImage extends SkiaControl {
|
|
|
69
69
|
return;
|
|
70
70
|
this.loadGeneration++;
|
|
71
71
|
this.IsLoading = false;
|
|
72
|
-
this.
|
|
72
|
+
this.Show(image);
|
|
73
73
|
this.Update();
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Shows an image: the control holds it while it draws it (the image manager never deletes an image a control holds,
|
|
77
|
+
* and deletes a copy of its own once the control lets it go: SkiaImageManager.Hold / Free).
|
|
78
|
+
*/
|
|
79
|
+
Show(image) {
|
|
80
|
+
if (this.LoadedSource === image)
|
|
81
|
+
return;
|
|
82
|
+
const old = this.LoadedSource;
|
|
83
|
+
this.LoadedSource = image;
|
|
84
|
+
SkiaImageManager.Instance.Hold(image);
|
|
85
|
+
SkiaImageManager.Instance.Free(old);
|
|
86
|
+
}
|
|
75
87
|
IsLoading = false;
|
|
76
88
|
/** Where the scaled image was drawn last frame, canvas pixels. */
|
|
77
89
|
DisplayRect = SKRect.Empty;
|
|
@@ -88,16 +100,29 @@ export class SkiaImage extends SkiaControl {
|
|
|
88
100
|
return;
|
|
89
101
|
this.source = value;
|
|
90
102
|
const generation = ++this.loadGeneration;
|
|
91
|
-
this.
|
|
103
|
+
this.Show(undefined);
|
|
92
104
|
if (!value) {
|
|
93
105
|
this.IsLoading = false;
|
|
94
106
|
this.Update();
|
|
95
107
|
return;
|
|
96
108
|
}
|
|
97
109
|
this.IsLoading = true;
|
|
98
|
-
SkiaImageManager.Instance.LoadImageManagedAsync(value, undefined, this.LoadPriority).then((image) => {
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
SkiaImageManager.Instance.LoadImageManagedAsync(value, undefined, this.LoadPriority).then((image) => {
|
|
111
|
+
if (generation !== this.loadGeneration || this.IsDisposed) {
|
|
112
|
+
// a load nobody shows: a copy of its own goes at once, a shared image stays in the cache
|
|
113
|
+
SkiaImageManager.Instance.Hold(image);
|
|
114
|
+
SkiaImageManager.Instance.Free(image);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this.IsLoading = false;
|
|
118
|
+
if (!image) {
|
|
119
|
+
this.Error?.(this, new Error(`DrawnUi: cannot load image '${value}'`));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
this.Show(image);
|
|
123
|
+
this.Update();
|
|
124
|
+
this.Success?.(this, value);
|
|
125
|
+
});
|
|
101
126
|
}
|
|
102
127
|
/** Port of DrawnUi SkiaControl.RescaleAspect: per-axis scale to apply to (width, height) inside dest. */
|
|
103
128
|
static RescaleAspect(width, height, dest, stretch) {
|
|
@@ -251,6 +276,8 @@ export class SkiaImage extends SkiaControl {
|
|
|
251
276
|
this.tileShader?.delete();
|
|
252
277
|
this.tileShader = undefined;
|
|
253
278
|
this.tileShaderKey = undefined;
|
|
279
|
+
this.loadGeneration++;
|
|
280
|
+
this.Show(undefined);
|
|
254
281
|
super.OnDisposing();
|
|
255
282
|
}
|
|
256
283
|
}
|