canvu-react 0.4.31 → 0.4.33
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-CWhld14A.d.cts → asset-hydration-BFGZ3igr.d.cts} +1 -1
- package/dist/{asset-hydration-D35mHbUP.d.ts → asset-hydration-D6Q3TJL1.d.ts} +1 -1
- package/dist/chatbot.d.cts +2 -2
- package/dist/chatbot.d.ts +2 -2
- package/dist/index.cjs +173 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +173 -102
- package/dist/index.js.map +1 -1
- package/dist/{link-item-D870_X6P.d.cts → link-item-Dncuz2d_.d.cts} +3 -3
- package/dist/{link-item-Bg5vj0RI.d.ts → link-item-voRU0Up9.d.ts} +3 -3
- package/dist/native.cjs +220 -3
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +220 -3
- package/dist/native.js.map +1 -1
- package/dist/react.cjs +244 -18
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +6 -6
- package/dist/react.d.ts +6 -6
- package/dist/react.js +244 -18
- package/dist/react.js.map +1 -1
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.d.cts +3 -3
- package/dist/realtime.d.ts +3 -3
- package/dist/realtime.js.map +1 -1
- package/dist/tldraw.cjs +121 -39
- package/dist/tldraw.cjs.map +1 -1
- package/dist/tldraw.js +121 -39
- package/dist/tldraw.js.map +1 -1
- package/dist/{types-Bw1SdC9v.d.cts → types-BS-YG8Hx.d.cts} +1 -1
- package/dist/{types-DeXFfs7Y.d.ts → types-UZYYwK-v.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -132,7 +132,7 @@ type CanvuLinkData = {
|
|
|
132
132
|
* Builds the inner SVG (no outer `<svg>`) for a link/bookmark card at the given box size.
|
|
133
133
|
* Uses fixed pixel bands so text never overlaps regardless of the card's aspect ratio.
|
|
134
134
|
*/
|
|
135
|
-
declare function buildLinkCardSvg(width: number,
|
|
135
|
+
declare function buildLinkCardSvg(width: number, _height: number, link: CanvuLinkData): string;
|
|
136
136
|
/** Reads the link metadata from an item, or `null` when the item is not a link. */
|
|
137
137
|
declare function getLinkData(item: VectorSceneItem): CanvuLinkData | null;
|
|
138
138
|
/** True when the item carries link metadata (clickable card). */
|
|
@@ -144,8 +144,8 @@ declare function isLinkItem(item: VectorSceneItem): boolean;
|
|
|
144
144
|
declare function createLinkItem(id: string, bounds: Rect, link: CanvuLinkData): VectorSceneItem;
|
|
145
145
|
/** Default card size used when placing a new link without explicit bounds. */
|
|
146
146
|
declare const DEFAULT_LINK_CARD_SIZE: {
|
|
147
|
-
readonly width:
|
|
148
|
-
readonly height:
|
|
147
|
+
readonly width: 320;
|
|
148
|
+
readonly height: 70;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export { type CanvuLinkData as C, DEFAULT_LINK_CARD_SIZE as D, LINK_PLUGIN_KEY as L, type VectorViewportAssetKind as V, type VectorViewportAssetStore as a, buildLinkCardSvg as b, createLinkItem as c, type VectorViewportAssetHydrationRequest as d, type VectorViewportAssetResolveRequest as e, type VectorViewportAssetResolveResult as f, getLinkData as g, type VectorViewportAssetUploadRequest as h, isLinkItem as i, type VectorViewportAssetUploadResult as j };
|
|
@@ -132,7 +132,7 @@ type CanvuLinkData = {
|
|
|
132
132
|
* Builds the inner SVG (no outer `<svg>`) for a link/bookmark card at the given box size.
|
|
133
133
|
* Uses fixed pixel bands so text never overlaps regardless of the card's aspect ratio.
|
|
134
134
|
*/
|
|
135
|
-
declare function buildLinkCardSvg(width: number,
|
|
135
|
+
declare function buildLinkCardSvg(width: number, _height: number, link: CanvuLinkData): string;
|
|
136
136
|
/** Reads the link metadata from an item, or `null` when the item is not a link. */
|
|
137
137
|
declare function getLinkData(item: VectorSceneItem): CanvuLinkData | null;
|
|
138
138
|
/** True when the item carries link metadata (clickable card). */
|
|
@@ -144,8 +144,8 @@ declare function isLinkItem(item: VectorSceneItem): boolean;
|
|
|
144
144
|
declare function createLinkItem(id: string, bounds: Rect, link: CanvuLinkData): VectorSceneItem;
|
|
145
145
|
/** Default card size used when placing a new link without explicit bounds. */
|
|
146
146
|
declare const DEFAULT_LINK_CARD_SIZE: {
|
|
147
|
-
readonly width:
|
|
148
|
-
readonly height:
|
|
147
|
+
readonly width: 320;
|
|
148
|
+
readonly height: 70;
|
|
149
149
|
};
|
|
150
150
|
|
|
151
151
|
export { type CanvuLinkData as C, DEFAULT_LINK_CARD_SIZE as D, LINK_PLUGIN_KEY as L, type VectorViewportAssetKind as V, type VectorViewportAssetStore as a, buildLinkCardSvg as b, createLinkItem as c, type VectorViewportAssetHydrationRequest as d, type VectorViewportAssetResolveRequest as e, type VectorViewportAssetResolveResult as f, getLinkData as g, type VectorViewportAssetUploadRequest as h, isLinkItem as i, type VectorViewportAssetUploadResult as j };
|
package/dist/native.cjs
CHANGED
|
@@ -35,11 +35,156 @@ function buildCustomShapeChildrenSvg(inner, intrinsic, bounds) {
|
|
|
35
35
|
return `<g transform="scale(${sx},${sy})">${inner}</g>`;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
// src/scene/link-item.ts
|
|
39
|
+
var LINK_PLUGIN_KEY = "canvuLink";
|
|
40
|
+
var DEFAULT_LINK_CARD_WIDTH = 320;
|
|
41
|
+
var DEFAULT_LINK_CARD_HEIGHT = 70;
|
|
42
|
+
var LINK_CARD_MIN_SCALE = 0.6;
|
|
43
|
+
var LINK_CARD_MAX_SCALE = 6;
|
|
44
|
+
var LINK_CARD_ASPECT = DEFAULT_LINK_CARD_WIDTH / DEFAULT_LINK_CARD_HEIGHT;
|
|
45
|
+
var LINK_CARD_BORDER = "oklch(0.918 0.008 255)";
|
|
46
|
+
var LINK_CARD_BORDER_STRONG = "oklch(0.86 0.012 255)";
|
|
47
|
+
var LINK_CARD_ACCENT = "oklch(0.55 0.19 264)";
|
|
48
|
+
var LINK_CARD_ACCENT_DEEP = "oklch(0.46 0.18 264)";
|
|
49
|
+
var LINK_CARD_TITLE_COLOR = "oklch(0.26 0.022 265)";
|
|
50
|
+
var LINK_CARD_TEXT_COLOR = "oklch(0.55 0.022 265)";
|
|
51
|
+
var clamp = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
52
|
+
var formatNumber = (value) => {
|
|
53
|
+
const rounded = Math.round(value * 100) / 100;
|
|
54
|
+
return Object.is(rounded, -0) ? "0" : String(rounded);
|
|
55
|
+
};
|
|
56
|
+
var escapeHtmlText = (value) => value.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
57
|
+
var getLinkHostname = (href) => {
|
|
58
|
+
try {
|
|
59
|
+
return new URL(href).hostname.replace(/^www\./, "");
|
|
60
|
+
} catch {
|
|
61
|
+
return href;
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
var buildLinkTextBand = (band) => {
|
|
65
|
+
const lineHeight = band.height;
|
|
66
|
+
const weight = band.fontWeight != null ? `font-weight:${band.fontWeight};` : "";
|
|
67
|
+
return `<foreignObject x="${formatNumber(band.x)}" y="${formatNumber(band.y)}" width="${formatNumber(Math.max(1, band.width))}" height="${formatNumber(Math.max(1, band.height))}"><div xmlns="http://www.w3.org/1999/xhtml" style="box-sizing:border-box;width:100%;height:100%;margin:0;font-family:system-ui,sans-serif;font-size:${formatNumber(band.fontSize)}px;line-height:${formatNumber(lineHeight)}px;letter-spacing:-0.01em;color:${band.color};overflow:hidden;white-space:nowrap;text-overflow:ellipsis;${weight}">${escapeHtmlText(band.text)}</div></foreignObject>`;
|
|
68
|
+
};
|
|
69
|
+
var getLinkProtocol = (href) => {
|
|
70
|
+
try {
|
|
71
|
+
return new URL(href).protocol;
|
|
72
|
+
} catch {
|
|
73
|
+
return "";
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var getLinkInitial = (hostname) => {
|
|
77
|
+
const first = hostname.trim().charAt(0).toUpperCase();
|
|
78
|
+
return first || "L";
|
|
79
|
+
};
|
|
80
|
+
var getStableLinkIdSuffix = (value) => {
|
|
81
|
+
let hash = 0;
|
|
82
|
+
for (const char of value) {
|
|
83
|
+
hash = hash * 31 + char.charCodeAt(0) >>> 0;
|
|
84
|
+
}
|
|
85
|
+
return hash.toString(36);
|
|
86
|
+
};
|
|
87
|
+
function buildLinkCardSvg(width, _height, link) {
|
|
88
|
+
const cardWidth = Math.max(1, width);
|
|
89
|
+
const scale = cardWidth / DEFAULT_LINK_CARD_WIDTH;
|
|
90
|
+
const contentWidth = DEFAULT_LINK_CARD_WIDTH;
|
|
91
|
+
const contentHeight = DEFAULT_LINK_CARD_HEIGHT;
|
|
92
|
+
const padding = 14;
|
|
93
|
+
const badgeSize = 42;
|
|
94
|
+
const gap = 13;
|
|
95
|
+
const buttonSize = 34;
|
|
96
|
+
const textX = padding + badgeSize + gap;
|
|
97
|
+
const textWidth = Math.max(1, contentWidth - textX - buttonSize - gap - padding);
|
|
98
|
+
const hostname = getLinkHostname(link.href);
|
|
99
|
+
const title = link.title?.trim() || hostname || "Link";
|
|
100
|
+
const protocol = getLinkProtocol(link.href);
|
|
101
|
+
const subtitle = hostname || link.href;
|
|
102
|
+
const idSuffix = getStableLinkIdSuffix(`${hostname}:${link.href}`);
|
|
103
|
+
const gradientId = `canvu-link-favicon-gradient-${idSuffix}`;
|
|
104
|
+
const buttonX = contentWidth - padding - buttonSize;
|
|
105
|
+
const buttonY = (contentHeight - buttonSize) / 2;
|
|
106
|
+
const isSecure = protocol === "https:";
|
|
107
|
+
const subtitleX = isSecure ? textX + 13 : textX;
|
|
108
|
+
const subtitleWidth = isSecure ? textWidth - 13 : textWidth;
|
|
109
|
+
return `
|
|
110
|
+
<style>
|
|
111
|
+
.canvu-link-card-root .canvu-link-card { transition: transform .18s ease, filter .18s ease, stroke .18s ease; }
|
|
112
|
+
.canvu-link-card-root .canvu-link-open { opacity: 0; transform: translateX(-4px); transition: opacity .18s ease, transform .18s ease; }
|
|
113
|
+
.canvu-link-card-root:hover .canvu-link-card { transform: translateY(-2px); filter: drop-shadow(0 4px 14px oklch(0.4 0.05 265 / .08)) drop-shadow(0 1px 3px oklch(0.4 0.05 265 / .06)); stroke: ${LINK_CARD_BORDER_STRONG}; }
|
|
114
|
+
.canvu-link-card-root:hover .canvu-link-open { opacity: 1; transform: translateX(0); }
|
|
115
|
+
</style>
|
|
116
|
+
<g class="canvu-link-card-root" transform="scale(${formatNumber(scale)})">
|
|
117
|
+
<rect class="canvu-link-card" width="${formatNumber(contentWidth)}" height="${formatNumber(contentHeight)}" rx="16" fill="#ffffff" stroke="${LINK_CARD_BORDER}" stroke-width="1" filter="drop-shadow(0 1px 2px oklch(0.4 0.03 265 / .05)) drop-shadow(0 1px 1px oklch(0.4 0.03 265 / .04))" />
|
|
118
|
+
<defs>
|
|
119
|
+
<linearGradient id="${gradientId}" x1="8" y1="48" x2="48" y2="8" gradientUnits="userSpaceOnUse">
|
|
120
|
+
<stop stop-color="${LINK_CARD_ACCENT}" />
|
|
121
|
+
<stop offset="1" stop-color="${LINK_CARD_ACCENT_DEEP}" />
|
|
122
|
+
</linearGradient>
|
|
123
|
+
</defs>
|
|
124
|
+
<rect x="${formatNumber(padding)}" y="${formatNumber(padding)}" width="${formatNumber(badgeSize)}" height="${formatNumber(badgeSize)}" rx="11" fill="url(#${gradientId})" />
|
|
125
|
+
<text x="${formatNumber(padding + badgeSize / 2)}" y="${formatNumber(padding + badgeSize / 2 + 5)}" text-anchor="middle" font-family="system-ui,sans-serif" font-size="17" font-weight="700" fill="#ffffff">${escapeHtmlText(getLinkInitial(hostname))}</text>
|
|
126
|
+
${buildLinkTextBand({ x: textX, y: 16, width: textWidth, height: 19, text: title, fontSize: 14.5, color: LINK_CARD_TITLE_COLOR, fontWeight: 700 })}
|
|
127
|
+
${isSecure ? `<g transform="translate(${formatNumber(textX)},40)" stroke="${LINK_CARD_TEXT_COLOR}" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round" fill="none"><rect x="1.5" y="4.5" width="7" height="6" rx="1" /><path d="M3 4.5 V3 a2 2 0 0 1 4 0 v1.5" /></g>` : ""}
|
|
128
|
+
${buildLinkTextBand({ x: subtitleX, y: 36, width: subtitleWidth, height: 17, text: subtitle, fontSize: 12.5, color: LINK_CARD_TEXT_COLOR })}
|
|
129
|
+
<g class="canvu-link-open" transform="translate(${formatNumber(buttonX)},${formatNumber(buttonY)})">
|
|
130
|
+
<rect width="${formatNumber(buttonSize)}" height="${formatNumber(buttonSize)}" rx="10" fill="#ffffff" stroke="${LINK_CARD_BORDER}" stroke-width="1" />
|
|
131
|
+
<g transform="translate(10,10)" stroke="${LINK_CARD_TEXT_COLOR}" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" fill="none">
|
|
132
|
+
<path d="M8 2 H14 V8" />
|
|
133
|
+
<path d="M14 2 L7 9" />
|
|
134
|
+
<path d="M12 10 V13 a1 1 0 0 1 -1 1 H3 a1 1 0 0 1 -1 -1 V5 a1 1 0 0 1 1 -1 H6" />
|
|
135
|
+
</g>
|
|
136
|
+
</g>
|
|
137
|
+
</g>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
var isCanvuLinkData = (value) => {
|
|
141
|
+
if (!value || typeof value !== "object") return false;
|
|
142
|
+
const candidate = value;
|
|
143
|
+
return typeof candidate.href === "string" && candidate.href.length > 0;
|
|
144
|
+
};
|
|
145
|
+
function getLinkData(item) {
|
|
146
|
+
const entry = item.pluginData?.[LINK_PLUGIN_KEY];
|
|
147
|
+
return isCanvuLinkData(entry) ? entry : null;
|
|
148
|
+
}
|
|
149
|
+
function rebuildLinkItemSvg(item) {
|
|
150
|
+
const link = getLinkData(item);
|
|
151
|
+
if (!link) return item;
|
|
152
|
+
const scale = clamp(
|
|
153
|
+
item.bounds.width / DEFAULT_LINK_CARD_WIDTH,
|
|
154
|
+
LINK_CARD_MIN_SCALE,
|
|
155
|
+
LINK_CARD_MAX_SCALE
|
|
156
|
+
);
|
|
157
|
+
const width = DEFAULT_LINK_CARD_WIDTH * scale;
|
|
158
|
+
const height = DEFAULT_LINK_CARD_HEIGHT * scale;
|
|
159
|
+
const bounds = {
|
|
160
|
+
...item.bounds,
|
|
161
|
+
width,
|
|
162
|
+
height
|
|
163
|
+
};
|
|
164
|
+
const customInnerSvg = buildLinkCardSvg(
|
|
165
|
+
DEFAULT_LINK_CARD_WIDTH,
|
|
166
|
+
DEFAULT_LINK_CARD_HEIGHT,
|
|
167
|
+
link
|
|
168
|
+
);
|
|
169
|
+
return {
|
|
170
|
+
...item,
|
|
171
|
+
x: bounds.x,
|
|
172
|
+
y: bounds.y,
|
|
173
|
+
bounds,
|
|
174
|
+
customIntrinsicSize: {
|
|
175
|
+
width: DEFAULT_LINK_CARD_WIDTH,
|
|
176
|
+
height: DEFAULT_LINK_CARD_HEIGHT
|
|
177
|
+
},
|
|
178
|
+
customInnerSvg,
|
|
179
|
+
childrenSvg: buildLinkCardSvg(width, height, link)
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
|
|
38
183
|
// src/scene/text-svg.ts
|
|
39
184
|
function escapeSvgTextContent(s) {
|
|
40
185
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
41
186
|
}
|
|
42
|
-
function
|
|
187
|
+
function escapeHtmlText2(s) {
|
|
43
188
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
44
189
|
}
|
|
45
190
|
var DEFAULT_TEXT_FONT_SIZE = 18;
|
|
@@ -154,9 +299,9 @@ function buildTextFixedBoundsSvg(content, width, height, fillColor = "#1d1d1d",
|
|
|
154
299
|
const trimmed = content.trim();
|
|
155
300
|
const padTop = EDIT_TOP_PAD_RATIO * fontSize;
|
|
156
301
|
if (trimmed.length === 0) {
|
|
157
|
-
return `<foreignObject width="${w}" height="${h}"><div xmlns="http://www.w3.org/1999/xhtml" style="box-sizing:border-box;width:100%;height:100%;margin:0;padding:${padTop}px 4px 0 4px;font-size:${fontSize}px;line-height:${lh}px;font-family:${TEXT_FONT_FAMILY};white-space:pre-wrap;word-wrap:break-word;overflow:hidden;color:#94a3b8;font-style:italic">${
|
|
302
|
+
return `<foreignObject width="${w}" height="${h}"><div xmlns="http://www.w3.org/1999/xhtml" style="box-sizing:border-box;width:100%;height:100%;margin:0;padding:${padTop}px 4px 0 4px;font-size:${fontSize}px;line-height:${lh}px;font-family:${TEXT_FONT_FAMILY};white-space:pre-wrap;word-wrap:break-word;overflow:hidden;color:#94a3b8;font-style:italic">${escapeHtmlText2(PLACEHOLDER)}</div></foreignObject>`;
|
|
158
303
|
}
|
|
159
|
-
const body =
|
|
304
|
+
const body = escapeHtmlText2(content);
|
|
160
305
|
return `<foreignObject width="${w}" height="${h}"><div xmlns="http://www.w3.org/1999/xhtml" style="box-sizing:border-box;width:100%;height:100%;margin:0;padding:${padTop}px 4px 0 4px;font-size:${fontSize}px;line-height:${lh}px;font-family:${TEXT_FONT_FAMILY};white-space:pre-wrap;word-wrap:break-word;overflow:hidden;color:${fillColor}">${body}</div></foreignObject>`;
|
|
161
306
|
}
|
|
162
307
|
|
|
@@ -754,6 +899,9 @@ function rebuildItemSvg(item) {
|
|
|
754
899
|
)
|
|
755
900
|
};
|
|
756
901
|
}
|
|
902
|
+
if (getLinkData(item)) {
|
|
903
|
+
return rebuildLinkItemSvg(item);
|
|
904
|
+
}
|
|
757
905
|
if (k === "custom" && item.customIntrinsicSize && item.customInnerSvg) {
|
|
758
906
|
const b = normalizeRect(item.bounds);
|
|
759
907
|
return {
|
|
@@ -3716,8 +3864,77 @@ function collectEraserTargetsAtWorldPoint(items, worldX, worldY, options) {
|
|
|
3716
3864
|
}
|
|
3717
3865
|
|
|
3718
3866
|
// src/interaction/mutations.ts
|
|
3867
|
+
var LINK_CORNER_HANDLES = /* @__PURE__ */ new Set(["nw", "ne", "se", "sw"]);
|
|
3868
|
+
var clamp2 = (value, min, max) => Math.min(max, Math.max(min, value));
|
|
3869
|
+
var clampLinkResizeBounds = (startBounds, nextBounds, handle, intrinsicWidth) => {
|
|
3870
|
+
const next = normalizeRect(nextBounds);
|
|
3871
|
+
const scale = clamp2(
|
|
3872
|
+
next.width / Math.max(1e-9, intrinsicWidth),
|
|
3873
|
+
LINK_CARD_MIN_SCALE,
|
|
3874
|
+
LINK_CARD_MAX_SCALE
|
|
3875
|
+
);
|
|
3876
|
+
const width = intrinsicWidth * scale;
|
|
3877
|
+
const height = width / LINK_CARD_ASPECT;
|
|
3878
|
+
const start = normalizeRect(startBounds);
|
|
3879
|
+
const x0 = start.x;
|
|
3880
|
+
const y0 = start.y;
|
|
3881
|
+
const x1 = start.x + start.width;
|
|
3882
|
+
const y1 = start.y + start.height;
|
|
3883
|
+
switch (handle) {
|
|
3884
|
+
case "nw":
|
|
3885
|
+
return { x: x1 - width, y: y1 - height, width, height };
|
|
3886
|
+
case "ne":
|
|
3887
|
+
return { x: x0, y: y1 - height, width, height };
|
|
3888
|
+
case "sw":
|
|
3889
|
+
return { x: x1 - width, y: y0, width, height };
|
|
3890
|
+
default:
|
|
3891
|
+
return { x: x0, y: y0, width, height };
|
|
3892
|
+
}
|
|
3893
|
+
};
|
|
3719
3894
|
function computeNewBoundsForResize(item, sb, handle, currentWorld) {
|
|
3720
3895
|
const rot = getItemRotationRad(item);
|
|
3896
|
+
const link = getLinkData(item);
|
|
3897
|
+
if (link && item.customIntrinsicSize) {
|
|
3898
|
+
if (!LINK_CORNER_HANDLES.has(handle)) return sb;
|
|
3899
|
+
const intrinsicWidth = Math.max(1e-9, item.customIntrinsicSize.width);
|
|
3900
|
+
if (Math.abs(rot) < 1e-12) {
|
|
3901
|
+
const next = computeResizeBoundsFixedAspect(
|
|
3902
|
+
sb,
|
|
3903
|
+
handle,
|
|
3904
|
+
currentWorld,
|
|
3905
|
+
LINK_CARD_ASPECT
|
|
3906
|
+
);
|
|
3907
|
+
return clampLinkResizeBounds(sb, next, handle, intrinsicWidth);
|
|
3908
|
+
}
|
|
3909
|
+
const local2 = worldToItemLocal(
|
|
3910
|
+
currentWorld.x,
|
|
3911
|
+
currentWorld.y,
|
|
3912
|
+
sb.x,
|
|
3913
|
+
sb.y,
|
|
3914
|
+
sb.width,
|
|
3915
|
+
sb.height,
|
|
3916
|
+
rot
|
|
3917
|
+
);
|
|
3918
|
+
const localBounds3 = { x: 0, y: 0, width: sb.width, height: sb.height };
|
|
3919
|
+
const nextLocal = computeResizeBoundsFixedAspect(
|
|
3920
|
+
localBounds3,
|
|
3921
|
+
handle,
|
|
3922
|
+
local2,
|
|
3923
|
+
LINK_CARD_ASPECT
|
|
3924
|
+
);
|
|
3925
|
+
const clamped = clampLinkResizeBounds(
|
|
3926
|
+
localBounds3,
|
|
3927
|
+
nextLocal,
|
|
3928
|
+
handle,
|
|
3929
|
+
intrinsicWidth
|
|
3930
|
+
);
|
|
3931
|
+
return {
|
|
3932
|
+
x: sb.x + clamped.x,
|
|
3933
|
+
y: sb.y + clamped.y,
|
|
3934
|
+
width: clamped.width,
|
|
3935
|
+
height: clamped.height
|
|
3936
|
+
};
|
|
3937
|
+
}
|
|
3721
3938
|
if (Math.abs(rot) < 1e-12) {
|
|
3722
3939
|
if (item.toolKind === "image") {
|
|
3723
3940
|
let aspect;
|