canvu-react 0.3.24 → 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.
@@ -1,5 +1,5 @@
1
- import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-7kfWcm0L.cjs';
2
- export { F as PresenceOverlayRenderContext } from './types-7kfWcm0L.cjs';
1
+ import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-BLXR7g_L.cjs';
2
+ export { F as PresenceOverlayRenderContext } from './types-BLXR7g_L.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { C as Camera2D } from './camera-BwQjm5oh.cjs';
5
5
  import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.cjs';
@@ -1,5 +1,5 @@
1
- import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-C4k_AMvi.js';
2
- export { F as PresenceOverlayRenderContext } from './types-C4k_AMvi.js';
1
+ import { P as PlacementPreview, R as RemotePresenceMarkupStroke, A as RemotePresencePeer, D as RemotePresenceCamera, E as RealtimeConnectionState, q as VectorViewportHandle, V as VectorToolDefinition, r as VectorViewportProps, C as CanvasPlugin, e as CanvasPluginRenderContext } from './types-Cm7IsgL4.js';
2
+ export { F as PresenceOverlayRenderContext } from './types-Cm7IsgL4.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { C as Camera2D } from './camera-KwCYYPhm.js';
5
5
  import { V as VectorSceneItem, R as Rect } from './types-CB0TZZuk.js';
package/dist/realtime.js CHANGED
@@ -9,9 +9,13 @@ function remoteMarkupStrokeFromPlacementPreview(preview) {
9
9
  }
10
10
  const tool = preview.tool;
11
11
  const mapped = tool === "laser" || tool === "marker" || tool === "draw" ? tool : "draw";
12
+ const style = preview.style;
12
13
  return {
13
14
  points: preview.points,
14
- tool: mapped
15
+ tool: mapped,
16
+ ...style?.strokeWidth != null ? { strokeWidth: style.strokeWidth } : {},
17
+ ...style?.stroke ? { stroke: style.stroke } : {},
18
+ ...style?.strokeOpacity != null ? { strokeOpacity: style.strokeOpacity } : {}
15
19
  };
16
20
  }
17
21
 
@@ -126,7 +130,12 @@ function PresenceRemoteLayer({
126
130
  const markup = peer.markupStroke;
127
131
  let strokeNode = null;
128
132
  if (markup && markup.points.length > 0) {
129
- const paint = strokePaint(markup.tool, color);
133
+ const fallbackPaint = strokePaint(markup.tool, color);
134
+ const paint = {
135
+ stroke: markup.stroke ?? fallbackPaint.stroke,
136
+ strokeOpacity: markup.strokeOpacity ?? fallbackPaint.strokeOpacity,
137
+ widthWorld: markup.strokeWidth ?? fallbackPaint.widthWorld
138
+ };
130
139
  const d = markup.points.length >= 2 ? smoothFreehandPointsToPathD([...markup.points]) : null;
131
140
  if (d) {
132
141
  strokeNode = /* @__PURE__ */ jsx(
@@ -255,7 +264,16 @@ function parseMarkupStroke(value) {
255
264
  if (x == null || y == null) return null;
256
265
  return { x, y };
257
266
  }).filter((point) => point != null);
258
- return { points, tool };
267
+ const strokeWidth = getNumber(value.strokeWidth);
268
+ const stroke = getString(value.stroke);
269
+ const strokeOpacity = getNumber(value.strokeOpacity);
270
+ return {
271
+ points,
272
+ tool,
273
+ ...strokeWidth != null ? { strokeWidth } : {},
274
+ ...stroke ? { stroke } : {},
275
+ ...strokeOpacity != null ? { strokeOpacity } : {}
276
+ };
259
277
  }
260
278
  function parsePresencePayload(value) {
261
279
  if (!isRecord(value)) return void 0;