canvu-react 0.3.25 → 0.3.26

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/realtime.cjs CHANGED
@@ -11,9 +11,13 @@ function remoteMarkupStrokeFromPlacementPreview(preview) {
11
11
  }
12
12
  const tool = preview.tool;
13
13
  const mapped = tool === "laser" || tool === "marker" || tool === "draw" ? tool : "draw";
14
+ const style = preview.style;
14
15
  return {
15
16
  points: preview.points,
16
- tool: mapped
17
+ tool: mapped,
18
+ ...style?.strokeWidth != null ? { strokeWidth: style.strokeWidth } : {},
19
+ ...style?.stroke ? { stroke: style.stroke } : {},
20
+ ...style?.strokeOpacity != null ? { strokeOpacity: style.strokeOpacity } : {}
17
21
  };
18
22
  }
19
23
 
@@ -128,7 +132,12 @@ function PresenceRemoteLayer({
128
132
  const markup = peer.markupStroke;
129
133
  let strokeNode = null;
130
134
  if (markup && markup.points.length > 0) {
131
- const paint = strokePaint(markup.tool, color);
135
+ const fallbackPaint = strokePaint(markup.tool, color);
136
+ const paint = {
137
+ stroke: markup.stroke ?? fallbackPaint.stroke,
138
+ strokeOpacity: markup.strokeOpacity ?? fallbackPaint.strokeOpacity,
139
+ widthWorld: markup.strokeWidth ?? fallbackPaint.widthWorld
140
+ };
132
141
  const d = markup.points.length >= 2 ? smoothFreehandPointsToPathD([...markup.points]) : null;
133
142
  if (d) {
134
143
  strokeNode = /* @__PURE__ */ jsxRuntime.jsx(
@@ -257,7 +266,16 @@ function parseMarkupStroke(value) {
257
266
  if (x == null || y == null) return null;
258
267
  return { x, y };
259
268
  }).filter((point) => point != null);
260
- return { points, tool };
269
+ const strokeWidth = getNumber(value.strokeWidth);
270
+ const stroke = getString(value.stroke);
271
+ const strokeOpacity = getNumber(value.strokeOpacity);
272
+ return {
273
+ points,
274
+ tool,
275
+ ...strokeWidth != null ? { strokeWidth } : {},
276
+ ...stroke ? { stroke } : {},
277
+ ...strokeOpacity != null ? { strokeOpacity } : {}
278
+ };
261
279
  }
262
280
  function parsePresencePayload(value) {
263
281
  if (!isRecord(value)) return void 0;