@reekon-tools/boldr-cad 0.1.0 → 1.0.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 +81 -9
- package/dist/app/edit.d.ts +12 -1
- package/dist/app/edit.js +96 -11
- package/dist/app/edit.js.map +1 -1
- package/dist/app/state.d.ts +31 -4
- package/dist/app/state.js +31 -2
- package/dist/app/state.js.map +1 -1
- package/dist/data/memory.d.ts +5 -0
- package/dist/data/memory.js +2 -2
- package/dist/data/memory.js.map +1 -1
- package/dist/data/provider.d.ts +19 -7
- package/dist/data/sync.d.ts +7 -2
- package/dist/data/sync.js +115 -64
- package/dist/data/sync.js.map +1 -1
- package/dist/editor/actions.d.ts +1 -2
- package/dist/editor/actions.js +391 -113
- package/dist/editor/actions.js.map +1 -1
- package/dist/editor/confirm.d.ts +23 -0
- package/dist/editor/confirm.js +35 -0
- package/dist/editor/confirm.js.map +1 -0
- package/dist/editor/elevation.d.ts +191 -90
- package/dist/editor/elevation.js +812 -616
- package/dist/editor/elevation.js.map +1 -1
- package/dist/editor/face.d.ts +73 -0
- package/dist/editor/face.js +269 -0
- package/dist/editor/face.js.map +1 -0
- package/dist/editor/files.d.ts +6 -0
- package/dist/editor/files.js +50 -4
- package/dist/editor/files.js.map +1 -1
- package/dist/editor/gestures.d.ts +18 -3
- package/dist/editor/gestures.js +145 -30
- package/dist/editor/gestures.js.map +1 -1
- package/dist/editor/keypad.d.ts +19 -4
- package/dist/editor/keypad.js +39 -9
- package/dist/editor/keypad.js.map +1 -1
- package/dist/editor/keys.js +36 -4
- package/dist/editor/keys.js.map +1 -1
- package/dist/editor/laser.d.ts +20 -4
- package/dist/editor/laser.js +104 -21
- package/dist/editor/laser.js.map +1 -1
- package/dist/editor/linkActions.d.ts +49 -0
- package/dist/editor/linkActions.js +210 -0
- package/dist/editor/linkActions.js.map +1 -0
- package/dist/editor/linkFollow.d.ts +2 -0
- package/dist/editor/linkFollow.js +53 -0
- package/dist/editor/linkFollow.js.map +1 -0
- package/dist/editor/linkWrite.d.ts +13 -0
- package/dist/editor/linkWrite.js +84 -0
- package/dist/editor/linkWrite.js.map +1 -0
- package/dist/editor/links.d.ts +84 -0
- package/dist/editor/links.js +130 -0
- package/dist/editor/links.js.map +1 -0
- package/dist/editor/markup.d.ts +29 -3
- package/dist/editor/markup.js +95 -10
- package/dist/editor/markup.js.map +1 -1
- package/dist/editor/mode.d.ts +40 -2
- package/dist/editor/mode.js +71 -4
- package/dist/editor/mode.js.map +1 -1
- package/dist/editor/ports.d.ts +36 -6
- package/dist/editor/ports.js +10 -1
- package/dist/editor/ports.js.map +1 -1
- package/dist/editor/project.d.ts +38 -6
- package/dist/editor/project.js +167 -27
- package/dist/editor/project.js.map +1 -1
- package/dist/editor/selection.d.ts +10 -0
- package/dist/editor/selection.js +62 -8
- package/dist/editor/selection.js.map +1 -1
- package/dist/editor/status.js +3 -0
- package/dist/editor/status.js.map +1 -1
- package/dist/editor/tooltips.d.ts +5 -0
- package/dist/editor/tooltips.js +48 -0
- package/dist/editor/tooltips.js.map +1 -0
- package/dist/editor/view3d.d.ts +17 -0
- package/dist/editor/view3d.js +135 -0
- package/dist/editor/view3d.js.map +1 -0
- package/dist/editor/view3dState.d.ts +39 -0
- package/dist/editor/view3dState.js +44 -0
- package/dist/editor/view3dState.js.map +1 -0
- package/dist/export/dxf.js +1 -1
- package/dist/export/dxf.js.map +1 -1
- package/dist/export/pdf.js +17 -12
- package/dist/export/pdf.js.map +1 -1
- package/dist/export/plan.d.ts +23 -6
- package/dist/export/plan.js +127 -44
- package/dist/export/plan.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/model/constraints.js +15 -4
- package/dist/model/constraints.js.map +1 -1
- package/dist/model/demo.js +3 -3
- package/dist/model/demo.js.map +1 -1
- package/dist/model/elevation.d.ts +6 -9
- package/dist/model/elevation.js +5 -13
- package/dist/model/elevation.js.map +1 -1
- package/dist/model/faces.d.ts +58 -0
- package/dist/model/faces.js +197 -0
- package/dist/model/faces.js.map +1 -0
- package/dist/model/facesolve.d.ts +72 -0
- package/dist/model/facesolve.js +369 -0
- package/dist/model/facesolve.js.map +1 -0
- package/dist/model/history.d.ts +3 -2
- package/dist/model/history.js +17 -11
- package/dist/model/history.js.map +1 -1
- package/dist/model/images.d.ts +18 -0
- package/dist/model/images.js +26 -0
- package/dist/model/images.js.map +1 -0
- package/dist/model/links.d.ts +46 -0
- package/dist/model/links.js +73 -0
- package/dist/model/links.js.map +1 -0
- package/dist/model/markup.d.ts +46 -0
- package/dist/model/markup.js +71 -0
- package/dist/model/markup.js.map +1 -0
- package/dist/model/measurement.d.ts +11 -0
- package/dist/model/measurement.js +24 -0
- package/dist/model/measurement.js.map +1 -0
- package/dist/model/openings.d.ts +4 -0
- package/dist/model/openings.js +4 -0
- package/dist/model/openings.js.map +1 -1
- package/dist/model/planGeom.d.ts +72 -2
- package/dist/model/planGeom.js +184 -10
- package/dist/model/planGeom.js.map +1 -1
- package/dist/model/project.js +3 -2
- package/dist/model/project.js.map +1 -1
- package/dist/model/projectfile.js +2 -1
- package/dist/model/projectfile.js.map +1 -1
- package/dist/model/rooms.js +2 -2
- package/dist/model/rooms.js.map +1 -1
- package/dist/model/settings.d.ts +6 -0
- package/dist/model/settings.js +2 -2
- package/dist/model/settings.js.map +1 -1
- package/dist/model/sketch.d.ts +14 -0
- package/dist/model/sketch.js +143 -24
- package/dist/model/sketch.js.map +1 -1
- package/dist/model/smooth.d.ts +6 -0
- package/dist/model/smooth.js +52 -0
- package/dist/model/smooth.js.map +1 -0
- package/dist/model/store.d.ts +12 -0
- package/dist/model/store.js +35 -3
- package/dist/model/store.js.map +1 -1
- package/dist/model/types.d.ts +173 -8
- package/dist/model/wallfaces.d.ts +32 -0
- package/dist/model/wallfaces.js +133 -20
- package/dist/model/wallfaces.js.map +1 -1
- package/dist/model/wallshape.d.ts +15 -0
- package/dist/model/wallshape.js +89 -0
- package/dist/model/wallshape.js.map +1 -0
- package/dist/react/BottomBar.d.ts +9 -5
- package/dist/react/BottomBar.js +213 -24
- package/dist/react/BottomBar.js.map +1 -1
- package/dist/react/Buttons.d.ts +13 -2
- package/dist/react/Buttons.js +37 -5
- package/dist/react/Buttons.js.map +1 -1
- package/dist/react/CadEditor.d.ts +46 -3
- package/dist/react/CadEditor.js +77 -20
- package/dist/react/CadEditor.js.map +1 -1
- package/dist/react/ConfirmSheet.d.ts +4 -0
- package/dist/react/ConfirmSheet.js +31 -0
- package/dist/react/ConfirmSheet.js.map +1 -0
- package/dist/react/ConflictSheet.d.ts +2 -1
- package/dist/react/ConflictSheet.js +16 -8
- package/dist/react/ConflictSheet.js.map +1 -1
- package/dist/react/Drawer.d.ts +8 -2
- package/dist/react/Drawer.js +167 -38
- package/dist/react/Drawer.js.map +1 -1
- package/dist/react/Duck.d.ts +13 -0
- package/dist/react/Duck.js +45 -0
- package/dist/react/Duck.js.map +1 -0
- package/dist/react/Empty3D.d.ts +2 -0
- package/dist/react/Empty3D.js +39 -0
- package/dist/react/Empty3D.js.map +1 -0
- package/dist/react/FitScroll.d.ts +6 -0
- package/dist/react/FitScroll.js +14 -0
- package/dist/react/FitScroll.js.map +1 -0
- package/dist/react/Icon.native.d.ts +6 -0
- package/dist/react/Icon.native.js +4 -0
- package/dist/react/Icon.native.js.map +1 -1
- package/dist/react/Icon.web.d.ts +6 -0
- package/dist/react/Icon.web.js +4 -0
- package/dist/react/Icon.web.js.map +1 -1
- package/dist/react/KeypadSheet.d.ts +9 -2
- package/dist/react/KeypadSheet.js +174 -42
- package/dist/react/KeypadSheet.js.map +1 -1
- package/dist/react/LaserTray.js +8 -5
- package/dist/react/LaserTray.js.map +1 -1
- package/dist/react/MarkupPanel.d.ts +8 -0
- package/dist/react/MarkupPanel.js +67 -0
- package/dist/react/MarkupPanel.js.map +1 -0
- package/dist/react/PageThumb.native.d.ts +7 -2
- package/dist/react/PageThumb.native.js +19 -7
- package/dist/react/PageThumb.native.js.map +1 -1
- package/dist/react/PageThumb.web.d.ts +3 -2
- package/dist/react/PageThumb.web.js +4 -4
- package/dist/react/PageThumb.web.js.map +1 -1
- package/dist/react/PlanCanvas.native.d.ts +1 -1
- package/dist/react/PlanCanvas.native.js +134 -36
- package/dist/react/PlanCanvas.native.js.map +1 -1
- package/dist/react/PlanCanvas.web.js +16 -5
- package/dist/react/PlanCanvas.web.js.map +1 -1
- package/dist/react/Popovers.d.ts +12 -6
- package/dist/react/Popovers.js +53 -26
- package/dist/react/Popovers.js.map +1 -1
- package/dist/react/Rail.d.ts +24 -0
- package/dist/react/Rail.js +324 -34
- package/dist/react/Rail.js.map +1 -1
- package/dist/react/ShapeMenu.d.ts +7 -0
- package/dist/react/ShapeMenu.js +58 -0
- package/dist/react/ShapeMenu.js.map +1 -0
- package/dist/react/Sheet.d.ts +14 -4
- package/dist/react/Sheet.js +54 -9
- package/dist/react/Sheet.js.map +1 -1
- package/dist/react/Slider.d.ts +18 -0
- package/dist/react/Slider.js +27 -0
- package/dist/react/Slider.js.map +1 -0
- package/dist/react/Toast.js +14 -6
- package/dist/react/Toast.js.map +1 -1
- package/dist/react/ToolTip.d.ts +7 -0
- package/dist/react/ToolTip.js +43 -0
- package/dist/react/ToolTip.js.map +1 -0
- package/dist/react/TopBar.d.ts +6 -3
- package/dist/react/TopBar.js +48 -17
- package/dist/react/TopBar.js.map +1 -1
- package/dist/react/Tween.d.ts +7 -0
- package/dist/react/Tween.js +26 -0
- package/dist/react/Tween.js.map +1 -0
- package/dist/react/Tween.native.d.ts +6 -0
- package/dist/react/Tween.native.js +43 -0
- package/dist/react/Tween.native.js.map +1 -0
- package/dist/react/View3D.native.d.ts +4 -0
- package/dist/react/View3D.native.js +103 -0
- package/dist/react/View3D.native.js.map +1 -0
- package/dist/react/View3D.web.d.ts +4 -0
- package/dist/react/View3D.web.js +151 -0
- package/dist/react/View3D.web.js.map +1 -0
- package/dist/react/View3DHost.d.ts +143 -0
- package/dist/react/View3DHost.js +377 -0
- package/dist/react/View3DHost.js.map +1 -0
- package/dist/react/corners.d.ts +7 -0
- package/dist/react/corners.js +51 -0
- package/dist/react/corners.js.map +1 -0
- package/dist/react/easing.d.ts +15 -0
- package/dist/react/easing.js +10 -0
- package/dist/react/easing.js.map +1 -0
- package/dist/react/host.d.ts +7 -2
- package/dist/react/host.js +8 -3
- package/dist/react/host.js.map +1 -1
- package/dist/react/hostKeypad.d.ts +56 -0
- package/dist/react/hostKeypad.js +5 -0
- package/dist/react/hostKeypad.js.map +1 -0
- package/dist/react/motion.d.ts +77 -0
- package/dist/react/motion.js +173 -0
- package/dist/react/motion.js.map +1 -0
- package/dist/react/ports.js +90 -8
- package/dist/react/ports.js.map +1 -1
- package/dist/react/saving.d.ts +15 -0
- package/dist/react/saving.js +76 -0
- package/dist/react/saving.js.map +1 -0
- package/dist/react/store.d.ts +38 -1
- package/dist/react/store.js +31 -1
- package/dist/react/store.js.map +1 -1
- package/dist/react/theme.d.ts +10 -0
- package/dist/react/theme.js +8 -0
- package/dist/react/theme.js.map +1 -1
- package/dist/react/topRow.d.ts +22 -0
- package/dist/react/topRow.js +61 -0
- package/dist/react/topRow.js.map +1 -0
- package/dist/react/touch.d.ts +6 -0
- package/dist/react/touch.js +9 -0
- package/dist/react/touch.js.map +1 -0
- package/dist/render/ctx.d.ts +8 -0
- package/dist/render/draw.d.ts +33 -1
- package/dist/render/draw.js +593 -215
- package/dist/render/draw.js.map +1 -1
- package/dist/render/elevation.d.ts +65 -43
- package/dist/render/elevation.js +414 -140
- package/dist/render/elevation.js.map +1 -1
- package/dist/render/figmaIcons.d.ts +12 -0
- package/dist/render/figmaIcons.js +21 -0
- package/dist/render/figmaIcons.js.map +1 -0
- package/dist/render/hit.d.ts +22 -2
- package/dist/render/hit.js +168 -25
- package/dist/render/hit.js.map +1 -1
- package/dist/render/icons.js +69 -10
- package/dist/render/icons.js.map +1 -1
- package/dist/render/linkTile.d.ts +15 -0
- package/dist/render/linkTile.js +369 -0
- package/dist/render/linkTile.js.map +1 -0
- package/dist/render/markup.d.ts +11 -0
- package/dist/render/markup.js +112 -0
- package/dist/render/markup.js.map +1 -0
- package/dist/render/navigate.d.ts +88 -0
- package/dist/render/navigate.js +100 -0
- package/dist/render/navigate.js.map +1 -0
- package/dist/render/snap.d.ts +20 -1
- package/dist/render/snap.js +118 -25
- package/dist/render/snap.js.map +1 -1
- package/dist/render/squircle.d.ts +8 -0
- package/dist/render/squircle.js +71 -0
- package/dist/render/squircle.js.map +1 -0
- package/dist/render/view.d.ts +115 -2
- package/dist/render/view.js +244 -19
- package/dist/render/view.js.map +1 -1
- package/dist/skia/SkiaDrawCtx.d.ts +30 -2
- package/dist/skia/SkiaDrawCtx.js +198 -43
- package/dist/skia/SkiaDrawCtx.js.map +1 -1
- package/dist/skia/host.d.ts +18 -2
- package/dist/skia/host.js +46 -1
- package/dist/skia/host.js.map +1 -1
- package/dist/solver/equations.js +37 -2
- package/dist/solver/equations.js.map +1 -1
- package/dist/solver/gauss-newton.d.ts +17 -0
- package/dist/solver/gauss-newton.js +144 -36
- package/dist/solver/gauss-newton.js.map +1 -1
- package/dist/solver/linalg.d.ts +45 -2
- package/dist/solver/linalg.js +164 -10
- package/dist/solver/linalg.js.map +1 -1
- package/dist/solver/types.d.ts +5 -0
- package/dist/tools/annotate.d.ts +57 -1
- package/dist/tools/annotate.js +64 -43
- package/dist/tools/annotate.js.map +1 -1
- package/dist/tools/chamfer.d.ts +12 -0
- package/dist/tools/chamfer.js +114 -0
- package/dist/tools/chamfer.js.map +1 -0
- package/dist/tools/corner.d.ts +38 -0
- package/dist/tools/corner.js +99 -0
- package/dist/tools/corner.js.map +1 -0
- package/dist/tools/dim.d.ts +86 -9
- package/dist/tools/dim.js +581 -96
- package/dist/tools/dim.js.map +1 -1
- package/dist/tools/elevation.js +1 -1
- package/dist/tools/elevation.js.map +1 -1
- package/dist/tools/fillet.d.ts +9 -0
- package/dist/tools/fillet.js +86 -0
- package/dist/tools/fillet.js.map +1 -0
- package/dist/tools/freehand.d.ts +3 -2
- package/dist/tools/freehand.js +19 -12
- package/dist/tools/freehand.js.map +1 -1
- package/dist/tools/index.js +14 -4
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/line.d.ts +8 -3
- package/dist/tools/line.js +66 -30
- package/dist/tools/line.js.map +1 -1
- package/dist/tools/modify.d.ts +13 -0
- package/dist/tools/modify.js +105 -25
- package/dist/tools/modify.js.map +1 -1
- package/dist/tools/openings.js +22 -15
- package/dist/tools/openings.js.map +1 -1
- package/dist/tools/registry.d.ts +8 -0
- package/dist/tools/registry.js +42 -2
- package/dist/tools/registry.js.map +1 -1
- package/dist/tools/select.d.ts +77 -3
- package/dist/tools/select.js +560 -74
- package/dist/tools/select.js.map +1 -1
- package/dist/tools/shapes.d.ts +14 -0
- package/dist/tools/shapes.js +154 -75
- package/dist/tools/shapes.js.map +1 -1
- package/dist/units/format.d.ts +10 -2
- package/dist/units/format.js +18 -3
- package/dist/units/format.js.map +1 -1
- package/dist/view3d/build.d.ts +35 -0
- package/dist/view3d/build.js +630 -0
- package/dist/view3d/build.js.map +1 -0
- package/dist/view3d/camera.d.ts +60 -0
- package/dist/view3d/camera.js +84 -0
- package/dist/view3d/camera.js.map +1 -0
- package/dist/view3d/fatLines.d.ts +11 -0
- package/dist/view3d/fatLines.js +83 -0
- package/dist/view3d/fatLines.js.map +1 -0
- package/dist/view3d/lines.d.ts +17 -0
- package/dist/view3d/lines.js +271 -0
- package/dist/view3d/lines.js.map +1 -0
- package/dist/view3d/mesh.d.ts +51 -0
- package/dist/view3d/mesh.js +101 -0
- package/dist/view3d/mesh.js.map +1 -0
- package/dist/view3d/poly.d.ts +16 -0
- package/dist/view3d/poly.js +109 -0
- package/dist/view3d/poly.js.map +1 -0
- package/dist/view3d/viewer.d.ts +86 -0
- package/dist/view3d/viewer.js +350 -0
- package/dist/view3d/viewer.js.map +1 -0
- package/package.json +15 -2
- package/src/app/edit.ts +83 -12
- package/src/app/main.ts +11 -5
- package/src/app/state.ts +38 -5
- package/src/data/memory.ts +2 -2
- package/src/data/provider.ts +15 -7
- package/src/data/sync.ts +87 -50
- package/src/editor/actions.ts +292 -83
- package/src/editor/confirm.ts +58 -0
- package/src/editor/elevation.ts +698 -478
- package/src/editor/face.ts +227 -0
- package/src/editor/files.ts +40 -4
- package/src/editor/gestures.ts +147 -31
- package/src/editor/keypad.ts +43 -11
- package/src/editor/keys.ts +25 -5
- package/src/editor/laser.ts +98 -20
- package/src/editor/linkActions.ts +194 -0
- package/src/editor/linkFollow.ts +43 -0
- package/src/editor/linkWrite.ts +77 -0
- package/src/editor/links.ts +181 -0
- package/src/editor/markup.ts +92 -8
- package/src/editor/mode.ts +83 -7
- package/src/editor/ports.ts +37 -6
- package/src/editor/project.ts +155 -26
- package/src/editor/selection.ts +54 -8
- package/src/editor/status.ts +2 -0
- package/src/editor/tooltips.ts +47 -0
- package/src/editor/view3d.ts +119 -0
- package/src/editor/view3dState.ts +61 -0
- package/src/export/dxf.ts +1 -1
- package/src/export/pdf.ts +15 -7
- package/src/export/plan.ts +119 -35
- package/src/index.ts +5 -0
- package/src/input/keyboard.ts +2 -4
- package/src/model/constraints.ts +13 -4
- package/src/model/demo.ts +3 -3
- package/src/model/elevation.ts +6 -16
- package/src/model/faces.ts +153 -0
- package/src/model/facesolve.ts +322 -0
- package/src/model/history.ts +19 -11
- package/src/model/images.ts +35 -0
- package/src/model/links.ts +77 -0
- package/src/model/markup.ts +80 -0
- package/src/model/measurement.ts +26 -0
- package/src/model/openings.ts +6 -0
- package/src/model/planGeom.ts +174 -8
- package/src/model/project.ts +3 -2
- package/src/model/projectfile.ts +2 -1
- package/src/model/rooms.ts +1 -1
- package/src/model/settings.ts +8 -2
- package/src/model/sketch.ts +101 -14
- package/src/model/smooth.ts +51 -0
- package/src/model/store.ts +35 -4
- package/src/model/types.ts +170 -8
- package/src/model/wallfaces.ts +126 -17
- package/src/model/wallshape.ts +97 -0
- package/src/react/BottomBar.tsx +263 -46
- package/src/react/Buttons.tsx +50 -9
- package/src/react/CadEditor.tsx +133 -30
- package/src/react/ConfirmSheet.tsx +38 -0
- package/src/react/ConflictSheet.tsx +19 -12
- package/src/react/Drawer.tsx +213 -110
- package/src/react/Duck.tsx +50 -0
- package/src/react/Empty3D.tsx +32 -0
- package/src/react/FitScroll.tsx +19 -0
- package/src/react/Icon.native.tsx +5 -0
- package/src/react/Icon.web.tsx +5 -0
- package/src/react/KeypadSheet.tsx +253 -60
- package/src/react/LaserTray.tsx +12 -8
- package/src/react/MarkupPanel.tsx +150 -0
- package/src/react/PageThumb.native.tsx +18 -7
- package/src/react/PageThumb.web.tsx +4 -4
- package/src/react/PlanCanvas.native.tsx +151 -34
- package/src/react/PlanCanvas.web.tsx +15 -5
- package/src/react/Popovers.tsx +116 -51
- package/src/react/Rail.tsx +360 -27
- package/src/react/ShapeMenu.tsx +66 -0
- package/src/react/Sheet.tsx +56 -11
- package/src/react/Slider.tsx +48 -0
- package/src/react/Toast.tsx +16 -9
- package/src/react/ToolTip.tsx +49 -0
- package/src/react/TopBar.tsx +97 -39
- package/src/react/Tween.native.tsx +36 -0
- package/src/react/Tween.tsx +24 -0
- package/src/react/View3D.native.tsx +131 -0
- package/src/react/View3D.web.tsx +131 -0
- package/src/react/View3DHost.ts +367 -0
- package/src/react/corners.ts +52 -0
- package/src/react/easing.ts +14 -0
- package/src/react/host.ts +8 -3
- package/src/react/hostKeypad.ts +66 -0
- package/src/react/motion.tsx +239 -0
- package/src/react/ports.ts +78 -9
- package/src/react/saving.ts +80 -0
- package/src/react/store.ts +35 -3
- package/src/react/theme.ts +8 -0
- package/src/react/topRow.ts +71 -0
- package/src/react/touch.ts +10 -0
- package/src/render/ctx.ts +8 -0
- package/src/render/draw.ts +437 -175
- package/src/render/elevation.ts +349 -143
- package/src/render/figmaIcons.ts +22 -0
- package/src/render/hit.ts +140 -21
- package/src/render/icons.ts +69 -10
- package/src/render/linkTile.ts +297 -0
- package/src/render/markup.ts +91 -0
- package/src/render/navigate.ts +114 -0
- package/src/render/snap.ts +105 -22
- package/src/render/squircle.ts +73 -0
- package/src/render/view.ts +255 -19
- package/src/skia/SkiaDrawCtx.ts +163 -41
- package/src/skia/host.ts +46 -1
- package/src/solver/equations.ts +37 -2
- package/src/solver/gauss-newton.ts +125 -28
- package/src/solver/linalg.ts +141 -5
- package/src/solver/types.ts +5 -0
- package/src/styles.css +91 -42
- package/src/tools/annotate.ts +58 -29
- package/src/tools/chamfer.ts +103 -0
- package/src/tools/corner.ts +99 -0
- package/src/tools/dim.ts +524 -92
- package/src/tools/elevation.ts +1 -1
- package/src/tools/fillet.ts +82 -0
- package/src/tools/freehand.ts +20 -16
- package/src/tools/index.ts +17 -4
- package/src/tools/line.ts +59 -23
- package/src/tools/modify.ts +86 -24
- package/src/tools/openings.ts +8 -13
- package/src/tools/registry.ts +27 -2
- package/src/tools/select.ts +424 -75
- package/src/tools/shapes.ts +119 -58
- package/src/ui/ctx.ts +2 -1
- package/src/ui/domPorts.ts +23 -4
- package/src/ui/drawer.ts +6 -26
- package/src/ui/elevation.ts +10 -101
- package/src/ui/keypad.ts +8 -14
- package/src/ui/laser.ts +2 -2
- package/src/ui/menu.ts +63 -17
- package/src/ui/noteinput.ts +3 -3
- package/src/ui/opacity.ts +108 -0
- package/src/ui/palette.ts +67 -12
- package/src/ui/rail.ts +21 -7
- package/src/ui/topbar.ts +4 -14
- package/src/units/format.ts +18 -3
- package/src/view3d/build.ts +607 -0
- package/src/view3d/camera.ts +113 -0
- package/src/view3d/fatLines.ts +83 -0
- package/src/view3d/lines.ts +258 -0
- package/src/view3d/mesh.ts +111 -0
- package/src/view3d/poly.ts +104 -0
- package/src/view3d/viewer.ts +348 -0
- package/dist/react/ElevCanvas.native.d.ts +0 -3
- package/dist/react/ElevCanvas.native.js +0 -58
- package/dist/react/ElevCanvas.native.js.map +0 -1
- package/dist/react/ElevCanvas.web.d.ts +0 -4
- package/dist/react/ElevCanvas.web.js +0 -44
- package/dist/react/ElevCanvas.web.js.map +0 -1
- package/dist/react/ElevationSheet.d.ts +0 -2
- package/dist/react/ElevationSheet.js +0 -38
- package/dist/react/ElevationSheet.js.map +0 -1
- package/dist/render/elevationView.d.ts +0 -3
- package/dist/render/elevationView.js +0 -100
- package/dist/render/elevationView.js.map +0 -1
- package/src/react/ElevCanvas.native.tsx +0 -68
- package/src/react/ElevCanvas.web.tsx +0 -42
- package/src/react/ElevationSheet.tsx +0 -88
- package/src/render/elevationView.ts +0 -73
package/dist/editor/mode.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ed } from '../app/state';
|
|
2
2
|
import { requestDraw } from '../render/view';
|
|
3
3
|
import { cancelTool } from '../tools/registry';
|
|
4
|
+
import { elevOpen, WALL_ICON, WALL_RAIL } from './elevation';
|
|
4
5
|
import { refreshModes, updateCtx, updateHint, updateRail } from './ports';
|
|
5
6
|
/** Switch between Draft and Annotate: each has its own tools, and the selection starts empty. */
|
|
6
7
|
export function setMode(m) {
|
|
@@ -19,20 +20,86 @@ export function setMode(m) {
|
|
|
19
20
|
/** New lines become construction lines (guides that never make spaces), or regular lines again. */
|
|
20
21
|
export function toggleConstr() {
|
|
21
22
|
ed.drawConstr = !ed.drawConstr;
|
|
23
|
+
// (a wall is never a guide)
|
|
24
|
+
if (ed.drawConstr)
|
|
25
|
+
ed.drawWalls = false;
|
|
26
|
+
toggled();
|
|
27
|
+
}
|
|
28
|
+
/** What's drawn — lines, rectangles, circles, arcs, Draw to shape — becomes walls, or lines again. */
|
|
29
|
+
export function toggleWalls() {
|
|
30
|
+
ed.drawWalls = !ed.drawWalls;
|
|
31
|
+
if (ed.drawWalls)
|
|
32
|
+
ed.drawConstr = false;
|
|
33
|
+
toggled();
|
|
34
|
+
}
|
|
35
|
+
/** A toggle flipped: the rail shows it, and a shape being drawn (and the hint) shows what it'll now make. */
|
|
36
|
+
function toggled() {
|
|
22
37
|
updateRail();
|
|
38
|
+
updateHint();
|
|
39
|
+
requestDraw();
|
|
23
40
|
}
|
|
41
|
+
/** Whether what's drawn now is walls: the Walls toggle, except in the wall view (what's drawn on a wall's face never is). */
|
|
42
|
+
export const drawsWalls = () => ed.drawWalls && !elevOpen();
|
|
43
|
+
/** The rail's toggles: whether each is on, and flipping it. */
|
|
44
|
+
export const TOGGLES = {
|
|
45
|
+
wall: { on: () => ed.drawWalls, flip: toggleWalls },
|
|
46
|
+
constr: { on: () => ed.drawConstr, flip: toggleConstr },
|
|
47
|
+
};
|
|
48
|
+
/** The tool rail now: the wall view's while a wall is open, otherwise the current mode's (the 3D tab has none). */
|
|
49
|
+
export const railItems = () => (elevOpen() ? WALL_RAIL : RAIL[ed.mode]);
|
|
50
|
+
/** The icon for a rail item. */
|
|
51
|
+
export const railIcon = (id) => WALL_ICON[id] ?? id;
|
|
24
52
|
/** The tool rail for each mode. 'toggle' items switch something on and off; 'act' items run an action. */
|
|
25
53
|
export const RAIL = {
|
|
26
54
|
draft: [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
['
|
|
55
|
+
// drawing; then the building (walls, what goes in them, spaces); then measuring and guides
|
|
56
|
+
['select', 'Select', 'V'], ['line', 'Line', 'L'], ['freehand', 'Draw to shape', 'S'], ['rect', 'Rectangle', 'R'], ['circle', 'Circle', 'C'], ['arc', 'Arc', 'A'], '|',
|
|
57
|
+
['door', 'Door', 'B'], ['window', 'Window', 'N'], ['room', 'Space', 'M'], '|',
|
|
58
|
+
// Trim (T) and Offset (O) stay on the keyboard; Offset is also in the bar for a selected line.
|
|
59
|
+
// The toggles together: what's drawn is walls, or guides (one or the other, never both)
|
|
60
|
+
['dim', 'Dimension', 'D'], ['wall', 'Walls', 'W', 'toggle'], ['constr', 'Construction lines', 'X', 'toggle'], '|',
|
|
30
61
|
['undo', 'Undo', '⌘Z', 'act'], ['redo', 'Redo', '⇧⌘Z', 'act'],
|
|
31
62
|
],
|
|
32
63
|
annotate: [
|
|
33
|
-
|
|
64
|
+
// the markup shapes, Arrow first (on a phone they share Arrow's place: MARKS_GROUP)
|
|
65
|
+
['aselect', 'Select markup', 'V'], ['arrow', 'Arrow', 'K'], ['mline', 'Line', 'L'], ['mrect', 'Rectangle', 'R'], ['mtri', 'Triangle', ''],
|
|
66
|
+
['mcircle', 'Circle', 'C'], ['pen', 'Pen', 'P'], ['cloud', 'Revision cloud', 'Q'], ['text', 'Note', 'N'], ['image', 'Add photo or plan', '', 'act'], '|',
|
|
34
67
|
['color', 'Markup color', '', 'act'], '|',
|
|
35
68
|
['undo', 'Undo', '⌘Z', 'act'], ['redo', 'Redo', '⇧⌘Z', 'act'],
|
|
36
69
|
],
|
|
37
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Tools that share one place on a phone's rail, which has no room for each: a tap draws with the one used last (the
|
|
73
|
+
* place shows it), and a long press opens a menu of them all (react/ShapeMenu.tsx) — Draft's Line, Rectangle, Circle
|
|
74
|
+
* and Arc, and Annotate's markup shapes. A tablet's or a browser's rail shows every one in its own place.
|
|
75
|
+
*/
|
|
76
|
+
export const SHAPE_TOOLS = ['line', 'rect', 'circle', 'arc'];
|
|
77
|
+
export const SHAPES_GROUP = 'shapes';
|
|
78
|
+
export const MARK_TOOLS = ['arrow', 'mline', 'mrect', 'mtri', 'mcircle'];
|
|
79
|
+
export const MARKS_GROUP = 'marks';
|
|
80
|
+
export const TOOL_GROUPS = {
|
|
81
|
+
[SHAPES_GROUP]: { tools: SHAPE_TOOLS, label: 'Shapes', mode: 'draft', phoneOnly: true },
|
|
82
|
+
[MARKS_GROUP]: { tools: MARK_TOOLS, label: 'Markup shapes', mode: 'annotate', phoneOnly: true },
|
|
83
|
+
};
|
|
84
|
+
/** The group a tool shares its place with on this rail, if any. */
|
|
85
|
+
export const groupOf = (tool, phone) => Object.keys(TOOL_GROUPS).find(g => TOOL_GROUPS[g].tools.includes(tool) && (phone || !TOOL_GROUPS[g].phoneOnly)) ?? null;
|
|
86
|
+
/** A rail with each group's tools folded into one place, where the first of them was; the rest as it was. */
|
|
87
|
+
export function groupTools(items, phone) {
|
|
88
|
+
if (!items.some(it => it !== '|' && groupOf(it[0], phone)))
|
|
89
|
+
return items;
|
|
90
|
+
const out = [];
|
|
91
|
+
for (const it of items) {
|
|
92
|
+
const g = it === '|' ? null : groupOf(it[0], phone);
|
|
93
|
+
if (!g)
|
|
94
|
+
out.push(it);
|
|
95
|
+
else if (!out.some(o => o !== '|' && o[0] === g))
|
|
96
|
+
out.push([g, TOOL_GROUPS[g].label, '', 'group']);
|
|
97
|
+
}
|
|
98
|
+
return out;
|
|
99
|
+
}
|
|
100
|
+
/** A tool's name on the rail ('Line', 'Rectangle'…). */
|
|
101
|
+
export const toolLabel = (id) => {
|
|
102
|
+
const it = [...RAIL.draft, ...RAIL.annotate].find(r => r !== '|' && r[0] === id);
|
|
103
|
+
return it && it !== '|' ? it[1] : id;
|
|
104
|
+
};
|
|
38
105
|
//# sourceMappingURL=mode.js.map
|
package/dist/editor/mode.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mode.js","sourceRoot":"","sources":["../../src/editor/mode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAa,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1E,iGAAiG;AACjG,MAAM,UAAU,OAAO,CAAC,CAAO;IAC7B,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI;QAAE,OAAO;IAC1B,UAAU,EAAE,CAAC;IACb,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC;IACZ,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAC/C,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC;IACZ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AG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvC,CAAC,CAAC"}
|
package/dist/editor/ports.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Constraint } from '../model/types';
|
|
1
|
+
import type { Constraint, LinkTarget } from '../model/types';
|
|
2
|
+
import type { MeasurementKind } from './links';
|
|
2
3
|
export interface ToastOpts {
|
|
3
4
|
warn?: boolean;
|
|
4
5
|
action?: {
|
|
@@ -27,9 +28,21 @@ export interface KeypadSpec {
|
|
|
27
28
|
laser?: boolean;
|
|
28
29
|
/** extra buttons, read again after each press so their state can change */
|
|
29
30
|
extras?: () => KeypadExtra[];
|
|
30
|
-
|
|
31
|
+
/** the value; `capture`, a laser reading's record (laserReading's), when it's that reading applied as it came in */
|
|
32
|
+
onDone?: (v: number, capture?: unknown) => void;
|
|
33
|
+
/**
|
|
34
|
+
* A line's length, or a dimension's angle: the job's measurements are offered with the keys (a page swiped to on a
|
|
35
|
+
* touch screen, Select From List on a desktop), those of `kind` pickable — the one picked handed to `pick` (the
|
|
36
|
+
* keypad's for closing, and the value for setting from it, linked to it).
|
|
37
|
+
*/
|
|
38
|
+
measurements?: {
|
|
39
|
+
kind: MeasurementKind;
|
|
40
|
+
pick: (t: LinkTarget) => void;
|
|
41
|
+
};
|
|
31
42
|
/** called whenever the keypad closes (applied or cancelled), e.g. to clear a preview */
|
|
32
43
|
onClose?: () => void;
|
|
44
|
+
/** no backdrop: the drawing stays live behind it (a tool can take the next tap, and close it) */
|
|
45
|
+
modeless?: boolean;
|
|
33
46
|
}
|
|
34
47
|
export interface ConflictSpec {
|
|
35
48
|
title: string;
|
|
@@ -42,13 +55,13 @@ export interface ConflictSpec {
|
|
|
42
55
|
retry?: () => void;
|
|
43
56
|
onResolved?: (() => void) | null;
|
|
44
57
|
}
|
|
45
|
-
export type DrawerTab = 'pages' | '
|
|
58
|
+
export type DrawerTab = 'pages' | 'rooms';
|
|
46
59
|
/**
|
|
47
60
|
* Parts of the interface that show editor state and must re-read it after a change:
|
|
48
61
|
* the contextual bar, the hint, the definition-state pill, the tool rail, the mode tabs (and the rail's tool set),
|
|
49
62
|
* the project drawer, the wall elevation view, the top bar's view toggles, the keypad's display, and the laser tray.
|
|
50
63
|
*/
|
|
51
|
-
export type ChromePart = 'ctx' | 'hint' | 'status' | 'rail' | 'mode' | 'drawer' | 'elevation' | 'topbar' | 'keypad' | 'tray';
|
|
64
|
+
export type ChromePart = 'ctx' | 'hint' | 'status' | 'rail' | 'mode' | 'drawer' | 'elevation' | 'topbar' | 'keypad' | 'tray' | 'confirm';
|
|
52
65
|
export interface EditorPorts {
|
|
53
66
|
refresh(part: ChromePart): void;
|
|
54
67
|
toast(msg: string, opts?: ToastOpts): void;
|
|
@@ -58,16 +71,28 @@ export interface EditorPorts {
|
|
|
58
71
|
keypadTyped(): number | null;
|
|
59
72
|
showConflict(spec: ConflictSpec): void;
|
|
60
73
|
openDrawer(tab?: DrawerTab): void;
|
|
61
|
-
|
|
74
|
+
/** the text field for a note at a screen point; `initial`: the text it starts with (editing a note) */
|
|
75
|
+
showNoteInput(sx: number, sy: number, cb: (text: string) => void, initial?: string): void;
|
|
62
76
|
hideNoteInput(): void;
|
|
63
77
|
/** the markup color picker, next to `anchor` (the button that asked for it, if any) */
|
|
64
78
|
openPalette(anchor?: unknown): void;
|
|
79
|
+
/** the selected image's opacity slider, above the bar (its button again closes it) */
|
|
80
|
+
toggleImageOpacity(anchor?: unknown): void;
|
|
81
|
+
/** the selected image's rotation slider, above the bar (its button again closes it) */
|
|
82
|
+
toggleImageRotation(anchor?: unknown): void;
|
|
83
|
+
/** the link tiles' size slider, above the bar (its button again closes it) */
|
|
84
|
+
toggleTileSize(anchor?: unknown): void;
|
|
65
85
|
/** let the user type a new name for a space */
|
|
66
86
|
editRoomName(roomId: string): void;
|
|
67
87
|
/** the mouse cursor over the plan (or the wall elevation), as a CSS cursor name ('' = the default); ignored without a mouse */
|
|
68
88
|
setCursor(cursor: string, where?: 'plan' | 'elevation'): void;
|
|
69
89
|
/** close any open popover (the settings menu, the color palette); true if one was open */
|
|
70
90
|
dismissPopovers(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* a gesture on the drawing started moving — a stroke, a drag, a pan or a pinch (never a tap) — or its last pointer
|
|
93
|
+
* lifted: the interface can step out of the way meanwhile
|
|
94
|
+
*/
|
|
95
|
+
interacting(on: boolean): void;
|
|
71
96
|
/** close the conflict sheet; true if it was open */
|
|
72
97
|
dismissConflict(): boolean;
|
|
73
98
|
/** save now (⌘S) */
|
|
@@ -85,12 +110,16 @@ export declare const closeKeypad: () => void;
|
|
|
85
110
|
export declare const kpTyped: () => number | null;
|
|
86
111
|
export declare const showConflict: (spec: ConflictSpec) => void;
|
|
87
112
|
export declare const openDrawer: (tab?: DrawerTab) => void;
|
|
88
|
-
export declare const showNoteInput: (sx: number, sy: number, cb: (text: string) => void) => void;
|
|
113
|
+
export declare const showNoteInput: (sx: number, sy: number, cb: (text: string) => void, initial?: string) => void;
|
|
89
114
|
export declare const hideNoteInput: () => void;
|
|
90
115
|
export declare const openPalette: (anchor?: unknown) => void;
|
|
116
|
+
export declare const toggleImageOpacity: (anchor?: unknown) => void;
|
|
117
|
+
export declare const toggleImageRotation: (anchor?: unknown) => void;
|
|
118
|
+
export declare const toggleTileSize: (anchor?: unknown) => void;
|
|
91
119
|
export declare const editRoomName: (roomId: string) => void;
|
|
92
120
|
export declare const setCursor: (cursor: string, where?: 'plan' | 'elevation') => void;
|
|
93
121
|
export declare const dismissPopovers: () => boolean;
|
|
122
|
+
export declare const interacting: (on: boolean) => void;
|
|
94
123
|
export declare const dismissConflict: () => boolean;
|
|
95
124
|
export declare const saveNowPort: () => void;
|
|
96
125
|
export declare const saveFile: (name: string, mime: string, data: string) => void;
|
|
@@ -104,3 +133,4 @@ export declare const renderElevation: () => void;
|
|
|
104
133
|
export declare const updateTopBar: () => void;
|
|
105
134
|
export declare const refreshKeypad: () => void;
|
|
106
135
|
export declare const refreshTray: () => void;
|
|
136
|
+
export declare const refreshConfirm: () => void;
|
package/dist/editor/ports.js
CHANGED
|
@@ -10,9 +10,13 @@ export const basePorts = () => ({
|
|
|
10
10
|
showNoteInput() { },
|
|
11
11
|
hideNoteInput() { },
|
|
12
12
|
openPalette() { },
|
|
13
|
+
toggleImageOpacity() { },
|
|
14
|
+
toggleImageRotation() { },
|
|
15
|
+
toggleTileSize() { },
|
|
13
16
|
editRoomName() { },
|
|
14
17
|
setCursor() { },
|
|
15
18
|
dismissPopovers: () => false,
|
|
19
|
+
interacting() { },
|
|
16
20
|
dismissConflict: () => false,
|
|
17
21
|
save() { },
|
|
18
22
|
saveFile() { },
|
|
@@ -29,12 +33,16 @@ export const closeKeypad = () => ports.closeKeypad();
|
|
|
29
33
|
export const kpTyped = () => ports.keypadTyped();
|
|
30
34
|
export const showConflict = (spec) => ports.showConflict(spec);
|
|
31
35
|
export const openDrawer = (tab) => ports.openDrawer(tab);
|
|
32
|
-
export const showNoteInput = (sx, sy, cb) => ports.showNoteInput(sx, sy, cb);
|
|
36
|
+
export const showNoteInput = (sx, sy, cb, initial) => ports.showNoteInput(sx, sy, cb, initial);
|
|
33
37
|
export const hideNoteInput = () => ports.hideNoteInput();
|
|
34
38
|
export const openPalette = (anchor) => ports.openPalette(anchor);
|
|
39
|
+
export const toggleImageOpacity = (anchor) => ports.toggleImageOpacity(anchor);
|
|
40
|
+
export const toggleImageRotation = (anchor) => ports.toggleImageRotation(anchor);
|
|
41
|
+
export const toggleTileSize = (anchor) => ports.toggleTileSize(anchor);
|
|
35
42
|
export const editRoomName = (roomId) => ports.editRoomName(roomId);
|
|
36
43
|
export const setCursor = (cursor, where = 'plan') => ports.setCursor(cursor, where);
|
|
37
44
|
export const dismissPopovers = () => ports.dismissPopovers();
|
|
45
|
+
export const interacting = (on) => ports.interacting(on);
|
|
38
46
|
export const dismissConflict = () => ports.dismissConflict();
|
|
39
47
|
export const saveNowPort = () => ports.save();
|
|
40
48
|
export const saveFile = (name, mime, data) => ports.saveFile(name, mime, data);
|
|
@@ -48,4 +56,5 @@ export const renderElevation = () => ports.refresh('elevation');
|
|
|
48
56
|
export const updateTopBar = () => ports.refresh('topbar');
|
|
49
57
|
export const refreshKeypad = () => ports.refresh('keypad');
|
|
50
58
|
export const refreshTray = () => ports.refresh('tray');
|
|
59
|
+
export const refreshConfirm = () => ports.refresh('confirm');
|
|
51
60
|
//# sourceMappingURL=ports.js.map
|
package/dist/editor/ports.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/editor/ports.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ports.js","sourceRoot":"","sources":["../../src/editor/ports.ts"],"names":[],"mappings":"AA8GA,gFAAgF;AAChF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAgB,EAAE,CAAC,CAAC;IAC3C,OAAO,KAAI,CAAC;IACZ,KAAK,KAAI,CAAC;IACV,UAAU,KAAI,CAAC;IACf,WAAW,KAAI,CAAC;IAChB,WAAW,EAAE,GAAG,EAAE,CAAC,IAAI;IACvB,YAAY,KAAI,CAAC;IACjB,UAAU,KAAI,CAAC;IACf,aAAa,KAAI,CAAC;IAClB,aAAa,KAAI,CAAC;IAClB,WAAW,KAAI,CAAC;IAChB,kBAAkB,KAAI,CAAC;IACvB,mBAAmB,KAAI,CAAC;IACxB,cAAc,KAAI,CAAC;IACnB,YAAY,KAAI,CAAC;IACjB,SAAS,KAAI,CAAC;IACd,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK;IAC5B,WAAW,KAAI,CAAC;IAChB,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK;IAC5B,IAAI,KAAI,CAAC;IACT,QAAQ,KAAI,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;AAC5B,IAAI,KAAK,GAAgB,OAAO,CAAC;AAEjC,gGAAgG;A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,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,YAAY,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,aAAa,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/editor/project.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { settings, type Layers } from '../model/settings';
|
|
2
|
+
import type { Underlay } from '../model/types';
|
|
3
|
+
import { type Unit } from '../units';
|
|
2
4
|
/** Show another page: its drawing, view and selection. */
|
|
3
5
|
export declare function switchPage(id: string): void;
|
|
4
6
|
export declare function addPage(): void;
|
|
@@ -13,11 +15,22 @@ export type LayerKey = keyof Layers | 'showCons';
|
|
|
13
15
|
export declare const LAYER_ROWS: [LayerKey, string, string][];
|
|
14
16
|
export declare const layerOn: (k: LayerKey) => boolean;
|
|
15
17
|
export declare function toggleLayer(k: LayerKey): void;
|
|
16
|
-
|
|
17
|
-
export declare function
|
|
18
|
-
/**
|
|
19
|
-
export declare
|
|
20
|
-
export declare function
|
|
18
|
+
/** The image being worked on: the one selected (or, if there's just one on the page, that one). */
|
|
19
|
+
export declare function targetImage(id?: string): Underlay | undefined;
|
|
20
|
+
/** The steps an image's opacity takes (percent). */
|
|
21
|
+
export declare const OPACITY_MIN = 10, OPACITY_STEP = 5;
|
|
22
|
+
export declare function setUnderlayOpacity(id: string, v: number): void;
|
|
23
|
+
/** How far an image turns (degrees, clockwise as seen, either way from upright), in steps of half a degree. */
|
|
24
|
+
export declare const ROTATE_MAX = 180, ROTATE_STEP = 0.5;
|
|
25
|
+
/** Turn an image about its middle: degrees clockwise as it's seen (0: upright). */
|
|
26
|
+
export declare function setUnderlayRotation(id: string, deg: number): void;
|
|
27
|
+
export declare function toggleUnderlayLock(id: string): void;
|
|
28
|
+
/** Calibrate an image: the Set scale tool (two points you know the distance between), that image selected. */
|
|
29
|
+
export declare function calibrateUnderlay(id?: string): void;
|
|
30
|
+
/** Take an image off the page (one undo step). */
|
|
31
|
+
export declare function removeUnderlay(id: string): void;
|
|
32
|
+
/** Bring an image in front of the others, or send it behind them (one undo step). */
|
|
33
|
+
export declare function restackImage(id: string, to: 'front' | 'back'): void;
|
|
21
34
|
/** The page's spaces with their floor area and perimeter (to inside wall faces), and the total area. */
|
|
22
35
|
export declare function spaceSchedule(): {
|
|
23
36
|
rows: {
|
|
@@ -33,7 +46,26 @@ export declare function renameSpace(id: string, name: string): void;
|
|
|
33
46
|
export declare function focusSpace(id: string): void;
|
|
34
47
|
/** Units, precision, the default wall height and the theme: display and new walls follow at once. */
|
|
35
48
|
export declare function setPreference<K extends 'unit' | 'denom' | 'wallH' | 'theme'>(k: K, v: (typeof settings)[K]): void;
|
|
36
|
-
|
|
49
|
+
/** The heights the Wall height setting offers in one tap (8', 9', 10'); anything else is Custom. */
|
|
50
|
+
export declare const WALL_PRESETS: number[];
|
|
51
|
+
/**
|
|
52
|
+
* Settings → Wall height: the height of every wall that hasn't one of its own. Refused (and says why) below a door's
|
|
53
|
+
* or window's head on such a wall, or outside 6'–30'. Returns whether it was set.
|
|
54
|
+
*/
|
|
55
|
+
export declare function setDefaultWallHeight(v: number): boolean;
|
|
56
|
+
/** Settings → Wall height → Custom: any height, on the keypad. */
|
|
57
|
+
export declare function editDefaultWallHeight(): void;
|
|
58
|
+
export type UnitChoice = 'account' | Unit;
|
|
59
|
+
/**
|
|
60
|
+
* Settings → Units: the editor's own units (ft-in, in, mm), or 'account' — the host's (BOLDR: the person's account
|
|
61
|
+
* settings). Remembered in this browser, so it sticks from drawing to drawing.
|
|
62
|
+
*/
|
|
63
|
+
export declare function setUnits(choice: UnitChoice): void;
|
|
64
|
+
/** Settings → Precision (the editor's own inch units). */
|
|
65
|
+
export declare function setPrecision(denom: number): void;
|
|
66
|
+
/** Put back the units the person picked last time (after the host's units are set). */
|
|
67
|
+
export declare function restoreUnits(): void;
|
|
68
|
+
export declare function togglePreference(k: 'snapGrid' | 'autoCons' | 'toolTips'): void;
|
|
37
69
|
/**
|
|
38
70
|
* Put a picked image (a data URL, `w` × `h` pixels) under the drawing: 60% of the view wide, centred, selected so
|
|
39
71
|
* its handles show, in Annotate mode where it can be sized, scaled and locked.
|
package/dist/editor/project.js
CHANGED
|
@@ -2,16 +2,20 @@ import { afterEdit, analyze } from '../app/edit';
|
|
|
2
2
|
import { ed } from '../app/state';
|
|
3
3
|
import { newPage } from '../model/demo';
|
|
4
4
|
import { pushHistory } from '../model/history';
|
|
5
|
-
import { deep } from '../model/ids';
|
|
5
|
+
import { deep, uid } from '../model/ids';
|
|
6
|
+
import { imageById } from '../model/images';
|
|
6
7
|
import { roomGeom } from '../model/rooms';
|
|
7
8
|
import { sessionState, onSessionReset } from '../model/session';
|
|
8
9
|
import { settings } from '../model/settings';
|
|
9
10
|
import { roomValid } from '../model/sketch';
|
|
10
|
-
import { allPages, page,
|
|
11
|
-
import {
|
|
11
|
+
import { allPages, page, planSK, saveSoon, store } from '../model/store';
|
|
12
|
+
import { closeElevation } from './elevation';
|
|
13
|
+
import { cvs, fitView, mainT, requestDraw, requestImageDraw, s2w, underlayH } from '../render/view';
|
|
12
14
|
import { cancelTool, setTool } from '../tools/registry';
|
|
15
|
+
import { fmtLen, followingHostUnits, hostUnits, setOwnUnits } from '../units';
|
|
16
|
+
import { openingHeights } from '../model/elevation';
|
|
13
17
|
import { setMode } from './mode';
|
|
14
|
-
import { closeKeypad, dismissConflict, refreshDrawerSoon, toast, updateCtx, updateStatus, updateTopBar } from './ports';
|
|
18
|
+
import { closeKeypad, dismissConflict, openKeypad, refreshDrawerSoon, toast, updateCtx, updateStatus, updateTopBar } from './ports';
|
|
15
19
|
/*
|
|
16
20
|
The project panel's decisions, whatever draws it: pages (switch, add, duplicate, delete with a second tap to
|
|
17
21
|
confirm, rename), the project's name, layer switches, the page's photo or plan underlay, and the spaces schedule.
|
|
@@ -23,6 +27,7 @@ onSessionReset(() => clearTimeout(pendingT));
|
|
|
23
27
|
export function switchPage(id) {
|
|
24
28
|
if (id === store.curPageId)
|
|
25
29
|
return;
|
|
30
|
+
closeElevation(); // the wall view is of this page's walls
|
|
26
31
|
cancelTool();
|
|
27
32
|
closeKeypad();
|
|
28
33
|
dismissConflict();
|
|
@@ -48,8 +53,8 @@ export function addPage() {
|
|
|
48
53
|
toast('New page added');
|
|
49
54
|
}
|
|
50
55
|
export function duplicatePage() {
|
|
51
|
-
const p = newPage(page().name + ' copy', deep(
|
|
52
|
-
p.
|
|
56
|
+
const p = newPage(page().name + ' copy', deep(planSK()));
|
|
57
|
+
p.underlays = deep(page().underlays);
|
|
53
58
|
store.project.pages.splice(store.project.pages.indexOf(page()) + 1, 0, p);
|
|
54
59
|
switchPage(p.id);
|
|
55
60
|
toast('Page duplicated');
|
|
@@ -58,7 +63,7 @@ export function duplicatePage() {
|
|
|
58
63
|
export const deletePending = () => pj.pendingDelete === store.curPageId;
|
|
59
64
|
export function deletePage() {
|
|
60
65
|
if (allPages().length <= 1) {
|
|
61
|
-
toast('A project needs at least one page.');
|
|
66
|
+
toast('A project needs at least one page.', { warn: true });
|
|
62
67
|
return;
|
|
63
68
|
}
|
|
64
69
|
if (pj.pendingDelete !== store.curPageId) {
|
|
@@ -82,7 +87,8 @@ export const LAYER_ROWS = [
|
|
|
82
87
|
['dims', 'Driving dimensions', 'Blue chips that set sizes'],
|
|
83
88
|
['print', 'Print dimensions', 'Labels for the crew; never move geometry'],
|
|
84
89
|
['rooms', 'Spaces', 'Fill, name and area'],
|
|
85
|
-
['
|
|
90
|
+
['cabinets', 'Cabinets', 'Their footprints, from each wall’s view'],
|
|
91
|
+
['annot', 'Markup', 'Pen, arrows, shapes, clouds and notes'],
|
|
86
92
|
['showCons', 'Constraint icons', 'H, V, ∥, ⊥ badges'],
|
|
87
93
|
];
|
|
88
94
|
export const layerOn = (k) => (k === 'showCons' ? settings.showCons : settings.layers[k]);
|
|
@@ -98,36 +104,81 @@ export function toggleLayer(k) {
|
|
|
98
104
|
refreshDrawerSoon();
|
|
99
105
|
saveSoon();
|
|
100
106
|
}
|
|
101
|
-
// ---- the page's
|
|
102
|
-
|
|
103
|
-
|
|
107
|
+
// ---- the page's photos and plans ----
|
|
108
|
+
/** The image being worked on: the one selected (or, if there's just one on the page, that one). */
|
|
109
|
+
export function targetImage(id) {
|
|
110
|
+
const ims = page().underlays;
|
|
111
|
+
if (id)
|
|
112
|
+
return imageById(id);
|
|
113
|
+
const sel = ed.sel.find(x => x.type === 'underlay');
|
|
114
|
+
return sel ? imageById(sel.id) : ims.length === 1 ? ims[0] : undefined;
|
|
115
|
+
}
|
|
116
|
+
/** The steps an image's opacity takes (percent). */
|
|
117
|
+
export const OPACITY_MIN = 10, OPACITY_STEP = 5;
|
|
118
|
+
export function setUnderlayOpacity(id, v) {
|
|
119
|
+
const u = imageById(id);
|
|
104
120
|
if (!u)
|
|
105
121
|
return;
|
|
106
122
|
u.opacity = v;
|
|
107
|
-
|
|
123
|
+
requestImageDraw();
|
|
108
124
|
saveSoon();
|
|
109
125
|
}
|
|
110
|
-
|
|
111
|
-
|
|
126
|
+
/** How far an image turns (degrees, clockwise as seen, either way from upright), in steps of half a degree. */
|
|
127
|
+
export const ROTATE_MAX = 180, ROTATE_STEP = 0.5;
|
|
128
|
+
/** Turn an image about its middle: degrees clockwise as it's seen (0: upright). */
|
|
129
|
+
export function setUnderlayRotation(id, deg) {
|
|
130
|
+
const u = imageById(id);
|
|
131
|
+
if (!u)
|
|
132
|
+
return;
|
|
133
|
+
// (-180, 180]: a whole turn either way is the same as none
|
|
134
|
+
const r = ((((deg + 180) % 360) + 360) % 360) - 180 || 0;
|
|
135
|
+
if (Math.abs(r) < 1e-9)
|
|
136
|
+
delete u.rot;
|
|
137
|
+
else
|
|
138
|
+
u.rot = r === -180 ? 180 : r;
|
|
139
|
+
requestImageDraw();
|
|
140
|
+
saveSoon();
|
|
141
|
+
}
|
|
142
|
+
export function toggleUnderlayLock(id) {
|
|
143
|
+
const u = imageById(id);
|
|
112
144
|
if (!u)
|
|
113
145
|
return;
|
|
114
146
|
pushHistory();
|
|
115
147
|
u.locked = !u.locked;
|
|
116
148
|
afterEdit();
|
|
117
149
|
}
|
|
118
|
-
/** Calibrate
|
|
119
|
-
export function calibrateUnderlay() {
|
|
120
|
-
|
|
121
|
-
|
|
150
|
+
/** Calibrate an image: the Set scale tool (two points you know the distance between), that image selected. */
|
|
151
|
+
export function calibrateUnderlay(id) {
|
|
152
|
+
const u = targetImage(id);
|
|
153
|
+
setMode('annotate');
|
|
154
|
+
if (u)
|
|
155
|
+
ed.sel = [{ type: 'underlay', id: u.id }];
|
|
156
|
+
setTool('calib');
|
|
157
|
+
}
|
|
158
|
+
/** Take an image off the page (one undo step). */
|
|
159
|
+
export function removeUnderlay(id) {
|
|
160
|
+
if (!imageById(id))
|
|
161
|
+
return;
|
|
162
|
+
pushHistory();
|
|
163
|
+
page().underlays = page().underlays.filter(u => u.id !== id);
|
|
164
|
+
ed.sel = ed.sel.filter(x => !(x.type === 'underlay' && x.id === id));
|
|
165
|
+
afterEdit();
|
|
122
166
|
refreshDrawerSoon();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
167
|
+
}
|
|
168
|
+
/** Bring an image in front of the others, or send it behind them (one undo step). */
|
|
169
|
+
export function restackImage(id, to) {
|
|
170
|
+
const ims = page().underlays, u = imageById(id);
|
|
171
|
+
if (!u || ims.length < 2)
|
|
172
|
+
return;
|
|
173
|
+
pushHistory();
|
|
174
|
+
const rest = ims.filter(x => x !== u);
|
|
175
|
+
page().underlays = to === 'front' ? [...rest, u] : [u, ...rest];
|
|
176
|
+
afterEdit();
|
|
126
177
|
}
|
|
127
178
|
// ---- spaces ----
|
|
128
179
|
/** The page's spaces with their floor area and perimeter (to inside wall faces), and the total area. */
|
|
129
180
|
export function spaceSchedule() {
|
|
130
|
-
const sk =
|
|
181
|
+
const sk = planSK(), rows = Object.entries(sk.rooms).filter(([, r]) => roomValid(sk, r)).map(([id, r]) => {
|
|
131
182
|
const g = roomGeom(sk, r);
|
|
132
183
|
return { id, name: r.name, area: g.area, per: g.per };
|
|
133
184
|
});
|
|
@@ -135,7 +186,7 @@ export function spaceSchedule() {
|
|
|
135
186
|
}
|
|
136
187
|
export function renameSpace(id, name) {
|
|
137
188
|
pushHistory();
|
|
138
|
-
|
|
189
|
+
planSK().rooms[id].name = name.trim() || 'Space';
|
|
139
190
|
afterEdit();
|
|
140
191
|
}
|
|
141
192
|
/** Select a space on the drawing (its name field took focus). */
|
|
@@ -146,6 +197,85 @@ export function setPreference(k, v) {
|
|
|
146
197
|
settings[k] = v;
|
|
147
198
|
afterEdit();
|
|
148
199
|
}
|
|
200
|
+
/** The heights the Wall height setting offers in one tap (8', 9', 10'); anything else is Custom. */
|
|
201
|
+
export const WALL_PRESETS = [96, 108, 120];
|
|
202
|
+
/** The lowest and highest default wall height accepted. */
|
|
203
|
+
const WALL_MIN = 72, WALL_MAX = 360;
|
|
204
|
+
/**
|
|
205
|
+
* Settings → Wall height: the height of every wall that hasn't one of its own. Refused (and says why) below a door's
|
|
206
|
+
* or window's head on such a wall, or outside 6'–30'. Returns whether it was set.
|
|
207
|
+
*/
|
|
208
|
+
export function setDefaultWallHeight(v) {
|
|
209
|
+
if (!(v >= WALL_MIN && v <= WALL_MAX)) {
|
|
210
|
+
toast('Enter a wall height between ' + fmtLen(WALL_MIN) + ' and ' + fmtLen(WALL_MAX) + '.', { warn: true });
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
const sk = planSK(), own = (lid) => sk.lines[lid]?.height != null;
|
|
214
|
+
const tallest = Math.max(0, ...Object.values(sk.openings).filter(o => !own(o.line)).map(o => openingHeights(o).head));
|
|
215
|
+
if (v < tallest - 1e-6) {
|
|
216
|
+
toast('A door or window reaches ' + fmtLen(tallest) + '. Enter ' + fmtLen(tallest) + ' or more, or lower it first.', { warn: true });
|
|
217
|
+
return false;
|
|
218
|
+
}
|
|
219
|
+
setPreference('wallH', v);
|
|
220
|
+
return true;
|
|
221
|
+
}
|
|
222
|
+
/** Settings → Wall height → Custom: any height, on the keypad. */
|
|
223
|
+
export function editDefaultWallHeight() {
|
|
224
|
+
openKeypad({
|
|
225
|
+
title: 'Wall height', sub: 'Walls without their own height', initial: fmtLen(settings.wallH), selectAll: true, laser: true,
|
|
226
|
+
onDone: v => { setDefaultWallHeight(v); },
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
const UNITS_KEY = 'boldr-cad-units';
|
|
230
|
+
/**
|
|
231
|
+
* Settings → Units: the editor's own units (ft-in, in, mm), or 'account' — the host's (BOLDR: the person's account
|
|
232
|
+
* settings). Remembered in this browser, so it sticks from drawing to drawing.
|
|
233
|
+
*/
|
|
234
|
+
export function setUnits(choice) {
|
|
235
|
+
const host = hostUnits();
|
|
236
|
+
if (choice === 'account') {
|
|
237
|
+
if (host) {
|
|
238
|
+
settings.unit = host.unit;
|
|
239
|
+
settings.denom = host.denom;
|
|
240
|
+
}
|
|
241
|
+
setOwnUnits(false);
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
settings.unit = choice;
|
|
245
|
+
setOwnUnits(!!host);
|
|
246
|
+
}
|
|
247
|
+
rememberUnits();
|
|
248
|
+
afterEdit();
|
|
249
|
+
}
|
|
250
|
+
/** Settings → Precision (the editor's own inch units). */
|
|
251
|
+
export function setPrecision(denom) {
|
|
252
|
+
settings.denom = denom;
|
|
253
|
+
rememberUnits();
|
|
254
|
+
afterEdit();
|
|
255
|
+
}
|
|
256
|
+
function rememberUnits() {
|
|
257
|
+
if (!hostUnits())
|
|
258
|
+
return; // without a host the units are saved with the project
|
|
259
|
+
try {
|
|
260
|
+
localStorage.setItem(UNITS_KEY, JSON.stringify(followingHostUnits() ? 'account' : { unit: settings.unit, denom: settings.denom }));
|
|
261
|
+
}
|
|
262
|
+
catch { /* no storage here: just this session */ }
|
|
263
|
+
}
|
|
264
|
+
/** Put back the units the person picked last time (after the host's units are set). */
|
|
265
|
+
export function restoreUnits() {
|
|
266
|
+
if (!hostUnits())
|
|
267
|
+
return;
|
|
268
|
+
try {
|
|
269
|
+
const v = JSON.parse(localStorage.getItem(UNITS_KEY) || 'null');
|
|
270
|
+
if (!v || v === 'account' || !['ftin', 'in', 'mm'].includes(v.unit ?? ''))
|
|
271
|
+
return;
|
|
272
|
+
settings.unit = v.unit;
|
|
273
|
+
if (v.denom === 4 || v.denom === 8 || v.denom === 16)
|
|
274
|
+
settings.denom = v.denom;
|
|
275
|
+
setOwnUnits(true);
|
|
276
|
+
}
|
|
277
|
+
catch { /* nothing remembered */ }
|
|
278
|
+
}
|
|
149
279
|
export function togglePreference(k) {
|
|
150
280
|
settings[k] = !settings[k];
|
|
151
281
|
updateCtx();
|
|
@@ -158,13 +288,23 @@ export function togglePreference(k) {
|
|
|
158
288
|
*/
|
|
159
289
|
export function placeUnderlay(src, w, h) {
|
|
160
290
|
const T = mainT(), ww = (cvs.W / T.s) * 0.6, hh = (ww * h) / w;
|
|
161
|
-
|
|
162
|
-
|
|
291
|
+
let [cx, cy] = s2w(cvs.W / 2, cvs.H / 2);
|
|
292
|
+
// one already exactly there (the last one added): this one goes a little down and to the right, so both show
|
|
293
|
+
const step = 24 / T.s;
|
|
294
|
+
while (page().underlays.some(u => Math.abs(u.x + u.w / 2 - cx) < step / 2 && Math.abs(u.y - underlayH(u) / 2 - cy) < step / 2)) {
|
|
295
|
+
cx += step;
|
|
296
|
+
cy -= step;
|
|
297
|
+
}
|
|
298
|
+
pushHistory();
|
|
299
|
+
const id = uid('img');
|
|
300
|
+
page().underlays.push({ id, src, x: cx - ww / 2, y: cy + hh / 2, w: ww, h: hh, opacity: 0.6, locked: false });
|
|
163
301
|
settings.layers.underlay = true;
|
|
164
302
|
setMode('annotate');
|
|
165
303
|
setTool('aselect');
|
|
166
|
-
ed.sel = [{ type: 'underlay', id
|
|
304
|
+
ed.sel = [{ type: 'underlay', id }];
|
|
167
305
|
afterEdit();
|
|
168
|
-
toast(
|
|
306
|
+
toast(page().underlays.length > 1
|
|
307
|
+
? 'Image added on top of the others. Drag the corners to size it, or Set scale with two points you know.'
|
|
308
|
+
: 'Image added. Drag the corners to size it, or use Set scale with two points you know. Lock it once it’s placed.');
|
|
169
309
|
}
|
|
170
310
|
//# sourceMappingURL=project.js.map
|