canvu-react 0.4.21 → 0.4.22
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/native.cjs +32 -0
- package/dist/native.cjs.map +1 -1
- package/dist/native.js +32 -0
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.js
CHANGED
|
@@ -3830,6 +3830,19 @@ function hitTestNativeSelectionHandle({
|
|
|
3830
3830
|
);
|
|
3831
3831
|
return handle ? { kind: "resize", handle } : null;
|
|
3832
3832
|
}
|
|
3833
|
+
function pointInNativeSelectedItemBounds(item, worldPoint) {
|
|
3834
|
+
const bounds = normalizeRect(item.bounds);
|
|
3835
|
+
const local = worldToItemLocal(
|
|
3836
|
+
worldPoint.x,
|
|
3837
|
+
worldPoint.y,
|
|
3838
|
+
item.x,
|
|
3839
|
+
item.y,
|
|
3840
|
+
bounds.width,
|
|
3841
|
+
bounds.height,
|
|
3842
|
+
item.rotation ?? 0
|
|
3843
|
+
);
|
|
3844
|
+
return local.x >= 0 && local.x <= bounds.width && local.y >= 0 && local.y <= bounds.height;
|
|
3845
|
+
}
|
|
3833
3846
|
function resolveNativeCustomPlacement(toolId, customPlacement, customPlacements) {
|
|
3834
3847
|
if (customPlacement?.toolId === toolId) return customPlacement;
|
|
3835
3848
|
return customPlacements?.find((placement) => placement.toolId === toolId) ?? null;
|
|
@@ -4154,6 +4167,25 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4154
4167
|
onSelectionChangeRef.current?.([hit.id]);
|
|
4155
4168
|
}
|
|
4156
4169
|
} else {
|
|
4170
|
+
const selectedUnlockedItems = currentSelectedIds.map((id) => itemsRef.current.find((item) => item.id === id)).filter((item) => !!item && !item.locked);
|
|
4171
|
+
if (selectedUnlockedItems.some(
|
|
4172
|
+
(item) => pointInNativeSelectedItemBounds(item, { x: worldX, y: worldY })
|
|
4173
|
+
)) {
|
|
4174
|
+
const snapshots = {};
|
|
4175
|
+
for (const item of selectedUnlockedItems) {
|
|
4176
|
+
snapshots[item.id] = item;
|
|
4177
|
+
}
|
|
4178
|
+
const ids = Object.keys(snapshots);
|
|
4179
|
+
if (ids.length > 0) {
|
|
4180
|
+
dragStateRef.current = {
|
|
4181
|
+
kind: "move",
|
|
4182
|
+
ids,
|
|
4183
|
+
snapshots,
|
|
4184
|
+
startWorld: { x: worldX, y: worldY }
|
|
4185
|
+
};
|
|
4186
|
+
return;
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4157
4189
|
onSelectionChangeRef.current?.([]);
|
|
4158
4190
|
dragStateRef.current = {
|
|
4159
4191
|
kind: "marquee",
|