canvu-react 0.3.31 → 0.3.32
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/index.cjs +18 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -8
- package/dist/index.js.map +1 -1
- package/dist/native.cjs +18 -8
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +18 -8
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +20 -10
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +20 -10
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs +2 -2
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.js +2 -2
- package/dist/realtime.js.map +1 -1
- package/dist/tldraw.cjs +18 -8
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.js +18 -8
- package/dist/tldraw.js.map +1 -1
- package/package.json +1 -1
package/dist/react.js
CHANGED
|
@@ -295,6 +295,14 @@ function architecturalCloudScallopCount(rx, ry, amplitude) {
|
|
|
295
295
|
if (count % 2 === 1) count += 1;
|
|
296
296
|
return count;
|
|
297
297
|
}
|
|
298
|
+
function pointOnSuperellipse(centerX, centerY, radiusX, radiusY, theta, exponent) {
|
|
299
|
+
const cosTheta = Math.cos(theta);
|
|
300
|
+
const sinTheta = Math.sin(theta);
|
|
301
|
+
return [
|
|
302
|
+
centerX + Math.sign(cosTheta) * radiusX * Math.abs(cosTheta) ** (2 / exponent),
|
|
303
|
+
centerY + Math.sign(sinTheta) * radiusY * Math.abs(sinTheta) ** (2 / exponent)
|
|
304
|
+
];
|
|
305
|
+
}
|
|
298
306
|
function buildRectSvg(width, height, style = DEFAULT_STROKE_STYLE) {
|
|
299
307
|
return `<rect width="${width}" height="${height}" fill="none" stroke="${style.stroke}" stroke-width="${style.strokeWidth}" rx="4"${strokeOpacityAttr(style)} />`;
|
|
300
308
|
}
|
|
@@ -311,10 +319,11 @@ function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROK
|
|
|
311
319
|
const outerRx = Math.max(0, w / 2 - inset);
|
|
312
320
|
const outerRy = Math.max(0, h / 2 - inset);
|
|
313
321
|
if (outerRx <= 0 || outerRy <= 0) return "";
|
|
322
|
+
const baseExponent = 3.6;
|
|
314
323
|
const amplitude = Math.min(
|
|
315
324
|
outerRx * 0.45,
|
|
316
325
|
outerRy * 0.45,
|
|
317
|
-
Math.max(2, Math.min(
|
|
326
|
+
Math.max(2, Math.min(7, Math.min(w, h) * 0.035))
|
|
318
327
|
);
|
|
319
328
|
const innerRx = Math.max(0, outerRx - amplitude);
|
|
320
329
|
const innerRy = Math.max(0, outerRy - amplitude);
|
|
@@ -323,18 +332,19 @@ function buildArchitecturalCloudPathD(width, height, strokeWidth = DEFAULT_STROK
|
|
|
323
332
|
const cx = w / 2;
|
|
324
333
|
const cy = h / 2;
|
|
325
334
|
const startAngle = -Math.PI / 2;
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
cy + Math.sin(theta) * radiusY
|
|
329
|
-
];
|
|
330
|
-
const [startX, startY] = pointOnEllipse(startAngle, innerRx, innerRy);
|
|
335
|
+
const pointOnArchitecturalCloud = (theta, radiusX, radiusY) => pointOnSuperellipse(cx, cy, radiusX, radiusY, theta, baseExponent);
|
|
336
|
+
const [startX, startY] = pointOnArchitecturalCloud(startAngle, innerRx, innerRy);
|
|
331
337
|
const segments = [`M${svgNumber(startX)} ${svgNumber(startY)}`];
|
|
332
338
|
for (let index = 0; index < scallopCount; index += 1) {
|
|
333
339
|
const segmentStart = startAngle + index * angleStep;
|
|
334
340
|
const segmentMid = segmentStart + angleStep / 2;
|
|
335
341
|
const segmentEnd = segmentStart + angleStep;
|
|
336
|
-
const [controlX, controlY] =
|
|
337
|
-
|
|
342
|
+
const [controlX, controlY] = pointOnArchitecturalCloud(
|
|
343
|
+
segmentMid,
|
|
344
|
+
outerRx,
|
|
345
|
+
outerRy
|
|
346
|
+
);
|
|
347
|
+
const [endX, endY] = pointOnArchitecturalCloud(segmentEnd, innerRx, innerRy);
|
|
338
348
|
segments.push(
|
|
339
349
|
`Q${svgNumber(controlX)} ${svgNumber(controlY)} ${svgNumber(endX)} ${svgNumber(endY)}`
|
|
340
350
|
);
|
|
@@ -3096,7 +3106,7 @@ function ShapeContextMenu({
|
|
|
3096
3106
|
}
|
|
3097
3107
|
return createPortal(menu, document.body);
|
|
3098
3108
|
}
|
|
3099
|
-
var architecturalCloudIconPath = "
|
|
3109
|
+
var architecturalCloudIconPath = "M11 3 Q15.72 1.11 16.44 3.31 Q19.25 2.05 18.39 4.28 Q20.81 4.17 19 7 Q20.81 9.83 18.39 9.72 Q19.25 11.95 16.44 10.69 Q15.72 12.89 11 11 Q6.28 12.89 5.56 10.69 Q2.75 11.95 3.61 9.72 Q1.19 9.83 3 7 Q1.19 4.17 3.61 4.28 Q2.75 2.05 5.56 3.31 Q6.28 1.11 11 3 Z";
|
|
3100
3110
|
var base = {
|
|
3101
3111
|
width: 20,
|
|
3102
3112
|
height: 20,
|
|
@@ -3128,7 +3138,7 @@ function IconEllipse(props) {
|
|
|
3128
3138
|
return /* @__PURE__ */ jsx("svg", { ...base, ...props, "aria-hidden": true, children: /* @__PURE__ */ jsx("ellipse", { cx: "12", cy: "12", rx: "9", ry: "6" }) });
|
|
3129
3139
|
}
|
|
3130
3140
|
function IconArchitecturalCloud(props) {
|
|
3131
|
-
return /* @__PURE__ */ jsx("svg", { ...base, ...props, "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: architecturalCloudIconPath, transform: "translate(
|
|
3141
|
+
return /* @__PURE__ */ jsx("svg", { ...base, ...props, "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: architecturalCloudIconPath, transform: "translate(1 5)" }) });
|
|
3132
3142
|
}
|
|
3133
3143
|
function IconLine(props) {
|
|
3134
3144
|
return /* @__PURE__ */ jsx("svg", { ...base, ...props, "aria-hidden": true, children: /* @__PURE__ */ jsx("line", { x1: "5", y1: "19", x2: "19", y2: "5" }) });
|