drawnui-react 0.1.0-preview.24 → 0.1.0-preview.25

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.
@@ -160,7 +160,12 @@ export declare class SkiaLayout extends SkiaControl {
160
160
  * one measured, and every item is placed again from the sizes known.
161
161
  */
162
162
  private MeasureMasonry;
163
- /** Masonry: where the slot of item `index` was arranged (pixels), also while no view shows it; undefined otherwise. */
163
+ /**
164
+ * Where item `index` of a recycled templated Row / Wrap / Grid / split Column / Masonry was arranged (pixels), from
165
+ * its slot, also while no view shows it (ScrollToIndex to an item off screen); undefined otherwise.
166
+ */
167
+ GetItemRect(index: number): SKRect | undefined;
168
+ /** Masonry: where the slot of item `index` was arranged (pixels); see GetItemRect. */
164
169
  GetMasonryItemRect(index: number): SKRect | undefined;
165
170
  /** Port of C# MeasureGrid: build the structure in points, stretch the last track when the grid fills, remeasure at final cells. */
166
171
  private MeasureGrid;
@@ -612,13 +612,18 @@ export class SkiaLayout extends SkiaControl {
612
612
  const used = Math.min(columns, this.wrapSlots.length);
613
613
  return { w: used > 0 ? used * columnWidth + (used - 1) * spacing : 0, h: Math.max(0, ...bottoms) };
614
614
  }
615
- /** Masonry: where the slot of item `index` was arranged (pixels), also while no view shows it; undefined otherwise. */
616
- GetMasonryItemRect(index) {
617
- if (!this.IsMasonry || !this.IsRecycledLayout)
615
+ /**
616
+ * Where item `index` of a recycled templated Row / Wrap / Grid / split Column / Masonry was arranged (pixels), from
617
+ * its slot, also while no view shows it (ScrollToIndex to an item off screen); undefined otherwise.
618
+ */
619
+ GetItemRect(index) {
620
+ if (!this.IsRecycledLayout)
618
621
  return undefined;
619
622
  const d = this.slots?.[index]?.Destination;
620
623
  return d && d.Width > 0 ? d : undefined;
621
624
  }
625
+ /** Masonry: where the slot of item `index` was arranged (pixels); see GetItemRect. */
626
+ GetMasonryItemRect(index) { return this.IsMasonry ? this.GetItemRect(index) : undefined; }
622
627
  /** Port of C# MeasureGrid: build the structure in points, stretch the last track when the grid fills, remeasure at final cells. */
623
628
  MeasureGrid(widthPx, heightPx, scale) {
624
629
  const wPts = widthPx / scale, hPts = heightPx / scale;
@@ -781,7 +786,7 @@ export class SkiaLayout extends SkiaControl {
781
786
  * The item's offset and height are real, not estimated (C# LastMeasuredIndexLocal >= index): MeasureVisible knows
782
787
  * them once the measured prefix passed the item; the other strategies always do.
783
788
  */
784
- IsItemMeasured(index) { return this.IsMasonry || this.MeasureItemsStrategy !== "MeasureVisible" || index < this.mvMeasured; }
789
+ IsItemMeasured(index) { return !this.IsTemplatedList || this.MeasureItemsStrategy !== "MeasureVisible" || index < this.mvMeasured; }
785
790
  /** Pixel offset of item index from the top of the layout content (inside padding). */
786
791
  GetItemOffsetPixels(index) {
787
792
  const scale = this.RenderingScale;
@@ -871,8 +871,8 @@ export class SkiaScroll extends SkiaControl {
871
871
  else {
872
872
  // A templated Row / Wrap / Grid realizes every item (C# non-list layouts are not virtualized): read the cell's
873
873
  // arranged rect, like C# reads the structure cell's Destination.
874
- // a masonry's recycled slots know every item's place, shown or not
875
- const r = layout.GetMasonryItemRect(i) ?? layout.ChildrenFactory.GetViewForIndex(i)?.DrawingRect;
874
+ // recycled slots know every item's place, shown or not
875
+ const r = layout.GetItemRect(i) ?? layout.ChildrenFactory.GetViewForIndex(i)?.DrawingRect;
876
876
  if (!r)
877
877
  return undefined;
878
878
  const c = this.content.DrawingRect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drawnui-react",
3
- "version": "0.1.0-preview.24",
3
+ "version": "0.1.0-preview.25",
4
4
  "description": "DrawnUi for React: the DrawnUi (.NET) drawn-UI engine in TypeScript on CanvasKit (Skia WASM). Same controls, same PascalCase API as DrawnUi.Net.",
5
5
  "license": "MIT",
6
6
  "author": "Nick Kovalsky (AppoMobi)",
@@ -81,6 +81,7 @@
81
81
  "check:backdrop": "node dev/check.mjs dev/check-backdrop.ts",
82
82
  "check:masonry": "node dev/check.mjs dev/check-masonry.ts",
83
83
  "check:thickness": "node dev/check.mjs dev/check-thickness.ts",
84
+ "check:scroll-recycled": "node dev/check.mjs dev/check-scroll-recycled.ts",
84
85
  "site:extras": "node dev/site-extras.mjs dist/demo",
85
86
  "build:lib": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.build.json",
86
87
  "prepublishOnly": "npm run build:lib",