canvu-react 0.3.26 → 0.3.27
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/react.cjs +66 -24
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +66 -24
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +190 -56
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.js +186 -56
- package/dist/realtime.js.map +1 -1
- package/package.json +1 -1
package/dist/react.cjs
CHANGED
|
@@ -6455,6 +6455,7 @@ function InteractionOverlay({
|
|
|
6455
6455
|
}
|
|
6456
6456
|
);
|
|
6457
6457
|
}
|
|
6458
|
+
init_shape_builders();
|
|
6458
6459
|
|
|
6459
6460
|
// src/react/presence/peer-color.ts
|
|
6460
6461
|
function defaultPresenceColorForId(id) {
|
|
@@ -6480,6 +6481,9 @@ function strokePaint(tool, fallback) {
|
|
|
6480
6481
|
return { stroke: fallback, strokeOpacity: 0.95, widthWorld: 3.5 };
|
|
6481
6482
|
}
|
|
6482
6483
|
}
|
|
6484
|
+
function isFreehandTool(tool) {
|
|
6485
|
+
return tool === "draw" || tool === "marker" || tool === "pencil" || tool === "brush";
|
|
6486
|
+
}
|
|
6483
6487
|
function PresenceRemoteLayer({
|
|
6484
6488
|
camera,
|
|
6485
6489
|
cameraVersion: _cameraVersion,
|
|
@@ -6521,34 +6525,72 @@ function PresenceRemoteLayer({
|
|
|
6521
6525
|
strokeOpacity: markup.strokeOpacity ?? fallbackPaint.strokeOpacity,
|
|
6522
6526
|
widthWorld: markup.strokeWidth ?? fallbackPaint.widthWorld
|
|
6523
6527
|
};
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
|
|
6536
|
-
|
|
6537
|
-
|
|
6538
|
-
|
|
6528
|
+
if (markup.tool === "laser") {
|
|
6529
|
+
const d = markup.points.length >= 2 ? smoothFreehandPointsToPathD([...markup.points]) : null;
|
|
6530
|
+
if (d) {
|
|
6531
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6532
|
+
"path",
|
|
6533
|
+
{
|
|
6534
|
+
d,
|
|
6535
|
+
fill: "none",
|
|
6536
|
+
stroke: paint.stroke,
|
|
6537
|
+
strokeOpacity: paint.strokeOpacity,
|
|
6538
|
+
strokeWidth: Math.max(paint.widthWorld / z, overlayStrokePx),
|
|
6539
|
+
strokeLinecap: "round",
|
|
6540
|
+
strokeLinejoin: "round",
|
|
6541
|
+
shapeRendering: "geometricPrecision",
|
|
6542
|
+
vectorEffect: "non-scaling-stroke"
|
|
6543
|
+
}
|
|
6544
|
+
);
|
|
6545
|
+
}
|
|
6546
|
+
} else if (isFreehandTool(markup.tool)) {
|
|
6547
|
+
const style = {
|
|
6548
|
+
stroke: paint.stroke,
|
|
6549
|
+
strokeWidth: paint.widthWorld,
|
|
6550
|
+
...paint.strokeOpacity != null ? { strokeOpacity: paint.strokeOpacity } : {}
|
|
6551
|
+
};
|
|
6552
|
+
const payload = computeFreehandSvgPayload(
|
|
6553
|
+
markup.points.map((p) => ({ x: p.x, y: p.y })),
|
|
6554
|
+
style,
|
|
6555
|
+
markup.tool,
|
|
6556
|
+
false
|
|
6539
6557
|
);
|
|
6540
|
-
|
|
6541
|
-
const p0 = markup.points[0];
|
|
6542
|
-
if (p0) {
|
|
6558
|
+
if (payload?.kind === "circle") {
|
|
6543
6559
|
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6544
6560
|
"circle",
|
|
6545
6561
|
{
|
|
6546
|
-
cx:
|
|
6547
|
-
cy:
|
|
6548
|
-
r:
|
|
6549
|
-
fill:
|
|
6550
|
-
fillOpacity:
|
|
6551
|
-
|
|
6562
|
+
cx: payload.cx,
|
|
6563
|
+
cy: payload.cy,
|
|
6564
|
+
r: payload.r,
|
|
6565
|
+
fill: payload.fill,
|
|
6566
|
+
...payload.fillOpacity != null ? { fillOpacity: payload.fillOpacity } : {},
|
|
6567
|
+
shapeRendering: "geometricPrecision"
|
|
6568
|
+
}
|
|
6569
|
+
);
|
|
6570
|
+
} else if (payload?.kind === "fillPath") {
|
|
6571
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6572
|
+
"path",
|
|
6573
|
+
{
|
|
6574
|
+
d: payload.d,
|
|
6575
|
+
fill: payload.fill,
|
|
6576
|
+
fillRule: "nonzero",
|
|
6577
|
+
stroke: "none",
|
|
6578
|
+
...payload.fillOpacity != null ? { fillOpacity: payload.fillOpacity } : {},
|
|
6579
|
+
shapeRendering: "geometricPrecision"
|
|
6580
|
+
}
|
|
6581
|
+
);
|
|
6582
|
+
} else if (payload?.kind === "strokePath") {
|
|
6583
|
+
strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
|
|
6584
|
+
"path",
|
|
6585
|
+
{
|
|
6586
|
+
d: payload.d,
|
|
6587
|
+
fill: "none",
|
|
6588
|
+
stroke: payload.stroke,
|
|
6589
|
+
strokeWidth: payload.strokeWidth,
|
|
6590
|
+
...payload.strokeOpacity != null ? { strokeOpacity: payload.strokeOpacity } : {},
|
|
6591
|
+
strokeLinecap: "round",
|
|
6592
|
+
strokeLinejoin: "round",
|
|
6593
|
+
shapeRendering: "geometricPrecision"
|
|
6552
6594
|
}
|
|
6553
6595
|
);
|
|
6554
6596
|
}
|