@viamrobotics/test-widgets 0.0.1 → 0.1.2

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.
Files changed (50) hide show
  1. package/dist/components/index.d.ts +2 -4
  2. package/dist/components/index.js +2 -4
  3. package/dist/components/maplibre/controls/center.svelte +13 -10
  4. package/dist/components/maplibre/controls/follow.svelte +9 -7
  5. package/dist/components/maplibre/controls/navigation.svelte +6 -4
  6. package/dist/components/maplibre/controls/satellite.svelte +6 -4
  7. package/dist/components/maplibre/{hooks.d.ts → hooks.svelte.d.ts} +9 -14
  8. package/dist/components/maplibre/{hooks.js → hooks.svelte.js} +31 -16
  9. package/dist/components/maplibre/index.d.ts +2 -2
  10. package/dist/components/maplibre/index.js +2 -2
  11. package/dist/components/maplibre/index.svelte +9 -2
  12. package/dist/components/maplibre/marker.svelte +5 -3
  13. package/dist/components/maplibre/plugins/{raycast.js → raycast.svelte.js} +8 -7
  14. package/dist/components/maplibre/plugins/three.svelte.js +8 -6
  15. package/dist/components/navigation-map/components/draw-tool.svelte +15 -8
  16. package/dist/components/navigation-map/components/nav/index.svelte +1 -1
  17. package/dist/components/navigation-map/components/nav/key.svelte +1 -1
  18. package/dist/components/navigation-map/components/nav/obstacles-legend.svelte +1 -1
  19. package/dist/components/navigation-map/components/nav/obstacles.svelte +5 -3
  20. package/dist/components/navigation-map/components/nav/waypoints.svelte +4 -2
  21. package/dist/components/navigation-map/components/obstacle.svelte +18 -12
  22. package/dist/components/navigation-map/plugins/interactivity.js +4 -2
  23. package/dist/components/widgets/arm/move-to-joint-positions.svelte +1 -0
  24. package/dist/components/widgets/arm/move-to-position.svelte +1 -0
  25. package/dist/components/widgets/do-command/do-command.svelte +14 -4
  26. package/dist/components/widgets/navigation/obstacles/scene.svelte +4 -2
  27. package/dist/components/widgets/switch/position-view.svelte +6 -6
  28. package/dist/components/widgets/vision-service/context.svelte.js +6 -6
  29. package/package.json +116 -116
  30. package/dist/components/image-annotations/annotation-edit-utils.d.ts +0 -21
  31. package/dist/components/image-annotations/annotation-edit-utils.js +0 -183
  32. package/dist/components/image-annotations/bounding-box-labeler.svelte +0 -521
  33. package/dist/components/image-annotations/bounding-box-labeler.svelte.d.ts +0 -51
  34. package/dist/components/image-annotations/bounding-box-types.d.ts +0 -29
  35. package/dist/components/image-annotations/bounding-box-types.js +0 -17
  36. package/dist/components/image-annotations/bounding-box.svelte +0 -230
  37. package/dist/components/image-annotations/bounding-box.svelte.d.ts +0 -44
  38. package/dist/components/image-annotations/get-image-size.d.ts +0 -7
  39. package/dist/components/image-annotations/get-image-size.js +0 -29
  40. package/dist/components/image-annotations/labeler-constants.d.ts +0 -4
  41. package/dist/components/image-annotations/labeler-constants.js +0 -4
  42. package/dist/components/image-annotations/resize-corner.svelte +0 -47
  43. package/dist/components/image-annotations/resize-corner.svelte.d.ts +0 -9
  44. package/dist/components/image-annotations/resize-edge.svelte +0 -51
  45. package/dist/components/image-annotations/resize-edge.svelte.d.ts +0 -9
  46. package/dist/components/image-annotations/resize-handle-props.d.ts +0 -60
  47. package/dist/components/image-annotations/resize-handle-props.js +0 -66
  48. package/dist/components/image-annotations/resize-handles.svelte +0 -53
  49. package/dist/components/image-annotations/resize-handles.svelte.d.ts +0 -8
  50. /package/dist/components/maplibre/plugins/{raycast.d.ts → raycast.svelte.d.ts} +0 -0
