canvu-react 0.4.50 → 0.4.51

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/dist/native.d.cts CHANGED
@@ -113,8 +113,9 @@ type NativeSceneRendererProps = {
113
113
  readonly camera: Camera2D;
114
114
  readonly width: number;
115
115
  readonly height: number;
116
+ readonly renderTick: number;
116
117
  };
117
- declare function NativeSceneRenderer({ items, camera, width, height, }: NativeSceneRendererProps): react_jsx_runtime.JSX.Element | null;
118
+ declare const NativeSceneRenderer: react.NamedExoticComponent<NativeSceneRendererProps>;
118
119
 
119
120
  type NativeShapeRendererProps = {
120
121
  readonly item: VectorSceneItem;
package/dist/native.d.ts CHANGED
@@ -113,8 +113,9 @@ type NativeSceneRendererProps = {
113
113
  readonly camera: Camera2D;
114
114
  readonly width: number;
115
115
  readonly height: number;
116
+ readonly renderTick: number;
116
117
  };
117
- declare function NativeSceneRenderer({ items, camera, width, height, }: NativeSceneRendererProps): react_jsx_runtime.JSX.Element | null;
118
+ declare const NativeSceneRenderer: react.NamedExoticComponent<NativeSceneRendererProps>;
118
119
 
119
120
  type NativeShapeRendererProps = {
120
121
  readonly item: VectorSceneItem;
package/dist/native.js CHANGED
@@ -3919,11 +3919,12 @@ var MemoShape = memo(function MemoShape2({
3919
3919
  if (rotationTransform.length === 0) return shape;
3920
3920
  return /* @__PURE__ */ jsx(Group, { transform: rotationTransform, origin: rotationOrigin, children: shape });
3921
3921
  });
3922
- function NativeSceneRenderer({
3922
+ var NativeSceneRenderer = memo(function NativeSceneRenderer2({
3923
3923
  items,
3924
3924
  camera,
3925
3925
  width,
3926
- height
3926
+ height,
3927
+ renderTick
3927
3928
  }) {
3928
3929
  const cameraTransform = skiaCameraTransform(camera.zoom, camera.x, camera.y);
3929
3930
  const visible = cullItemsByViewport(
@@ -3932,7 +3933,7 @@ function NativeSceneRenderer({
3932
3933
  );
3933
3934
  if (width <= 0 || height <= 0) return null;
3934
3935
  return /* @__PURE__ */ jsx(Canvas, { style: { width, height }, children: /* @__PURE__ */ jsx(Group, { transform: cameraTransform, children: visible.map((item) => /* @__PURE__ */ jsx(MemoShape, { item }, item.id)) }) });
3935
- }
3936
+ });
3936
3937
 
3937
3938
  // src/native/native-style-inspector-values.ts
3938
3939
  var NATIVE_STYLE_PALETTE = [
@@ -5717,6 +5718,11 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
5717
5718
  return activeItems.filter((item) => !hidden.has(item.id));
5718
5719
  }, [activeItems, eraserPreviewIds]);
5719
5720
  const showResizeHandles = interactive && selectedItems.length === 1 && !selectedItems[0]?.locked && supportsNativeResizeHandles(selectedItems[0]);
5721
+ const eraserPreviewItems = useMemo(() => {
5722
+ if (eraserPreviewIds.length === 0) return [];
5723
+ const eraserPreviewIdSet = new Set(eraserPreviewIds);
5724
+ return activeItems.filter((item) => eraserPreviewIdSet.has(item.id));
5725
+ }, [activeItems, eraserPreviewIds]);
5720
5726
  const patchSelectedItemsStrokeStyle = useCallback(
5721
5727
  (patch) => {
5722
5728
  const change = onItemsChangeRef.current;
@@ -6523,7 +6529,8 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
6523
6529
  items: sceneItems,
6524
6530
  camera,
6525
6531
  width: size.width,
6526
- height: size.height
6532
+ height: size.height,
6533
+ renderTick: cameraTick
6527
6534
  }
6528
6535
  ),
6529
6536
  interactive && /* @__PURE__ */ jsx(
@@ -6537,9 +6544,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
6537
6544
  placementPreview,
6538
6545
  laserTrail,
6539
6546
  eraserTrail,
6540
- eraserPreviewItems: activeItems.filter(
6541
- (item) => eraserPreviewIds.includes(item.id)
6542
- ),
6547
+ eraserPreviewItems,
6543
6548
  previewStrokeStyle: strokeStyleState,
6544
6549
  remotePresence
6545
6550
  }