@reekon-tools/boldr-cad 1.4.0 → 1.6.0
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/README.md +13 -3
- package/dist/app/edit.d.ts +3 -3
- package/dist/app/edit.js +26 -1
- package/dist/app/edit.js.map +1 -1
- package/dist/app/state.d.ts +6 -8
- package/dist/app/state.js +0 -1
- package/dist/app/state.js.map +1 -1
- package/dist/data/sync.d.ts +1 -1
- package/dist/data/sync.js +7 -2
- package/dist/data/sync.js.map +1 -1
- package/dist/editor/actions.d.ts +8 -0
- package/dist/editor/actions.js +255 -181
- package/dist/editor/actions.js.map +1 -1
- package/dist/editor/elevation.d.ts +4 -1
- package/dist/editor/elevation.js +16 -17
- package/dist/editor/elevation.js.map +1 -1
- package/dist/editor/gestures.d.ts +21 -0
- package/dist/editor/gestures.js +92 -14
- package/dist/editor/gestures.js.map +1 -1
- package/dist/editor/keys.js +4 -3
- package/dist/editor/keys.js.map +1 -1
- package/dist/editor/laser.d.ts +4 -2
- package/dist/editor/laser.js +4 -2
- package/dist/editor/laser.js.map +1 -1
- package/dist/editor/linkActions.d.ts +49 -12
- package/dist/editor/linkActions.js +164 -35
- package/dist/editor/linkActions.js.map +1 -1
- package/dist/editor/links.d.ts +13 -0
- package/dist/editor/links.js +7 -1
- package/dist/editor/links.js.map +1 -1
- package/dist/editor/mode.d.ts +2 -1
- package/dist/editor/mode.js +8 -5
- package/dist/editor/mode.js.map +1 -1
- package/dist/editor/project.js +1 -2
- package/dist/editor/project.js.map +1 -1
- package/dist/editor/scaleGate.d.ts +13 -0
- package/dist/editor/scaleGate.js +27 -0
- package/dist/editor/scaleGate.js.map +1 -0
- package/dist/editor/selection.js +13 -9
- package/dist/editor/selection.js.map +1 -1
- package/dist/editor/tooltips.js +10 -0
- package/dist/editor/tooltips.js.map +1 -1
- package/dist/editor/view3d.d.ts +4 -1
- package/dist/editor/view3d.js +6 -2
- package/dist/editor/view3d.js.map +1 -1
- package/dist/export/pdf.d.ts +5 -2
- package/dist/export/pdf.js +12 -8
- package/dist/export/pdf.js.map +1 -1
- package/dist/export/plan.d.ts +1 -1
- package/dist/export/plan.js +14 -9
- package/dist/export/plan.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/model/constraints.js +2 -0
- package/dist/model/constraints.js.map +1 -1
- package/dist/model/demo.d.ts +1 -0
- package/dist/model/demo.js +2 -1
- package/dist/model/demo.js.map +1 -1
- package/dist/model/elevation.d.ts +1 -1
- package/dist/model/elevation.js +3 -3
- package/dist/model/elevation.js.map +1 -1
- package/dist/model/geom.d.ts +2 -0
- package/dist/model/geom.js +11 -0
- package/dist/model/geom.js.map +1 -1
- package/dist/model/history.js +4 -1
- package/dist/model/history.js.map +1 -1
- package/dist/model/links.d.ts +10 -2
- package/dist/model/links.js +15 -3
- package/dist/model/links.js.map +1 -1
- package/dist/model/measurement.d.ts +2 -2
- package/dist/model/measurement.js +3 -3
- package/dist/model/measurement.js.map +1 -1
- package/dist/model/openings.d.ts +10 -0
- package/dist/model/openings.js +18 -0
- package/dist/model/openings.js.map +1 -1
- package/dist/model/planGeom.d.ts +37 -2
- package/dist/model/planGeom.js +72 -9
- package/dist/model/planGeom.js.map +1 -1
- package/dist/model/project.js +5 -2
- package/dist/model/project.js.map +1 -1
- package/dist/model/rooms.d.ts +18 -5
- package/dist/model/rooms.js +178 -73
- package/dist/model/rooms.js.map +1 -1
- package/dist/model/scale.d.ts +30 -0
- package/dist/model/scale.js +123 -0
- package/dist/model/scale.js.map +1 -0
- package/dist/model/settings.d.ts +0 -1
- package/dist/model/settings.js +1 -1
- package/dist/model/settings.js.map +1 -1
- package/dist/model/sketch.d.ts +26 -2
- package/dist/model/sketch.js +77 -22
- package/dist/model/sketch.js.map +1 -1
- package/dist/model/stroke.js +2 -2
- package/dist/model/trim.d.ts +54 -0
- package/dist/model/trim.js +219 -0
- package/dist/model/trim.js.map +1 -0
- package/dist/model/types.d.ts +62 -9
- package/dist/react/BottomBar.d.ts +2 -1
- package/dist/react/BottomBar.js +144 -46
- package/dist/react/BottomBar.js.map +1 -1
- package/dist/react/CadEditor.js +18 -9
- package/dist/react/CadEditor.js.map +1 -1
- package/dist/react/Drawer.js +6 -4
- package/dist/react/Drawer.js.map +1 -1
- package/dist/react/Duck.js.map +1 -1
- package/dist/react/KeypadSheet.js.map +1 -1
- package/dist/react/MarkupPanel.js +1 -1
- package/dist/react/PlanCanvas.native.js +54 -7
- package/dist/react/PlanCanvas.native.js.map +1 -1
- package/dist/react/PlanCanvas.web.js +17 -5
- package/dist/react/PlanCanvas.web.js.map +1 -1
- package/dist/react/Popovers.js +14 -3
- package/dist/react/Popovers.js.map +1 -1
- package/dist/react/Rail.js +1 -1
- package/dist/react/ShapeMenu.js +3 -2
- package/dist/react/ShapeMenu.js.map +1 -1
- package/dist/react/Sheet.d.ts +2 -2
- package/dist/react/Sheet.js.map +1 -1
- package/dist/react/ToolTip.js +3 -2
- package/dist/react/ToolTip.js.map +1 -1
- package/dist/react/TopBar.js +4 -3
- package/dist/react/TopBar.js.map +1 -1
- package/dist/react/barScroll.d.ts +23 -0
- package/dist/react/barScroll.js +47 -0
- package/dist/react/barScroll.js.map +1 -0
- package/dist/react/corners.d.ts +6 -2
- package/dist/react/corners.js.map +1 -1
- package/dist/react/editorBox.d.ts +8 -0
- package/dist/react/editorBox.js +10 -0
- package/dist/react/editorBox.js.map +1 -0
- package/dist/react/host.d.ts +1 -1
- package/dist/react/host.js +1 -1
- package/dist/react/host.js.map +1 -1
- package/dist/react/motion.d.ts +1 -1
- package/dist/react/motion.js +1 -1
- package/dist/react/motion.js.map +1 -1
- package/dist/react/pageLock.native.d.ts +2 -0
- package/dist/react/pageLock.native.js +2 -0
- package/dist/react/pageLock.native.js.map +1 -1
- package/dist/react/pageLock.web.d.ts +6 -0
- package/dist/react/pageLock.web.js +12 -3
- package/dist/react/pageLock.web.js.map +1 -1
- package/dist/react/ports.js +8 -3
- package/dist/react/ports.js.map +1 -1
- package/dist/react/saving.d.ts +7 -1
- package/dist/react/saving.js +10 -2
- package/dist/react/saving.js.map +1 -1
- package/dist/react/store.d.ts +5 -2
- package/dist/react/store.js +4 -1
- package/dist/react/store.js.map +1 -1
- package/dist/render/draw.d.ts +21 -4
- package/dist/render/draw.js +203 -151
- package/dist/render/draw.js.map +1 -1
- package/dist/render/elevation.js +3 -3
- package/dist/render/elevation.js.map +1 -1
- package/dist/render/figmaIcons.d.ts +6 -0
- package/dist/render/figmaIcons.js +16 -1
- package/dist/render/figmaIcons.js.map +1 -1
- package/dist/render/hit.d.ts +8 -1
- package/dist/render/hit.js +23 -4
- package/dist/render/hit.js.map +1 -1
- package/dist/render/icons.js +27 -20
- package/dist/render/icons.js.map +1 -1
- package/dist/render/lens.d.ts +27 -0
- package/dist/render/lens.js +41 -0
- package/dist/render/lens.js.map +1 -0
- package/dist/render/linkTile.d.ts +20 -2
- package/dist/render/linkTile.js +476 -246
- package/dist/render/linkTile.js.map +1 -1
- package/dist/render/snap.d.ts +10 -1
- package/dist/render/snap.js +87 -15
- package/dist/render/snap.js.map +1 -1
- package/dist/render/svgPath.d.ts +29 -0
- package/dist/render/svgPath.js +114 -0
- package/dist/render/svgPath.js.map +1 -0
- package/dist/render/tileIcons.d.ts +18 -0
- package/dist/render/tileIcons.js +67 -0
- package/dist/render/tileIcons.js.map +1 -0
- package/dist/render/view.d.ts +18 -1
- package/dist/render/view.js +38 -6
- package/dist/render/view.js.map +1 -1
- package/dist/skia/SkiaDrawCtx.d.ts +8 -0
- package/dist/skia/SkiaDrawCtx.js +27 -5
- package/dist/skia/SkiaDrawCtx.js.map +1 -1
- package/dist/solver/equations.d.ts +6 -0
- package/dist/solver/equations.js +53 -22
- package/dist/solver/equations.js.map +1 -1
- package/dist/solver/gauss-newton.js +6 -1
- package/dist/solver/gauss-newton.js.map +1 -1
- package/dist/tools/annotate.d.ts +0 -2
- package/dist/tools/annotate.js +1 -22
- package/dist/tools/annotate.js.map +1 -1
- package/dist/tools/chamfer.js +4 -0
- package/dist/tools/chamfer.js.map +1 -1
- package/dist/tools/dim.d.ts +3 -3
- package/dist/tools/dim.js +26 -65
- package/dist/tools/dim.js.map +1 -1
- package/dist/tools/fillet.js +4 -0
- package/dist/tools/fillet.js.map +1 -1
- package/dist/tools/freehand.js +1 -4
- package/dist/tools/freehand.js.map +1 -1
- package/dist/tools/line.js +15 -11
- package/dist/tools/line.js.map +1 -1
- package/dist/tools/modify.d.ts +32 -4
- package/dist/tools/modify.js +253 -98
- package/dist/tools/modify.js.map +1 -1
- package/dist/tools/registry.d.ts +7 -0
- package/dist/tools/registry.js +14 -1
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/select.d.ts +30 -8
- package/dist/tools/select.js +165 -34
- package/dist/tools/select.js.map +1 -1
- package/dist/tools/shapes.d.ts +1 -1
- package/dist/tools/shapes.js +12 -5
- package/dist/tools/shapes.js.map +1 -1
- package/dist/view3d/build.js +9 -8
- package/dist/view3d/build.js.map +1 -1
- package/package.json +9 -9
- package/src/app/edit.ts +25 -1
- package/src/app/state.ts +6 -8
- package/src/data/sync.ts +7 -2
- package/src/editor/actions.ts +213 -122
- package/src/editor/elevation.ts +13 -16
- package/src/editor/gestures.ts +83 -13
- package/src/editor/keys.ts +3 -2
- package/src/editor/laser.ts +7 -4
- package/src/editor/linkActions.ts +169 -31
- package/src/editor/links.ts +17 -1
- package/src/editor/mode.ts +8 -5
- package/src/editor/project.ts +1 -2
- package/src/editor/scaleGate.ts +32 -0
- package/src/editor/selection.ts +13 -7
- package/src/editor/tooltips.ts +9 -0
- package/src/editor/view3d.ts +6 -2
- package/src/export/pdf.ts +7 -4
- package/src/export/plan.ts +14 -10
- package/src/index.ts +1 -0
- package/src/model/constraints.ts +1 -0
- package/src/model/demo.ts +2 -1
- package/src/model/elevation.ts +4 -4
- package/src/model/geom.ts +10 -0
- package/src/model/history.ts +4 -1
- package/src/model/links.ts +14 -3
- package/src/model/measurement.ts +3 -3
- package/src/model/openings.ts +18 -0
- package/src/model/planGeom.ts +70 -10
- package/src/model/project.ts +6 -2
- package/src/model/rooms.ts +151 -63
- package/src/model/scale.ts +107 -0
- package/src/model/settings.ts +1 -2
- package/src/model/sketch.ts +62 -11
- package/src/model/stroke.ts +2 -2
- package/src/model/trim.ts +188 -0
- package/src/model/types.ts +57 -9
- package/src/react/BottomBar.tsx +177 -52
- package/src/react/CadEditor.tsx +19 -9
- package/src/react/Drawer.tsx +17 -12
- package/src/react/Duck.tsx +3 -3
- package/src/react/KeypadSheet.tsx +2 -2
- package/src/react/MarkupPanel.tsx +1 -1
- package/src/react/PlanCanvas.native.tsx +60 -6
- package/src/react/PlanCanvas.web.tsx +17 -5
- package/src/react/Popovers.tsx +24 -9
- package/src/react/Rail.tsx +1 -1
- package/src/react/ShapeMenu.tsx +3 -2
- package/src/react/Sheet.tsx +3 -3
- package/src/react/ToolTip.tsx +3 -2
- package/src/react/TopBar.tsx +4 -3
- package/src/react/barScroll.ts +57 -0
- package/src/react/corners.ts +6 -3
- package/src/react/editorBox.ts +20 -0
- package/src/react/host.ts +1 -1
- package/src/react/motion.tsx +6 -6
- package/src/react/pageLock.native.ts +2 -0
- package/src/react/pageLock.web.ts +12 -3
- package/src/react/ports.ts +7 -2
- package/src/react/saving.ts +10 -2
- package/src/react/store.ts +5 -2
- package/src/render/draw.ts +169 -118
- package/src/render/elevation.ts +5 -4
- package/src/render/figmaIcons.ts +17 -1
- package/src/render/hit.ts +21 -4
- package/src/render/icons.ts +27 -20
- package/src/render/lens.ts +52 -0
- package/src/render/linkTile.ts +436 -190
- package/src/render/snap.ts +87 -17
- package/src/render/svgPath.ts +95 -0
- package/src/render/tileIcons.ts +75 -0
- package/src/render/view.ts +43 -7
- package/src/skia/SkiaDrawCtx.ts +26 -4
- package/src/solver/equations.ts +52 -22
- package/src/solver/gauss-newton.ts +4 -1
- package/src/styles.css +3 -2
- package/src/tools/annotate.ts +1 -18
- package/src/tools/chamfer.ts +3 -0
- package/src/tools/dim.ts +26 -52
- package/src/tools/fillet.ts +3 -0
- package/src/tools/freehand.ts +1 -3
- package/src/tools/line.ts +12 -11
- package/src/tools/modify.ts +210 -70
- package/src/tools/registry.ts +18 -1
- package/src/tools/select.ts +144 -36
- package/src/tools/shapes.ts +9 -4
- package/src/ui/ctx.ts +4 -3
- package/src/ui/drawer.ts +8 -2
- package/src/view3d/build.ts +11 -10
- package/dist/react/LaserTray.d.ts +0 -4
- package/dist/react/LaserTray.js +0 -26
- package/dist/react/LaserTray.js.map +0 -1
- package/src/react/LaserTray.tsx +0 -42
package/dist/render/icons.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/render/icons.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../../src/render/icons.ts"],"names":[],"mappings":"AAAA;;;;;EAKE;AACF,MAAM,CAAC,MAAM,EAAE,GAA2B;IACxC,MAAM,EAAE,8CAA8C;IACtD,IAAI,EAAE,4FAA4F;IAClG,oEAAoE;IACpE,QAAQ,EAAE,oMAAoM;IAC9M,2CAA2C;IAC3C,MAAM,EAAE,kDAAkD;IAC1D,mEAAmE;IACnE,OAAO,EAAE,2DAA2D;IACpE,gHAAgH;IAChH,IAAI,EAAE,yGAAyG;IAC/G,IAAI,EAAE,qDAAqD;IAC3D,MAAM,EAAE,sFAAsF;IAC9F,GAAG,EAAE,mHAAmH,EAAE,+BAA+B;IACzJ,GAAG,EAAE,gGAAgG;IACrG,IAAI,EAAE,6GAA6G;IACnH,MAAM,EAAE,gFAAgF;IACxF,KAAK,EAAE,+TAA+T;IACtU,OAAO,EAAE,2EAA2E;IACpF,IAAI,EAAE,6BAA6B;IACnC,MAAM,EAAE,+CAA+C;IACvD,IAAI,EAAE,sEAAsE;IAC5E,IAAI,EAAE,uEAAuE;IAC7E,GAAG,EAAE,2EAA2E;IAChF,KAAK,EAAE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AS,EAAE,+JAA+J;IAC1K,uHAAuH;IACvH,qCAAqC;IACrC,MAAM,EAAE,kFAAkF;IAC1F,KAAK,EAAE,8JAA8J;IACrK,OAAO,EAAE,yKAAyK;CACnL,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAE,CAAC,GAAG,EAAE,EAAU,EAAE,CAChD,eAAe,CAAC,aAAa,CAAC,8IAA8I,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** How much closer than the drawing; the share of the screen's shorter side it's across, and its bounds; its corners. */
|
|
2
|
+
export declare const LENS_ZOOM = 2, LENS_SHARE = 0.3, LENS_MIN = 120, LENS_MAX = 240, LENS_R = 16;
|
|
3
|
+
/** From the room's edges to it; how near a finger may come before it moves to the other top corner; its cross's arms. */
|
|
4
|
+
export declare const LENS_GAP = 12, LENS_CLEAR = 40, LENS_ARM = 9;
|
|
5
|
+
export interface Lens {
|
|
6
|
+
/** its top left and its side, on the canvas */
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
size: number;
|
|
10
|
+
/** the finger or pencil, which its middle shows */
|
|
11
|
+
fx: number;
|
|
12
|
+
fy: number;
|
|
13
|
+
/** its cross, on the canvas: where what's placed lands (kept inside it) */
|
|
14
|
+
cx: number;
|
|
15
|
+
cy: number;
|
|
16
|
+
/** its line and its cross, in the drawing's ink */
|
|
17
|
+
ink: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The lens on a W × H canvas, while a finger or pencil places or drags something (else null): in the top-left corner
|
|
21
|
+
* of the room the chrome leaves it (`room`: from the canvas's left and top) or, with the finger near there, the top
|
|
22
|
+
* right.
|
|
23
|
+
*/
|
|
24
|
+
export declare function lensNow(W: number, H: number, room: {
|
|
25
|
+
left: number;
|
|
26
|
+
top: number;
|
|
27
|
+
}): Lens | null;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ed } from '../app/state';
|
|
2
|
+
import { lensPointer } from '../editor/gestures';
|
|
3
|
+
import { clamp } from '../model/geom';
|
|
4
|
+
import { TH } from './theme';
|
|
5
|
+
import { mainT, S } from './view';
|
|
6
|
+
/*
|
|
7
|
+
A device's magnifier (the user's call, 2026-10-27: "a zoom in box in the corner while dragging and creating lines or
|
|
8
|
+
shapes like skia annotation have", for "pencil / finger interactions only - do not include in web"). While a finger
|
|
9
|
+
or Apple Pencil is placing or dragging something, in Draft, Annotate or the wall view, a square in a top corner shows
|
|
10
|
+
the drawing around it twice as close, with a cross on the point it'll land on: the snap, when there is one, so what
|
|
11
|
+
it snaps to shows before it's let go. As Skia annotation's lens: a third of the screen's shorter side, its corners
|
|
12
|
+
rounded, a line round it. react/PlanCanvas.native.tsx draws it from the pictures the frame is already made of; the
|
|
13
|
+
browser's canvas has none.
|
|
14
|
+
*/
|
|
15
|
+
/** How much closer than the drawing; the share of the screen's shorter side it's across, and its bounds; its corners. */
|
|
16
|
+
export const LENS_ZOOM = 2, LENS_SHARE = 0.3, LENS_MIN = 120, LENS_MAX = 240, LENS_R = 16;
|
|
17
|
+
/** From the room's edges to it; how near a finger may come before it moves to the other top corner; its cross's arms. */
|
|
18
|
+
export const LENS_GAP = 12, LENS_CLEAR = 40, LENS_ARM = 9;
|
|
19
|
+
/**
|
|
20
|
+
* The lens on a W × H canvas, while a finger or pencil places or drags something (else null): in the top-left corner
|
|
21
|
+
* of the room the chrome leaves it (`room`: from the canvas's left and top) or, with the finger near there, the top
|
|
22
|
+
* right.
|
|
23
|
+
*/
|
|
24
|
+
export function lensNow(W, H, room) {
|
|
25
|
+
const f = lensPointer();
|
|
26
|
+
if (!f)
|
|
27
|
+
return null;
|
|
28
|
+
const size = Math.round(clamp(Math.min(W, H) * LENS_SHARE, LENS_MIN, LENS_MAX));
|
|
29
|
+
let x = room.left + LENS_GAP;
|
|
30
|
+
const y = room.top + LENS_GAP;
|
|
31
|
+
if (f.x < x + size + LENS_CLEAR && f.y < y + size + LENS_CLEAR)
|
|
32
|
+
x = W - LENS_GAP - size;
|
|
33
|
+
// (the cross on the snap, as close again as the drawing is in it, and never past its edge)
|
|
34
|
+
const s = ed.snapState, [px, py] = s ? S(mainT(), s.x, s.y) : [f.x, f.y], half = size / 2 - LENS_ARM;
|
|
35
|
+
return {
|
|
36
|
+
x, y, size, fx: f.x, fy: f.y,
|
|
37
|
+
cx: x + size / 2 + clamp(LENS_ZOOM * (px - f.x), -half, half), cy: y + size / 2 + clamp(LENS_ZOOM * (py - f.y), -half, half),
|
|
38
|
+
ink: TH.ink,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=lens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lens.js","sourceRoot":"","sources":["../../src/render/lens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAElC;;;;;;;;EAQE;AAEF,yHAAyH;AACzH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,UAAU,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,QAAQ,GAAG,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC;AAC1F,yHAAyH;AACzH,MAAM,CAAC,MAAM,QAAQ,GAAG,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,QAAQ,GAAG,CAAC,CAAC;AAa1D;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,CAAS,EAAE,CAAS,EAAE,IAAmC;IAC/E,MAAM,CAAC,GAAG,WAAW,EAAE,CAAC;IACxB,IAAI,CAAC,CAAC;Q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,IAAI,EAAE,IAAI,CAAC;QAC5H,GAAG,EAAE,EAAE,CAAC,GAAG;KACZ,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { LinkInfo, Note } from '../model/types';
|
|
2
2
|
import type { DrawCtx } from './ctx';
|
|
3
|
+
import { type SvgIcon } from './svgPath';
|
|
3
4
|
import { type Xform } from './view';
|
|
4
5
|
export interface LinkDrawOpts {
|
|
5
6
|
selected: boolean;
|
|
@@ -9,7 +10,24 @@ export interface LinkDrawOpts {
|
|
|
9
10
|
}
|
|
10
11
|
/** Draw tile `n` and its leader. */
|
|
11
12
|
export declare function drawLink(c: DrawCtx, T: Xform, n: Note, o: LinkDrawOpts): void;
|
|
13
|
+
/** What a tile is, by the object it's for: Figma's tile types (and a sketch, a measurement: no tile there). */
|
|
14
|
+
export type TileType = 'image' | 'sketch' | 'file' | 'concalc' | 'conversion' | 'note' | 'cad' | 'label' | 'measurement';
|
|
15
|
+
/** The host's kind of file (LinkInfo.fileType) as a tile type: a PDF or anything unknown is a file. */
|
|
16
|
+
export declare function tileTypeOf(n: Note, info?: LinkInfo): TileType;
|
|
17
|
+
/**
|
|
18
|
+
* A badge: its hue, its icon (render/tileIcons.ts) and where the icon sits in a badge 20 across. Figma's for six types
|
|
19
|
+
* ("Object Tile Icons" 704:23628, glyph boxes as drawn there); the rest from the add-object sheet, their glyphs as big
|
|
20
|
+
* in the badge as those are (about 13 of its 20).
|
|
21
|
+
*/
|
|
22
|
+
interface Badge {
|
|
23
|
+
hue: string;
|
|
24
|
+
icon: SvgIcon;
|
|
25
|
+
key: string;
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
size: number;
|
|
29
|
+
}
|
|
30
|
+
export declare const BADGES: Record<TileType, Badge>;
|
|
12
31
|
/** The most of `text` that fits `maxW` at the current font: all of it, or its start and an ellipsis. */
|
|
13
32
|
export declare function fitName(c: DrawCtx, text: string, maxW: number): string;
|
|
14
|
-
|
|
15
|
-
export declare function twoLines(c: DrawCtx, text: string, maxW: number): [string, string] | null;
|
|
33
|
+
export {};
|