canvu-react 0.4.49 → 0.4.50

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.cjs CHANGED
@@ -3100,11 +3100,14 @@ function buildNativeStrokePreviewPath(points) {
3100
3100
  const d = smoothFreehandPointsToPathD(points);
3101
3101
  return d || null;
3102
3102
  }
3103
- function nativeStrokePreviewDashArray(style, tool) {
3104
- if (style.strokeDash !== "dashed" || tool !== "draw") return void 0;
3105
- const dash = Math.max(style.strokeWidth * 1.8, 4);
3106
- const gap = Math.max(style.strokeWidth * 1.4, 3);
3107
- return `${dash} ${gap}`;
3103
+ function buildNativeFreehandStrokePreviewPayload(points, style, tool) {
3104
+ if (tool === "laser") return null;
3105
+ return computeFreehandSvgPayload(
3106
+ points.map((point) => ({ x: point.x, y: point.y })),
3107
+ style,
3108
+ tool,
3109
+ true
3110
+ );
3108
3111
  }
3109
3112
 
3110
3113
  // src/native/native-vector-interactions.ts
@@ -3482,6 +3485,57 @@ function NativeInteractionOverlay({
3482
3485
  style.stroke,
3483
3486
  isLaser ? 0.85 : style.strokeOpacity
3484
3487
  );
3488
+ if (!isLaser) {
3489
+ const payload = buildNativeFreehandStrokePreviewPayload(
3490
+ p.points,
3491
+ style,
3492
+ p.tool
3493
+ );
3494
+ if (payload?.kind === "circle") {
3495
+ return /* @__PURE__ */ jsxRuntime.jsx(
3496
+ reactNativeSkia.Circle,
3497
+ {
3498
+ cx: payload.cx,
3499
+ cy: payload.cy,
3500
+ r: payload.r,
3501
+ color: colorWithOpacity(payload.fill, payload.fillOpacity),
3502
+ style: "fill",
3503
+ antiAlias: true
3504
+ }
3505
+ );
3506
+ }
3507
+ if (payload?.kind === "fillPath") {
3508
+ return /* @__PURE__ */ jsxRuntime.jsx(
3509
+ reactNativeSkia.Path,
3510
+ {
3511
+ path: payload.d,
3512
+ color: colorWithOpacity(payload.fill, payload.fillOpacity),
3513
+ style: "fill",
3514
+ fillType: "winding",
3515
+ antiAlias: true
3516
+ }
3517
+ );
3518
+ }
3519
+ if (payload?.kind === "strokePath") {
3520
+ const intervals = dashIntervalsFromStrokeDasharray3(
3521
+ payload.strokeDasharray
3522
+ );
3523
+ return /* @__PURE__ */ jsxRuntime.jsx(
3524
+ reactNativeSkia.Path,
3525
+ {
3526
+ path: payload.d,
3527
+ color: colorWithOpacity(payload.stroke, payload.strokeOpacity),
3528
+ style: "stroke",
3529
+ strokeWidth: payload.strokeWidth,
3530
+ strokeCap: "round",
3531
+ strokeJoin: "round",
3532
+ antiAlias: true,
3533
+ children: intervals ? /* @__PURE__ */ jsxRuntime.jsx(reactNativeSkia.DashPathEffect, { intervals }) : null
3534
+ }
3535
+ );
3536
+ }
3537
+ return null;
3538
+ }
3485
3539
  if (p.points.length === 1) {
3486
3540
  const point = p.points[0];
3487
3541
  if (!point) return null;
@@ -3499,8 +3553,6 @@ function NativeInteractionOverlay({
3499
3553
  }
3500
3554
  const path = buildNativeStrokePreviewPath(p.points);
3501
3555
  if (!path) return null;
3502
- const strokeDasharray = nativeStrokePreviewDashArray(style, p.tool);
3503
- const intervals = dashIntervalsFromStrokeDasharray3(strokeDasharray);
3504
3556
  return /* @__PURE__ */ jsxRuntime.jsx(
3505
3557
  reactNativeSkia.Path,
3506
3558
  {
@@ -3510,8 +3562,7 @@ function NativeInteractionOverlay({
3510
3562
  strokeWidth: style.strokeWidth,
3511
3563
  strokeCap: "round",
3512
3564
  strokeJoin: "round",
3513
- antiAlias: true,
3514
- children: intervals ? /* @__PURE__ */ jsxRuntime.jsx(reactNativeSkia.DashPathEffect, { intervals }) : null
3565
+ antiAlias: true
3515
3566
  }
3516
3567
  );
3517
3568
  }