@@ -1,51 +0,0 @@
1
- import type { BoundingBox as BoundingBoxData } from './bounding-box-types';
2
- interface Props {
3
- /** whether to allow drawing of new bounding boxes */
4
- allowDrawing: boolean;
5
- /** inference candidates displayed using readonly bounding boxes */
6
- candidateBoundingBoxes?: BoundingBoxData[];
7
- /** currently selected box */
8
- editTarget?: BoundingBoxData | undefined;
9
- /** map of annotations displayed in their hovered states */
10
- hoveredAnnotations: Record<string, boolean>;
11
- /** whether image is loading */
12
- imageLoading: boolean;
13
- /** URI of image */
14
- imageSrc: string;
15
- /** used to set the max size of the display container, used for bounding boxes */
16
- maxSize?: {
17
- maxHeight: number;
18
- maxWidth: number;
19
- };
20
- /** whether to allow any interactivity (i.e. drawing, editing, deleting) */
21
- readonly?: boolean;
22
- /** bounding boxes saved on the image */
23
- savedBoundingBoxes: BoundingBoxData[];
24
- /** user selected label to apply to drawn boxes */
25
- selectedLabel?: string;
26
- /** whether to display candidates and saved boxes or just candidates */
27
- showSavedBoundingBoxes?: boolean;
28
- /** how much image is zoomed */
29
- zoom?: number;
30
- /** accept the selected inference candidate box */
31
- acceptCandidate?: (id: string) => void;
32
- /** saves drawn bounding box to image */
33
- createBoundingBox?: (newBox: BoundingBoxData) => void;
34
- /** deletes saved bounding box */
35
- deleteBoundingBox?: (annotationID: string, targetLabel: string) => void;
36
- /** save changes to existing box */
37
- editBoundingBox?: (id: string, newBox: BoundingBoxData) => void;
38
- /** invoked when displayed image loaded */
39
- onImageLoad?: VoidFunction;
40
- /** reject the selected inference candidate box */
41
- rejectCandidate?: (id: string) => void;
42
- /** set which box is being edited */
43
- setEditTarget?: (target: BoundingBoxData | undefined) => void;
44
- /** used to change which boxes are hovered */
45
- setHoveredAnnotations?: (newHovered: Record<string, boolean>) => void;
46
- /** sets zoom */
47
- setZoom?: (value: number) => void;
48
- }
49
- declare const BoundingBoxLabeler: import("svelte").Component<Props, {}, "">;
50
- type BoundingBoxLabeler = ReturnType<typeof BoundingBoxLabeler>;
51
- export default BoundingBoxLabeler;
@@ -1,29 +0,0 @@
1
- export interface BoundingCoords {
2
- xMinNormalized: number;
3
- xMaxNormalized: number;
4
- yMinNormalized: number;
5
- yMaxNormalized: number;
6
- }
7
- export interface BoundingBox extends BoundingCoords {
8
- id: string;
9
- label: string;
10
- }
11
- export declare enum BoxModifier {
12
- Scaled = "scaled",
13
- Translated = "translated",
14
- Resized = "resized"
15
- }
16
- export declare enum ResizeHandleLocation {
17
- T = "top",
18
- R = "right",
19
- B = "bottom",
20
- L = "left",
21
- TL = "top-left",
22
- TR = "top-right",
23
- BR = "bottom-right",
24
- BL = "bottom-left"
25
- }
26
- export interface Coordinates {
27
- x: number;
28
- y: number;
29
- }
@@ -1,17 +0,0 @@
1
- export var BoxModifier;
2
- (function (BoxModifier) {
3
- BoxModifier["Scaled"] = "scaled";
4
- BoxModifier["Translated"] = "translated";
5
- BoxModifier["Resized"] = "resized";
6
- })(BoxModifier || (BoxModifier = {}));
7
- export var ResizeHandleLocation;
8
- (function (ResizeHandleLocation) {
9
- ResizeHandleLocation["T"] = "top";
10
- ResizeHandleLocation["R"] = "right";
11
- ResizeHandleLocation["B"] = "bottom";
12
- ResizeHandleLocation["L"] = "left";
13
- ResizeHandleLocation["TL"] = "top-left";
14
- ResizeHandleLocation["TR"] = "top-right";
15
- ResizeHandleLocation["BR"] = "bottom-right";
16
- ResizeHandleLocation["BL"] = "bottom-left";
17
- })(ResizeHandleLocation || (ResizeHandleLocation = {}));
@@ -1,230 +0,0 @@
1
- <script lang="ts">
2
- import { labelToColor } from '../widgets/vision-service/color'
3
-
4
- import type { BoundingBox, Coordinates, ResizeHandleLocation } from './bounding-box-types'
5
-
6
- import { getBoundingRect, getModifyKeyForOS } from './annotation-edit-utils'
7
- import ResizeHandles from './resize-handles.svelte'
8
-
9
- // opacity represented as hexadecimal
10
- const ACTIVE_BG_OPACITY = '70'
11
- const INACTIVE_BG_OPACITY = '30'
12
- const ACTIVE_BORDER_OPACITY = 'FF'
13
- const INACTIVE_BORDER_OPACITY = 'AA'
14
-
15
- const MODIFY_KEY = getModifyKeyForOS()
16
-
17
- interface Props {
18
- /** whether to display the active (hovered) state */
19
- active: boolean
20
- /** which corner is currently being manipulated */
21
- activeResizeHandle?: ResizeHandleLocation | undefined
22
- /** whether to allow click or hovering behaviors to function */
23
- allowInteractivity: boolean
24
- /** bounding box size and label information */
25
- annotation: BoundingBox
26
- /** width of drawing container */
27
- containerHeight: number
28
- /** height of drawing container */
29
- containerWidth: number
30
- /** distance box has been dragged in pixels */
31
- dragDistance?: Coordinates
32
- /** whether box should be displayed with dashed borders to indicate pending status */
33
- isPending: boolean
34
- /** whether box should box should be editable (can still be hovered) */
35
- readonly?: boolean
36
- /** whether box has been selected (clicked on) */
37
- selected?: boolean
38
- /** tab index used for tabbing behaviors */
39
- tabIndex?: number
40
- /** current zoom scale being applied to labeller */
41
- zoom: number
42
- /** add current box to list of hovered boxes */
43
- addToHovered?: (id: string) => void
44
- /** called when backspace keyboard key is pressed */
45
- onBackspacePress?: (id: string, label: string) => void
46
- /** called when hitting copy command */
47
- onCopyPress?: () => void
48
- /** called when enter keyboard key is pressed */
49
- onEnterPress?: (id: string) => void
50
- /** called when escape keyboard key is pressed */
51
- onEscapePress?: VoidFunction
52
- /** called on mouse down on the box */
53
- onMouseDown?: (event: MouseEvent, id: string, corner?: ResizeHandleLocation) => void
54
- /** remove current box to list of hovered boxes */
55
- removeFromHovered?: (id: string) => void
56
- }
57
-
58
- const {
59
- active,
60
- activeResizeHandle,
61
- allowInteractivity,
62
- annotation,
63
- containerHeight,
64
- containerWidth,
65
- dragDistance,
66
- isPending,
67
- readonly = false,
68
- selected = false,
69
- tabIndex = -1,
70
- zoom,
71
- addToHovered,
72
- onBackspacePress,
73
- onCopyPress,
74
- onEnterPress,
75
- onEscapePress,
76
- onMouseDown,
77
- removeFromHovered,
78
- }: Props = $props()
79
-
80
- const color = $derived(labelToColor(annotation.label))
81
-
82
- let factoredXMin = $state(0)
83
- let factoredXMax = $state(0)
84
- let factoredYMin = $state(0)
85
- let factoredYMax = $state(0)
86
- let box: HTMLDivElement | undefined = $state()
87
- let labelText: HTMLDivElement | undefined = $state()
88
-
89
- const drag = $derived(selected ? dragDistance : undefined)
90
-
91
- $effect.pre(() => {
92
- const boundingRect = getBoundingRect(
93
- annotation,
94
- drag,
95
- containerWidth,
96
- containerHeight,
97
- activeResizeHandle
98
- )
99
-
100
- factoredXMin = boundingRect.xMinNormalized
101
- factoredXMax = boundingRect.xMaxNormalized
102
- factoredYMin = boundingRect.yMinNormalized
103
- factoredYMax = boundingRect.yMaxNormalized
104
- })
105
-
106
- const showHighlight = $derived(active || selected)
107
-
108
- const handleMove = () => {
109
- if (allowInteractivity) {
110
- addToHovered?.(annotation.id)
111
- }
112
- }
113
-
114
- const handleLeave = () => {
115
- removeFromHovered?.(annotation.id)
116
- }
117
-
118
- const handleKeyDown = (event: KeyboardEvent) => {
119
- if (selected && event[MODIFY_KEY]) {
120
- // prevents UX from going into crosshair drawing mode when first pressing CMD/CTRL key
121
- event.stopPropagation()
122
-
123
- if (event.code === 'KeyC') {
124
- onCopyPress?.()
125
- box?.blur()
126
- }
127
- }
128
-
129
- switch (event.code) {
130
- case 'Escape': {
131
- event.stopPropagation()
132
- onEscapePress?.()
133
- break
134
- }
135
- case 'Enter': {
136
- event.stopPropagation()
137
- onEnterPress?.(annotation.id)
138
- break
139
- }
140
- case 'Backspace': {
141
- event.stopPropagation()
142
- onBackspacePress?.(annotation.id, annotation.label)
143
- break
144
- }
145
- }
146
- }
147
-
148
- $effect(() => {
149
- if (selected) {
150
- box?.focus()
151
- } else {
152
- box?.blur()
153
- }
154
- })
155
-
156
- const handleMouseDown = (event: MouseEvent) => {
157
- if (!readonly && allowInteractivity) {
158
- event.stopPropagation()
159
- onMouseDown?.(event, annotation.id)
160
- }
161
- }
162
-
163
- const handleCornerPointerDown = (event: MouseEvent, corner: ResizeHandleLocation) => {
164
- event.stopPropagation()
165
- onMouseDown?.(event, annotation.id, corner)
166
- }
167
-
168
- const zIndex = $derived.by(() => {
169
- if (selected) return 30
170
- if (showHighlight) return 20
171
- return 10
172
- })
173
-
174
- const labelTextWidth = $derived(labelText?.getBoundingClientRect().width ?? 0)
175
- const rightAlignText = $derived.by(() => {
176
- // check if text needs right align when text is bigger than box
177
- if (labelTextWidth < (factoredXMax - factoredXMin) * zoom) {
178
- return false
179
- }
180
-
181
- // only right align when the distance between the box left edge plus text width exceeds container boundary
182
- return labelTextWidth / zoom + factoredXMin > containerWidth
183
- })
184
- </script>
185
-
186
- <div
187
- role="button"
188
- tabindex={tabIndex}
189
- bind:this={box}
190
- class={['absolute outline-none', { 'border-dashed': isPending }]}
191
- style:border-width={`${2 / zoom}px`}
192
- style:border-color={showHighlight
193
- ? `${color}${ACTIVE_BORDER_OPACITY.toString()}`
194
- : `${color}${INACTIVE_BORDER_OPACITY.toString()}`}
195
- style:background-color={showHighlight
196
- ? `${color}${ACTIVE_BG_OPACITY.toString()}`
197
- : `${color}${INACTIVE_BG_OPACITY.toString()}`}
198
- style:top={`${factoredYMin}px`}
199
- style:left={`${factoredXMin}px`}
200
- style:height={`${factoredYMax - factoredYMin}px`}
201
- style:width={`${factoredXMax - factoredXMin}px`}
202
- style:z-index={zIndex}
203
- onmousedown={handleMouseDown}
204
- onmouseleave={handleLeave}
205
- onmousemove={handleMove}
206
- onkeydown={handleKeyDown}
207
- >
208
- {#if showHighlight}
209
- <div
210
- bind:this={labelText}
211
- class="absolute w-fit select-none"
212
- style:background-color={color}
213
- style:transform-origin={`top ${rightAlignText ? 'right' : 'left'}`}
214
- style:scale={1 / zoom}
215
- style:right={rightAlignText ? `-${2 / zoom}px` : undefined}
216
- style:left={rightAlignText ? undefined : `-${2 / zoom}px`}
217
- style:top={factoredYMin > 24 / zoom ? `-${24 / zoom}px` : `-${2 / zoom}px`}
218
- >
219
- <span class="font-roboto-mono px-2 py-0.5 text-xs font-medium whitespace-nowrap"
220
- >{annotation.label}</span
221
- >
222
- </div>
223
- {/if}
224
- {#if selected && !readonly}
225
- <ResizeHandles
226
- {zoom}
227
- onMouseDown={handleCornerPointerDown}
228
- />
229
- {/if}
230
- </div>
@@ -1,44 +0,0 @@
1
- import type { BoundingBox, Coordinates, ResizeHandleLocation } from './bounding-box-types';
2
- interface Props {
3
- /** whether to display the active (hovered) state */
4
- active: boolean;
5
- /** which corner is currently being manipulated */
6
- activeResizeHandle?: ResizeHandleLocation | undefined;
7
- /** whether to allow click or hovering behaviors to function */
8
- allowInteractivity: boolean;
9
- /** bounding box size and label information */
10
- annotation: BoundingBox;
11
- /** width of drawing container */
12
- containerHeight: number;
13
- /** height of drawing container */
14
- containerWidth: number;
15
- /** distance box has been dragged in pixels */
16
- dragDistance?: Coordinates;
17
- /** whether box should be displayed with dashed borders to indicate pending status */
18
- isPending: boolean;
19
- /** whether box should box should be editable (can still be hovered) */
20
- readonly?: boolean;
21
- /** whether box has been selected (clicked on) */
22
- selected?: boolean;
23
- /** tab index used for tabbing behaviors */
24
- tabIndex?: number;
25
- /** current zoom scale being applied to labeller */
26
- zoom: number;
27
- /** add current box to list of hovered boxes */
28
- addToHovered?: (id: string) => void;
29
- /** called when backspace keyboard key is pressed */
30
- onBackspacePress?: (id: string, label: string) => void;
31
- /** called when hitting copy command */
32
- onCopyPress?: () => void;
33
- /** called when enter keyboard key is pressed */
34
- onEnterPress?: (id: string) => void;
35
- /** called when escape keyboard key is pressed */
36
- onEscapePress?: VoidFunction;
37
- /** called on mouse down on the box */
38
- onMouseDown?: (event: MouseEvent, id: string, corner?: ResizeHandleLocation) => void;
39
- /** remove current box to list of hovered boxes */
40
- removeFromHovered?: (id: string) => void;
41
- }
42
- declare const BoundingBox: import("svelte").Component<Props, {}, "">;
43
- type BoundingBox = ReturnType<typeof BoundingBox>;
44
- export default BoundingBox;
@@ -1,7 +0,0 @@
1
- export interface Size {
2
- /** The image height, with a max height determined by its container */
3
- height: number;
4
- /** The image width, resized to match aspect ratio determined by height */
5
- width: number;
6
- }
7
- export declare const getImageSize: (img: HTMLImageElement, container: HTMLElement) => Size;
@@ -1,29 +0,0 @@
1
- export const getImageSize = (img, container) => {
2
- const aspectRatio = img.naturalWidth / img.naturalHeight;
3
- if (img.naturalHeight > img.naturalWidth) {
4
- let heightNumber = Math.min(container.clientHeight, img.naturalHeight);
5
- let widthNumber = heightNumber * aspectRatio;
6
- // if scaled width is still too large for container, scale down again
7
- if (widthNumber > container.clientWidth) {
8
- const downScale = container.clientWidth / widthNumber;
9
- widthNumber = container.clientWidth;
10
- heightNumber *= downScale;
11
- }
12
- return {
13
- width: widthNumber,
14
- height: heightNumber,
15
- };
16
- }
17
- let widthNumber = Math.min(container.clientWidth, img.naturalWidth);
18
- let heightNumber = widthNumber * (1 / aspectRatio);
19
- // if scaled height is still too large for container, scale down again
20
- if (heightNumber > container.clientHeight) {
21
- const downScale = container.clientHeight / heightNumber;
22
- heightNumber = container.clientHeight;
23
- widthNumber *= downScale;
24
- }
25
- return {
26
- width: widthNumber,
27
- height: heightNumber,
28
- };
29
- };
@@ -1,4 +0,0 @@
1
- export declare const ZOOM_MIN = 1;
2
- export declare const ZOOM_MAX = 4;
3
- export declare const INVERT_Y_FLOAT_DISTANCE = 50;
4
- export declare const INVERT_X_FLOAT_DISTANCE = 100;
@@ -1,4 +0,0 @@
1
- export const ZOOM_MIN = 1;
2
- export const ZOOM_MAX = 4;
3
- export const INVERT_Y_FLOAT_DISTANCE = 50;
4
- export const INVERT_X_FLOAT_DISTANCE = 100;
@@ -1,47 +0,0 @@
1
- <script lang="ts">
2
- import { ResizeHandleLocation } from './bounding-box-types'
3
- import {
4
- BOX_SIZE,
5
- INVISIBLE_BUFFER,
6
- ResizeHandleClassMap,
7
- WRAPPER_SIZE,
8
- } from './resize-handle-props'
9
-
10
- interface Props {
11
- cornerDesignation: ResizeHandleLocation
12
- zoom?: number
13
- onMouseDown: (event: MouseEvent, corner: ResizeHandleLocation) => void
14
- }
15
-
16
- const { cornerDesignation, zoom = 1, onMouseDown }: Props = $props()
17
-
18
- const wrapperStyle = $derived(ResizeHandleClassMap[cornerDesignation])
19
-
20
- const handleMouseDown = (event: MouseEvent) => {
21
- ;(event as PointerEvent).stopPropagation()
22
- onMouseDown(event, cornerDesignation)
23
- }
24
- </script>
25
-
26
- <button
27
- tabindex="-1"
28
- class="absolute"
29
- aria-label={`${cornerDesignation}-resize`}
30
- style:height={`${WRAPPER_SIZE}px`}
31
- style:width={`${WRAPPER_SIZE}px`}
32
- style:left={`${wrapperStyle.positionLeft ?? ''}px`}
33
- style:top={`${wrapperStyle.positionTop ?? ''}px`}
34
- style:right={`${wrapperStyle.positionRight ?? ''}px`}
35
- style:bottom={`${wrapperStyle.positionBottom ?? ''}px`}
36
- style:cursor={wrapperStyle.cursor}
37
- style:scale={1 / zoom}
38
- onmousedown={handleMouseDown}
39
- >
40
- <div
41
- style:height={`${BOX_SIZE}px`}
42
- style:width={`${BOX_SIZE}px`}
43
- style:left={`${INVISIBLE_BUFFER / 2}px`}
44
- style:top={`${INVISIBLE_BUFFER / 2}px`}
45
- class="absolute border border-black bg-white"
46
- ></div>
47
- </button>
@@ -1,9 +0,0 @@
1
- import { ResizeHandleLocation } from './bounding-box-types';
2
- interface Props {
3
- cornerDesignation: ResizeHandleLocation;
4
- zoom?: number;
5
- onMouseDown: (event: MouseEvent, corner: ResizeHandleLocation) => void;
6
- }
7
- declare const ResizeCorner: import("svelte").Component<Props, {}, "">;
8
- type ResizeCorner = ReturnType<typeof ResizeCorner>;
9
- export default ResizeCorner;
@@ -1,51 +0,0 @@
1
- <script lang="ts">
2
- import { ResizeHandleLocation } from './bounding-box-types'
3
- import { ResizeHandleClassMap } from './resize-handle-props'
4
-
5
- interface Props {
6
- edgeDesignation: ResizeHandleLocation
7
- zoom?: number
8
- onMouseDown: (event: MouseEvent, edge: ResizeHandleLocation) => void
9
- }
10
-
11
- const { edgeDesignation, zoom = 1, onMouseDown }: Props = $props()
12
-
13
- const wrapperStyle = $derived(ResizeHandleClassMap[edgeDesignation])
14
-
15
- const handleMouseDown = (event: MouseEvent) => {
16
- ;(event as PointerEvent).stopPropagation()
17
- onMouseDown(event, edgeDesignation)
18
- }
19
-
20
- const scale = $derived.by(() => {
21
- switch (edgeDesignation) {
22
- case ResizeHandleLocation.L:
23
- case ResizeHandleLocation.R: {
24
- return `${1 / zoom} 1`
25
- }
26
- case ResizeHandleLocation.T:
27
- case ResizeHandleLocation.B: {
28
- return `1 ${1 / zoom}`
29
- }
30
- default: {
31
- return ''
32
- }
33
- }
34
- })
35
- </script>
36
-
37
- <button
38
- tabindex="-1"
39
- class="absolute"
40
- aria-label={`${edgeDesignation}-resize`}
41
- style:height={wrapperStyle.height}
42
- style:width={wrapperStyle.width}
43
- style:left={`${wrapperStyle.positionLeft ?? ''}px`}
44
- style:top={`${wrapperStyle.positionTop ?? ''}px`}
45
- style:right={`${wrapperStyle.positionRight ?? ''}px`}
46
- style:bottom={`${wrapperStyle.positionBottom ?? ''}px`}
47
- style:cursor={wrapperStyle.cursor}
48
- style:scale
49
- onmousedown={handleMouseDown}
50
- >
51
- </button>
@@ -1,9 +0,0 @@
1
- import { ResizeHandleLocation } from './bounding-box-types';
2
- interface Props {
3
- edgeDesignation: ResizeHandleLocation;
4
- zoom?: number;
5
- onMouseDown: (event: MouseEvent, edge: ResizeHandleLocation) => void;
6
- }
7
- declare const ResizeEdge: import("svelte").Component<Props, {}, "">;
8
- type ResizeEdge = ReturnType<typeof ResizeEdge>;
9
- export default ResizeEdge;
@@ -1,60 +0,0 @@
1
- import { ResizeHandleLocation } from './bounding-box-types';
2
- export declare const BOX_SIZE = 10;
3
- export declare const INVISIBLE_BUFFER = 6;
4
- export declare const WRAPPER_SIZE: number;
5
- export declare const OFFSET: number;
6
- export declare const EDGE_WIDTH = 6;
7
- export declare const EDGE_OFFSET: number;
8
- export declare const topLeft: {
9
- positionLeft: number;
10
- positionTop: number;
11
- cursor: string;
12
- height: number;
13
- width: number;
14
- };
15
- export declare const topRight: {
16
- positionRight: number;
17
- positionTop: number;
18
- cursor: string;
19
- height: number;
20
- width: number;
21
- };
22
- export declare const bottomLeft: {
23
- positionLeft: number;
24
- positionBottom: number;
25
- cursor: string;
26
- height: number;
27
- width: number;
28
- };
29
- export declare const bottomRight: {
30
- positionRight: number;
31
- positionBottom: number;
32
- cursor: string;
33
- height: number;
34
- width: number;
35
- };
36
- export declare const top: {
37
- height: string;
38
- width: string;
39
- positionTop: number;
40
- cursor: string;
41
- };
42
- export declare const right: {
43
- height: string;
44
- width: string;
45
- positionRight: number;
46
- cursor: string;
47
- };
48
- export declare const bottom: {
49
- height: string;
50
- width: string;
51
- positionBottom: number;
52
- cursor: string;
53
- };
54
- export declare const left: {
55
- height: string;
56
- width: string;
57
- positionLeft: number;
58
- cursor: string;
59
- };
60
- export declare const ResizeHandleClassMap: Record<ResizeHandleLocation, Record<string, number | string>>;
@@ -1,66 +0,0 @@
1
- import { ResizeHandleLocation } from './bounding-box-types';
2
- export const BOX_SIZE = 10;
3
- export const INVISIBLE_BUFFER = 6;
4
- export const WRAPPER_SIZE = BOX_SIZE + INVISIBLE_BUFFER;
5
- export const OFFSET = -0.5 * WRAPPER_SIZE;
6
- export const EDGE_WIDTH = 6;
7
- export const EDGE_OFFSET = EDGE_WIDTH / -2;
8
- const wrapperBaseProps = { height: WRAPPER_SIZE, width: WRAPPER_SIZE };
9
- export const topLeft = {
10
- ...wrapperBaseProps,
11
- positionLeft: OFFSET,
12
- positionTop: OFFSET,
13
- cursor: 'nwse-resize',
14
- };
15
- export const topRight = {
16
- ...wrapperBaseProps,
17
- positionRight: OFFSET,
18
- positionTop: OFFSET,
19
- cursor: 'nesw-resize',
20
- };
21
- export const bottomLeft = {
22
- ...wrapperBaseProps,
23
- positionLeft: OFFSET,
24
- positionBottom: OFFSET,
25
- cursor: 'nesw-resize',
26
- };
27
- export const bottomRight = {
28
- ...wrapperBaseProps,
29
- positionRight: OFFSET,
30
- positionBottom: OFFSET,
31
- cursor: 'nwse-resize',
32
- };
33
- export const top = {
34
- height: `${EDGE_WIDTH}px`,
35
- width: '100%',
36
- positionTop: EDGE_OFFSET,
37
- cursor: 'ns-resize',
38
- };
39
- export const right = {
40
- height: '100%',
41
- width: `${EDGE_WIDTH}px`,
42
- positionRight: EDGE_OFFSET,
43
- cursor: 'ew-resize',
44
- };
45
- export const bottom = {
46
- height: `${EDGE_WIDTH}px`,
47
- width: '100%',
48
- positionBottom: EDGE_OFFSET,
49
- cursor: 'ns-resize',
50
- };
51
- export const left = {
52
- height: '100%',
53
- width: `${EDGE_WIDTH}px`,
54
- positionLeft: EDGE_OFFSET,
55
- cursor: 'ew-resize',
56
- };
57
- export const ResizeHandleClassMap = {
58
- [ResizeHandleLocation.T]: top,
59
- [ResizeHandleLocation.R]: right,
60
- [ResizeHandleLocation.B]: bottom,
61
- [ResizeHandleLocation.L]: left,
62
- [ResizeHandleLocation.TL]: topLeft,
63
- [ResizeHandleLocation.TR]: topRight,
64
- [ResizeHandleLocation.BL]: bottomLeft,
65
- [ResizeHandleLocation.BR]: bottomRight,
66
- };