canvu-react 0.4.20 → 0.4.21
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 +15 -283
- package/dist/native.cjs.map +1 -1
- package/dist/native.d.cts +1 -19
- package/dist/native.d.ts +1 -19
- package/dist/native.js +15 -283
- package/dist/native.js.map +1 -1
- package/package.json +1 -1
package/dist/native.d.cts
CHANGED
|
@@ -12,16 +12,6 @@ type TimedTrailPoint = {
|
|
|
12
12
|
readonly t: number;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
type NativeVectorToolCursorKind = "crosshair" | "draw" | "marker" | "eraser" | "text";
|
|
16
|
-
type NativeVectorToolCursor = {
|
|
17
|
-
readonly kind: NativeVectorToolCursorKind;
|
|
18
|
-
readonly size: number;
|
|
19
|
-
readonly hotspot: {
|
|
20
|
-
readonly x: number;
|
|
21
|
-
readonly y: number;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
15
|
type PlacementPreview = {
|
|
26
16
|
readonly kind: "rect" | "ellipse" | "architectural-cloud";
|
|
27
17
|
readonly rect: {
|
|
@@ -68,15 +58,8 @@ type NativeInteractionOverlayProps = {
|
|
|
68
58
|
readonly laserTrail?: readonly TimedTrailPoint[];
|
|
69
59
|
readonly eraserPreviewItems?: readonly VectorSceneItem[];
|
|
70
60
|
readonly previewStrokeStyle?: StrokeStyle;
|
|
71
|
-
readonly toolCursor?: {
|
|
72
|
-
readonly cursor: NativeVectorToolCursor;
|
|
73
|
-
readonly point: {
|
|
74
|
-
readonly x: number;
|
|
75
|
-
readonly y: number;
|
|
76
|
-
};
|
|
77
|
-
} | null;
|
|
78
61
|
};
|
|
79
|
-
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle,
|
|
62
|
+
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
80
63
|
|
|
81
64
|
type NativeSceneRendererProps = {
|
|
82
65
|
readonly items: readonly VectorSceneItem[];
|
|
@@ -241,7 +224,6 @@ type NativeVectorViewportProps = {
|
|
|
241
224
|
readonly onCameraChange?: () => void;
|
|
242
225
|
readonly customPlacement?: NativeCustomShapePlacementOptions;
|
|
243
226
|
readonly customPlacements?: readonly NativeCustomShapePlacementOptions[];
|
|
244
|
-
readonly customCrosshairToolIds?: readonly string[];
|
|
245
227
|
readonly toolbar?: React.ReactNode;
|
|
246
228
|
readonly showStyleInspector?: boolean;
|
|
247
229
|
readonly styleInspectorPlacement?: "bottom" | "top-left";
|
package/dist/native.d.ts
CHANGED
|
@@ -12,16 +12,6 @@ type TimedTrailPoint = {
|
|
|
12
12
|
readonly t: number;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
type NativeVectorToolCursorKind = "crosshair" | "draw" | "marker" | "eraser" | "text";
|
|
16
|
-
type NativeVectorToolCursor = {
|
|
17
|
-
readonly kind: NativeVectorToolCursorKind;
|
|
18
|
-
readonly size: number;
|
|
19
|
-
readonly hotspot: {
|
|
20
|
-
readonly x: number;
|
|
21
|
-
readonly y: number;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
|
|
25
15
|
type PlacementPreview = {
|
|
26
16
|
readonly kind: "rect" | "ellipse" | "architectural-cloud";
|
|
27
17
|
readonly rect: {
|
|
@@ -68,15 +58,8 @@ type NativeInteractionOverlayProps = {
|
|
|
68
58
|
readonly laserTrail?: readonly TimedTrailPoint[];
|
|
69
59
|
readonly eraserPreviewItems?: readonly VectorSceneItem[];
|
|
70
60
|
readonly previewStrokeStyle?: StrokeStyle;
|
|
71
|
-
readonly toolCursor?: {
|
|
72
|
-
readonly cursor: NativeVectorToolCursor;
|
|
73
|
-
readonly point: {
|
|
74
|
-
readonly x: number;
|
|
75
|
-
readonly y: number;
|
|
76
|
-
};
|
|
77
|
-
} | null;
|
|
78
61
|
};
|
|
79
|
-
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle,
|
|
62
|
+
declare function NativeInteractionOverlay({ camera, width, height, selectedItems, showResizeHandles, placementPreview, eraserTrail, laserTrail, eraserPreviewItems, previewStrokeStyle, }: NativeInteractionOverlayProps): react_jsx_runtime.JSX.Element | null;
|
|
80
63
|
|
|
81
64
|
type NativeSceneRendererProps = {
|
|
82
65
|
readonly items: readonly VectorSceneItem[];
|
|
@@ -241,7 +224,6 @@ type NativeVectorViewportProps = {
|
|
|
241
224
|
readonly onCameraChange?: () => void;
|
|
242
225
|
readonly customPlacement?: NativeCustomShapePlacementOptions;
|
|
243
226
|
readonly customPlacements?: readonly NativeCustomShapePlacementOptions[];
|
|
244
|
-
readonly customCrosshairToolIds?: readonly string[];
|
|
245
227
|
readonly toolbar?: React.ReactNode;
|
|
246
228
|
readonly showStyleInspector?: boolean;
|
|
247
229
|
readonly styleInspectorPlacement?: "bottom" | "top-left";
|
package/dist/native.js
CHANGED
|
@@ -1998,178 +1998,6 @@ function NativeShapeRenderer({ item }) {
|
|
|
1998
1998
|
}
|
|
1999
1999
|
return null;
|
|
2000
2000
|
}
|
|
2001
|
-
var CURSOR_STROKE = "#18181b";
|
|
2002
|
-
var CURSOR_STROKE_WIDTH = 2;
|
|
2003
|
-
var CROSSHAIR_STROKE_WIDTH = 1.5;
|
|
2004
|
-
function NativeDrawCursor() {
|
|
2005
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2006
|
-
/* @__PURE__ */ jsx(
|
|
2007
|
-
Path,
|
|
2008
|
-
{
|
|
2009
|
-
path: "M13 21h8",
|
|
2010
|
-
color: CURSOR_STROKE,
|
|
2011
|
-
style: "stroke",
|
|
2012
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2013
|
-
strokeCap: "round",
|
|
2014
|
-
strokeJoin: "round",
|
|
2015
|
-
antiAlias: true
|
|
2016
|
-
}
|
|
2017
|
-
),
|
|
2018
|
-
/* @__PURE__ */ jsx(
|
|
2019
|
-
Path,
|
|
2020
|
-
{
|
|
2021
|
-
path: "M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",
|
|
2022
|
-
color: CURSOR_STROKE,
|
|
2023
|
-
style: "stroke",
|
|
2024
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2025
|
-
strokeCap: "round",
|
|
2026
|
-
strokeJoin: "round",
|
|
2027
|
-
antiAlias: true
|
|
2028
|
-
}
|
|
2029
|
-
)
|
|
2030
|
-
] });
|
|
2031
|
-
}
|
|
2032
|
-
function NativeMarkerCursor() {
|
|
2033
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2034
|
-
/* @__PURE__ */ jsx(
|
|
2035
|
-
Path,
|
|
2036
|
-
{
|
|
2037
|
-
path: "m9 11-6 6v3h9l3-3",
|
|
2038
|
-
color: CURSOR_STROKE,
|
|
2039
|
-
style: "stroke",
|
|
2040
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2041
|
-
strokeCap: "round",
|
|
2042
|
-
strokeJoin: "round",
|
|
2043
|
-
antiAlias: true
|
|
2044
|
-
}
|
|
2045
|
-
),
|
|
2046
|
-
/* @__PURE__ */ jsx(
|
|
2047
|
-
Path,
|
|
2048
|
-
{
|
|
2049
|
-
path: "m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",
|
|
2050
|
-
color: CURSOR_STROKE,
|
|
2051
|
-
style: "stroke",
|
|
2052
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2053
|
-
strokeCap: "round",
|
|
2054
|
-
strokeJoin: "round",
|
|
2055
|
-
antiAlias: true
|
|
2056
|
-
}
|
|
2057
|
-
)
|
|
2058
|
-
] });
|
|
2059
|
-
}
|
|
2060
|
-
function NativeEraserCursor() {
|
|
2061
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2062
|
-
/* @__PURE__ */ jsx(
|
|
2063
|
-
Path,
|
|
2064
|
-
{
|
|
2065
|
-
path: "M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",
|
|
2066
|
-
color: CURSOR_STROKE,
|
|
2067
|
-
style: "stroke",
|
|
2068
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2069
|
-
strokeCap: "round",
|
|
2070
|
-
strokeJoin: "round",
|
|
2071
|
-
antiAlias: true
|
|
2072
|
-
}
|
|
2073
|
-
),
|
|
2074
|
-
/* @__PURE__ */ jsx(
|
|
2075
|
-
Path,
|
|
2076
|
-
{
|
|
2077
|
-
path: "m5.082 11.09 8.828 8.828",
|
|
2078
|
-
color: CURSOR_STROKE,
|
|
2079
|
-
style: "stroke",
|
|
2080
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2081
|
-
strokeCap: "round",
|
|
2082
|
-
strokeJoin: "round",
|
|
2083
|
-
antiAlias: true
|
|
2084
|
-
}
|
|
2085
|
-
)
|
|
2086
|
-
] });
|
|
2087
|
-
}
|
|
2088
|
-
function NativeCrosshairCursor() {
|
|
2089
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2090
|
-
/* @__PURE__ */ jsx(
|
|
2091
|
-
Line,
|
|
2092
|
-
{
|
|
2093
|
-
p1: vec(12, 3),
|
|
2094
|
-
p2: vec(12, 21),
|
|
2095
|
-
color: CURSOR_STROKE,
|
|
2096
|
-
style: "stroke",
|
|
2097
|
-
strokeWidth: CROSSHAIR_STROKE_WIDTH,
|
|
2098
|
-
strokeCap: "round",
|
|
2099
|
-
antiAlias: true
|
|
2100
|
-
}
|
|
2101
|
-
),
|
|
2102
|
-
/* @__PURE__ */ jsx(
|
|
2103
|
-
Line,
|
|
2104
|
-
{
|
|
2105
|
-
p1: vec(3, 12),
|
|
2106
|
-
p2: vec(21, 12),
|
|
2107
|
-
color: CURSOR_STROKE,
|
|
2108
|
-
style: "stroke",
|
|
2109
|
-
strokeWidth: CROSSHAIR_STROKE_WIDTH,
|
|
2110
|
-
strokeCap: "round",
|
|
2111
|
-
antiAlias: true
|
|
2112
|
-
}
|
|
2113
|
-
)
|
|
2114
|
-
] });
|
|
2115
|
-
}
|
|
2116
|
-
function NativeTextCursor() {
|
|
2117
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2118
|
-
/* @__PURE__ */ jsx(
|
|
2119
|
-
Line,
|
|
2120
|
-
{
|
|
2121
|
-
p1: vec(12, 4),
|
|
2122
|
-
p2: vec(12, 20),
|
|
2123
|
-
color: CURSOR_STROKE,
|
|
2124
|
-
style: "stroke",
|
|
2125
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2126
|
-
strokeCap: "round",
|
|
2127
|
-
antiAlias: true
|
|
2128
|
-
}
|
|
2129
|
-
),
|
|
2130
|
-
/* @__PURE__ */ jsx(
|
|
2131
|
-
Line,
|
|
2132
|
-
{
|
|
2133
|
-
p1: vec(8, 4),
|
|
2134
|
-
p2: vec(16, 4),
|
|
2135
|
-
color: CURSOR_STROKE,
|
|
2136
|
-
style: "stroke",
|
|
2137
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2138
|
-
strokeCap: "round",
|
|
2139
|
-
antiAlias: true
|
|
2140
|
-
}
|
|
2141
|
-
),
|
|
2142
|
-
/* @__PURE__ */ jsx(
|
|
2143
|
-
Line,
|
|
2144
|
-
{
|
|
2145
|
-
p1: vec(8, 20),
|
|
2146
|
-
p2: vec(16, 20),
|
|
2147
|
-
color: CURSOR_STROKE,
|
|
2148
|
-
style: "stroke",
|
|
2149
|
-
strokeWidth: CURSOR_STROKE_WIDTH,
|
|
2150
|
-
strokeCap: "round",
|
|
2151
|
-
antiAlias: true
|
|
2152
|
-
}
|
|
2153
|
-
)
|
|
2154
|
-
] });
|
|
2155
|
-
}
|
|
2156
|
-
function NativeToolCursorGlyph({
|
|
2157
|
-
cursor
|
|
2158
|
-
}) {
|
|
2159
|
-
if (cursor.kind === "draw") return /* @__PURE__ */ jsx(NativeDrawCursor, {});
|
|
2160
|
-
if (cursor.kind === "marker") return /* @__PURE__ */ jsx(NativeMarkerCursor, {});
|
|
2161
|
-
if (cursor.kind === "eraser") return /* @__PURE__ */ jsx(NativeEraserCursor, {});
|
|
2162
|
-
if (cursor.kind === "text") return /* @__PURE__ */ jsx(NativeTextCursor, {});
|
|
2163
|
-
return /* @__PURE__ */ jsx(NativeCrosshairCursor, {});
|
|
2164
|
-
}
|
|
2165
|
-
function NativeToolCursorRenderer({
|
|
2166
|
-
cursor,
|
|
2167
|
-
point
|
|
2168
|
-
}) {
|
|
2169
|
-
const x = point.x - cursor.hotspot.x;
|
|
2170
|
-
const y = point.y - cursor.hotspot.y;
|
|
2171
|
-
return /* @__PURE__ */ jsx(Group, { transform: [{ translateX: x }, { translateY: y }], children: /* @__PURE__ */ jsx(NativeToolCursorGlyph, { cursor }) });
|
|
2172
|
-
}
|
|
2173
2001
|
|
|
2174
2002
|
// src/native/native-overlay-style.ts
|
|
2175
2003
|
var ERASER_TINT = "#cbd5e1";
|
|
@@ -2226,8 +2054,7 @@ function NativeInteractionOverlay({
|
|
|
2226
2054
|
eraserTrail,
|
|
2227
2055
|
laserTrail,
|
|
2228
2056
|
eraserPreviewItems = [],
|
|
2229
|
-
previewStrokeStyle
|
|
2230
|
-
toolCursor
|
|
2057
|
+
previewStrokeStyle
|
|
2231
2058
|
}) {
|
|
2232
2059
|
const z = camera.zoom;
|
|
2233
2060
|
const camTransform = skiaCameraTransform(z, camera.x, camera.y);
|
|
@@ -2604,7 +2431,7 @@ function NativeInteractionOverlay({
|
|
|
2604
2431
|
] });
|
|
2605
2432
|
}, [laserTrail, z]);
|
|
2606
2433
|
if (width <= 0 || height <= 0) return null;
|
|
2607
|
-
return /* @__PURE__ */
|
|
2434
|
+
return /* @__PURE__ */ jsx(
|
|
2608
2435
|
Canvas,
|
|
2609
2436
|
{
|
|
2610
2437
|
style: {
|
|
@@ -2615,22 +2442,13 @@ function NativeInteractionOverlay({
|
|
|
2615
2442
|
height
|
|
2616
2443
|
},
|
|
2617
2444
|
pointerEvents: "none",
|
|
2618
|
-
children: [
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
] }),
|
|
2626
|
-
toolCursor ? /* @__PURE__ */ jsx(
|
|
2627
|
-
NativeToolCursorRenderer,
|
|
2628
|
-
{
|
|
2629
|
-
cursor: toolCursor.cursor,
|
|
2630
|
-
point: toolCursor.point
|
|
2631
|
-
}
|
|
2632
|
-
) : null
|
|
2633
|
-
]
|
|
2445
|
+
children: /* @__PURE__ */ jsxs(Group, { transform: camTransform, children: [
|
|
2446
|
+
previewElements,
|
|
2447
|
+
laserTrailElements,
|
|
2448
|
+
eraserTrailElements,
|
|
2449
|
+
eraserPreviewElements,
|
|
2450
|
+
selectionElements
|
|
2451
|
+
] })
|
|
2634
2452
|
}
|
|
2635
2453
|
);
|
|
2636
2454
|
}
|
|
@@ -3968,39 +3786,6 @@ function resizeItemByHandle(item, start, handle, currentWorld) {
|
|
|
3968
3786
|
return { ...item, x: nb.x, y: nb.y, bounds: nb };
|
|
3969
3787
|
}
|
|
3970
3788
|
|
|
3971
|
-
// src/native/native-tool-cursors.ts
|
|
3972
|
-
var ICON_SIZE = 24;
|
|
3973
|
-
var CENTER_HOTSPOT = { x: 12, y: 12 };
|
|
3974
|
-
function nativeCursorForVectorToolId(toolId) {
|
|
3975
|
-
switch (toolId) {
|
|
3976
|
-
case "rect":
|
|
3977
|
-
case "ellipse":
|
|
3978
|
-
case "architectural-cloud":
|
|
3979
|
-
case "line":
|
|
3980
|
-
case "arrow":
|
|
3981
|
-
case "laser":
|
|
3982
|
-
case "image":
|
|
3983
|
-
return { kind: "crosshair", size: ICON_SIZE, hotspot: CENTER_HOTSPOT };
|
|
3984
|
-
case "draw":
|
|
3985
|
-
return { kind: "draw", size: ICON_SIZE, hotspot: { x: 4, y: 18 } };
|
|
3986
|
-
case "marker":
|
|
3987
|
-
return { kind: "marker", size: ICON_SIZE, hotspot: { x: 11, y: 14 } };
|
|
3988
|
-
case "eraser":
|
|
3989
|
-
return { kind: "eraser", size: ICON_SIZE, hotspot: { x: 12, y: 14 } };
|
|
3990
|
-
case "text":
|
|
3991
|
-
return { kind: "text", size: ICON_SIZE, hotspot: CENTER_HOTSPOT };
|
|
3992
|
-
default:
|
|
3993
|
-
return null;
|
|
3994
|
-
}
|
|
3995
|
-
}
|
|
3996
|
-
function nativeCrosshairToolCursor() {
|
|
3997
|
-
return { kind: "crosshair", size: ICON_SIZE, hotspot: CENTER_HOTSPOT };
|
|
3998
|
-
}
|
|
3999
|
-
function nativeFallbackToolCursorPoint(size) {
|
|
4000
|
-
if (size.width <= 0 || size.height <= 0) return null;
|
|
4001
|
-
return { x: size.width / 2, y: size.height / 2 };
|
|
4002
|
-
}
|
|
4003
|
-
|
|
4004
3789
|
// src/native/native-vector-interactions.ts
|
|
4005
3790
|
var NATIVE_SELECTION_HANDLE_HIT_RADIUS_PX = 24;
|
|
4006
3791
|
function supportsNativeResizeHandles(item) {
|
|
@@ -4145,7 +3930,6 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4145
3930
|
onCameraChange,
|
|
4146
3931
|
customPlacement,
|
|
4147
3932
|
customPlacements = [],
|
|
4148
|
-
customCrosshairToolIds = [],
|
|
4149
3933
|
toolbar,
|
|
4150
3934
|
showStyleInspector = false,
|
|
4151
3935
|
styleInspectorPlacement = "bottom"
|
|
@@ -4168,8 +3952,6 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4168
3952
|
customPlacementRef.current = customPlacement;
|
|
4169
3953
|
const customPlacementsRef = useRef(customPlacements);
|
|
4170
3954
|
customPlacementsRef.current = customPlacements;
|
|
4171
|
-
const customCrosshairToolIdsRef = useRef(customCrosshairToolIds);
|
|
4172
|
-
customCrosshairToolIdsRef.current = customCrosshairToolIds;
|
|
4173
3955
|
const onSelectionChangeRef = useRef(onSelectionChange);
|
|
4174
3956
|
onSelectionChangeRef.current = onSelectionChange;
|
|
4175
3957
|
const itemsRef = useRef(items);
|
|
@@ -4182,7 +3964,6 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4182
3964
|
);
|
|
4183
3965
|
const [eraserTrail, setEraserTrail] = useState([]);
|
|
4184
3966
|
const [laserTrail, setLaserTrail] = useState([]);
|
|
4185
|
-
const [toolCursorPoint, setToolCursorPoint] = useState(null);
|
|
4186
3967
|
const laserClearTimerRef = useRef(null);
|
|
4187
3968
|
const strokeStyleRef = useRef({ ...DEFAULT_STROKE_STYLE });
|
|
4188
3969
|
const markerStrokeStyleRef = useRef({ ...MARKER_TOOL_STYLE });
|
|
@@ -4277,60 +4058,14 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4277
4058
|
setCameraTick((n) => n + 1);
|
|
4278
4059
|
onCameraChangeRef.current?.();
|
|
4279
4060
|
}, []);
|
|
4280
|
-
const
|
|
4281
|
-
const
|
|
4282
|
-
|
|
4283
|
-
|
|
4061
|
+
const onLayout = useCallback((e) => {
|
|
4062
|
+
const { width, height } = e.nativeEvent.layout;
|
|
4063
|
+
setSize({ width, height });
|
|
4064
|
+
}, []);
|
|
4065
|
+
const updateToolCursorPoint = useCallback((_point) => {
|
|
4284
4066
|
}, []);
|
|
4285
|
-
const onLayout = useCallback(
|
|
4286
|
-
(e) => {
|
|
4287
|
-
const { width, height } = e.nativeEvent.layout;
|
|
4288
|
-
const nextSize = { width, height };
|
|
4289
|
-
setSize(nextSize);
|
|
4290
|
-
if (!interactive) {
|
|
4291
|
-
setToolCursorPoint(null);
|
|
4292
|
-
return;
|
|
4293
|
-
}
|
|
4294
|
-
if (!cursorForToolId(toolIdRef.current)) {
|
|
4295
|
-
setToolCursorPoint(null);
|
|
4296
|
-
return;
|
|
4297
|
-
}
|
|
4298
|
-
setToolCursorPoint(
|
|
4299
|
-
(current) => current ?? nativeFallbackToolCursorPoint(nextSize)
|
|
4300
|
-
);
|
|
4301
|
-
},
|
|
4302
|
-
[cursorForToolId, interactive]
|
|
4303
|
-
);
|
|
4304
|
-
const updateToolCursorPoint = useCallback(
|
|
4305
|
-
(point) => {
|
|
4306
|
-
if (!interactive) return;
|
|
4307
|
-
if (!cursorForToolId(toolIdRef.current)) return;
|
|
4308
|
-
setToolCursorPoint(point);
|
|
4309
|
-
},
|
|
4310
|
-
[cursorForToolId, interactive]
|
|
4311
|
-
);
|
|
4312
4067
|
const hideToolCursor = useCallback(() => {
|
|
4313
|
-
setToolCursorPoint(null);
|
|
4314
4068
|
}, []);
|
|
4315
|
-
const showFallbackToolCursor = useCallback(
|
|
4316
|
-
(nextToolId) => {
|
|
4317
|
-
if (!interactive) {
|
|
4318
|
-
setToolCursorPoint(null);
|
|
4319
|
-
return;
|
|
4320
|
-
}
|
|
4321
|
-
if (!cursorForToolId(nextToolId)) {
|
|
4322
|
-
setToolCursorPoint(null);
|
|
4323
|
-
return;
|
|
4324
|
-
}
|
|
4325
|
-
setToolCursorPoint(
|
|
4326
|
-
(current) => current ?? nativeFallbackToolCursorPoint(size)
|
|
4327
|
-
);
|
|
4328
|
-
},
|
|
4329
|
-
[cursorForToolId, interactive, size]
|
|
4330
|
-
);
|
|
4331
|
-
useEffect(() => {
|
|
4332
|
-
showFallbackToolCursor(toolId);
|
|
4333
|
-
}, [showFallbackToolCursor, toolId]);
|
|
4334
4069
|
const selectedItems = useMemo(
|
|
4335
4070
|
() => items.filter((it) => selectedIds.includes(it.id)),
|
|
4336
4071
|
[items, selectedIds]
|
|
@@ -4995,8 +4730,6 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
4995
4730
|
[requestRender, size]
|
|
4996
4731
|
);
|
|
4997
4732
|
const activeStyleToolId = toolId === "draw" || toolId === "marker" ? toolId : null;
|
|
4998
|
-
const activeToolCursor = cursorForToolId(toolId);
|
|
4999
|
-
const toolCursor = activeToolCursor && toolCursorPoint ? { cursor: activeToolCursor, point: toolCursorPoint } : null;
|
|
5000
4733
|
return /* @__PURE__ */ jsx(
|
|
5001
4734
|
View,
|
|
5002
4735
|
{
|
|
@@ -5032,8 +4765,7 @@ var NativeVectorViewport = forwardRef(function NativeVectorViewport2({
|
|
|
5032
4765
|
eraserPreviewItems: items.filter(
|
|
5033
4766
|
(it) => eraserPreviewIds.includes(it.id)
|
|
5034
4767
|
),
|
|
5035
|
-
previewStrokeStyle: strokeStyleState
|
|
5036
|
-
toolCursor
|
|
4768
|
+
previewStrokeStyle: strokeStyleState
|
|
5037
4769
|
}
|
|
5038
4770
|
),
|
|
5039
4771
|
interactive && showStyleInspector && activeStyleToolId ? /* @__PURE__ */ jsx(
|