canvu-react 0.3.38 → 0.3.40
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/{asset-hydration-EtEuBwb7.d.cts → asset-hydration-B7yMDQE-.d.cts} +2 -2
- package/dist/{asset-hydration-DrTOgDdd.d.ts → asset-hydration-CbwQVAwh.d.ts} +2 -2
- package/dist/{camera-Di5R_Rwl.d.cts → camera-CVVG7z56.d.cts} +1 -1
- package/dist/{camera-AoTwBSoE.d.ts → camera-CoRYN_IV.d.ts} +1 -1
- package/dist/chatbot.d.cts +4 -4
- package/dist/chatbot.d.ts +4 -4
- package/dist/index.cjs +164 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +159 -16
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +57 -14
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +2 -2
- package/dist/native.d.ts +2 -2
- package/dist/native.js +57 -14
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +731 -258
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +10 -10
- package/dist/react.d.ts +10 -10
- package/dist/react.js +731 -258
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +36 -0
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +6 -6
- package/dist/realtime.d.ts +6 -6
- package/dist/realtime.js +36 -0
- package/dist/realtime.js.map +1 -1
- package/dist/{shape-builders-CsbSRZnQ.d.cts → shape-builders-BAWu-PxX.d.cts} +46 -4
- package/dist/{shape-builders-CsSXKCcs.d.ts → shape-builders-ClKv9tz9.d.ts} +46 -4
- package/dist/tldraw.cjs +189 -78
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.d.cts +1 -1
- package/dist/tldraw.d.ts +1 -1
- package/dist/tldraw.js +189 -78
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-DWGk2_GZ.d.cts → types-BC9Xgfu6.d.cts} +20 -6
- package/dist/{types-Bnq2HtHQ.d.cts → types-BCCvY6ie.d.cts} +2 -0
- package/dist/{types-Bnq2HtHQ.d.ts → types-BCCvY6ie.d.ts} +2 -0
- package/dist/{types-B2Na677H.d.cts → types-BUPc2Zgw.d.cts} +1 -1
- package/dist/{types-zmUah-vP.d.ts → types-CYtq9Pr9.d.ts} +1 -1
- package/dist/{types-B6PAYKzx.d.ts → types-DlSVGX0w.d.ts} +20 -6
- package/package.json +1 -1
package/dist/realtime.cjs
CHANGED
|
@@ -155,6 +155,30 @@ function perfectFreehandOptions(toolKind, style, strokeComplete, pressureAware =
|
|
|
155
155
|
simulatePressure: true
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
+
function dashArrayForDrawStroke(strokeWidth) {
|
|
159
|
+
const dash = Math.max(strokeWidth * 1.8, 4);
|
|
160
|
+
const gap = Math.max(strokeWidth * 1.4, 3);
|
|
161
|
+
return `${dash} ${gap}`;
|
|
162
|
+
}
|
|
163
|
+
function buildSmoothedCenterlinePath(points) {
|
|
164
|
+
if (points.length < 2) return null;
|
|
165
|
+
const first = points[0];
|
|
166
|
+
if (!first) return null;
|
|
167
|
+
let d = `M ${first.x} ${first.y}`;
|
|
168
|
+
for (let i = 1; i < points.length - 1; i++) {
|
|
169
|
+
const a = points[i];
|
|
170
|
+
const b = points[i + 1];
|
|
171
|
+
if (!a || !b) continue;
|
|
172
|
+
const midX = (a.x + b.x) / 2;
|
|
173
|
+
const midY = (a.y + b.y) / 2;
|
|
174
|
+
d += ` Q ${a.x} ${a.y} ${midX} ${midY}`;
|
|
175
|
+
}
|
|
176
|
+
const last = points[points.length - 1];
|
|
177
|
+
if (last) {
|
|
178
|
+
d += ` L ${last.x} ${last.y}`;
|
|
179
|
+
}
|
|
180
|
+
return d;
|
|
181
|
+
}
|
|
158
182
|
function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeComplete = true) {
|
|
159
183
|
if (pathPointsLocal.length === 0) return null;
|
|
160
184
|
if (pathPointsLocal.length === 1) {
|
|
@@ -169,6 +193,18 @@ function computeFreehandSvgPayload(pathPointsLocal, style, toolKind, strokeCompl
|
|
|
169
193
|
fillOpacity: style.strokeOpacity
|
|
170
194
|
};
|
|
171
195
|
}
|
|
196
|
+
if (style.strokeDash === "dashed" && (toolKind === "draw" || toolKind === "pencil")) {
|
|
197
|
+
const d2 = buildSmoothedCenterlinePath(pathPointsLocal);
|
|
198
|
+
if (!d2) return null;
|
|
199
|
+
return {
|
|
200
|
+
kind: "strokePath",
|
|
201
|
+
d: d2,
|
|
202
|
+
stroke: style.stroke,
|
|
203
|
+
strokeWidth: style.strokeWidth,
|
|
204
|
+
strokeOpacity: style.strokeOpacity,
|
|
205
|
+
strokeDasharray: dashArrayForDrawStroke(style.strokeWidth)
|
|
206
|
+
};
|
|
207
|
+
}
|
|
172
208
|
const hasPressure = pathPointsLocal.some(
|
|
173
209
|
(p) => p.pressure != null && Number.isFinite(p.pressure)
|
|
174
210
|
);
|