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 +60 -9
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +60 -9
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.js
CHANGED
|
@@ -3094,11 +3094,14 @@ function buildNativeStrokePreviewPath(points) {
|
|
|
3094
3094
|
const d = smoothFreehandPointsToPathD(points);
|
|
3095
3095
|
return d || null;
|
|
3096
3096
|
}
|
|
3097
|
-
function
|
|
3098
|
-
if (
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3097
|
+
function buildNativeFreehandStrokePreviewPayload(points, style, tool) {
|
|
3098
|
+
if (tool === "laser") return null;
|
|
3099
|
+
return computeFreehandSvgPayload(
|
|
3100
|
+
points.map((point) => ({ x: point.x, y: point.y })),
|
|
3101
|
+
style,
|
|
3102
|
+
tool,
|
|
3103
|
+
true
|
|
3104
|
+
);
|
|
3102
3105
|
}
|
|
3103
3106
|
|
|
3104
3107
|
// src/native/native-vector-interactions.ts
|
|
@@ -3476,6 +3479,57 @@ function NativeInteractionOverlay({
|
|
|
3476
3479
|
style.stroke,
|
|
3477
3480
|
isLaser ? 0.85 : style.strokeOpacity
|
|
3478
3481
|
);
|
|
3482
|
+
if (!isLaser) {
|
|
3483
|
+
const payload = buildNativeFreehandStrokePreviewPayload(
|
|
3484
|
+
p.points,
|
|
3485
|
+
style,
|
|
3486
|
+
p.tool
|
|
3487
|
+
);
|
|
3488
|
+
if (payload?.kind === "circle") {
|
|
3489
|
+
return /* @__PURE__ */ jsx(
|
|
3490
|
+
Circle,
|
|
3491
|
+
{
|
|
3492
|
+
cx: payload.cx,
|
|
3493
|
+
cy: payload.cy,
|
|
3494
|
+
r: payload.r,
|
|
3495
|
+
color: colorWithOpacity(payload.fill, payload.fillOpacity),
|
|
3496
|
+
style: "fill",
|
|
3497
|
+
antiAlias: true
|
|
3498
|
+
}
|
|
3499
|
+
);
|
|
3500
|
+
}
|
|
3501
|
+
if (payload?.kind === "fillPath") {
|
|
3502
|
+
return /* @__PURE__ */ jsx(
|
|
3503
|
+
Path,
|
|
3504
|
+
{
|
|
3505
|
+
path: payload.d,
|
|
3506
|
+
color: colorWithOpacity(payload.fill, payload.fillOpacity),
|
|
3507
|
+
style: "fill",
|
|
3508
|
+
fillType: "winding",
|
|
3509
|
+
antiAlias: true
|
|
3510
|
+
}
|
|
3511
|
+
);
|
|
3512
|
+
}
|
|
3513
|
+
if (payload?.kind === "strokePath") {
|
|
3514
|
+
const intervals = dashIntervalsFromStrokeDasharray3(
|
|
3515
|
+
payload.strokeDasharray
|
|
3516
|
+
);
|
|
3517
|
+
return /* @__PURE__ */ jsx(
|
|
3518
|
+
Path,
|
|
3519
|
+
{
|
|
3520
|
+
path: payload.d,
|
|
3521
|
+
color: colorWithOpacity(payload.stroke, payload.strokeOpacity),
|
|
3522
|
+
style: "stroke",
|
|
3523
|
+
strokeWidth: payload.strokeWidth,
|
|
3524
|
+
strokeCap: "round",
|
|
3525
|
+
strokeJoin: "round",
|
|
3526
|
+
antiAlias: true,
|
|
3527
|
+
children: intervals ? /* @__PURE__ */ jsx(DashPathEffect, { intervals }) : null
|
|
3528
|
+
}
|
|
3529
|
+
);
|
|
3530
|
+
}
|
|
3531
|
+
return null;
|
|
3532
|
+
}
|
|
3479
3533
|
if (p.points.length === 1) {
|
|
3480
3534
|
const point = p.points[0];
|
|
3481
3535
|
if (!point) return null;
|
|
@@ -3493,8 +3547,6 @@ function NativeInteractionOverlay({
|
|
|
3493
3547
|
}
|
|
3494
3548
|
const path = buildNativeStrokePreviewPath(p.points);
|
|
3495
3549
|
if (!path) return null;
|
|
3496
|
-
const strokeDasharray = nativeStrokePreviewDashArray(style, p.tool);
|
|
3497
|
-
const intervals = dashIntervalsFromStrokeDasharray3(strokeDasharray);
|
|
3498
3550
|
return /* @__PURE__ */ jsx(
|
|
3499
3551
|
Path,
|
|
3500
3552
|
{
|
|
@@ -3504,8 +3556,7 @@ function NativeInteractionOverlay({
|
|
|
3504
3556
|
strokeWidth: style.strokeWidth,
|
|
3505
3557
|
strokeCap: "round",
|
|
3506
3558
|
strokeJoin: "round",
|
|
3507
|
-
antiAlias: true
|
|
3508
|
-
children: intervals ? /* @__PURE__ */ jsx(DashPathEffect, { intervals }) : null
|
|
3559
|
+
antiAlias: true
|
|
3509
3560
|
}
|
|
3510
3561
|
);
|
|
3511
3562
|
}
|