@reekon-tools/boldr-cad 0.1.0 → 1.1.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 +99 -16
- 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 +9 -1
- package/dist/data/memory.js +13 -8
- package/dist/data/memory.js.map +1 -1
- package/dist/data/provider.d.ts +30 -10
- package/dist/data/sync.d.ts +14 -3
- package/dist/data/sync.js +133 -66
- 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 +20 -5
- package/dist/editor/keypad.js +62 -15
- 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 +38 -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 +170 -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 +7 -1
- 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 +54 -4
- package/dist/react/CadEditor.js +79 -21
- 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 +582 -97
- package/dist/tools/dim.js.map +1 -1
- package/dist/tools/elevation.js +5 -5
- 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 +25 -18
- 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 +11 -3
- package/dist/units/format.js +27 -6
- package/dist/units/format.js.map +1 -1
- package/dist/units/parse.d.ts +2 -1
- package/dist/units/parse.js +5 -4
- package/dist/units/parse.js.map +1 -1
- package/dist/units/prefs.d.ts +9 -1
- package/dist/units/prefs.js +6 -0
- package/dist/units/prefs.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 +15 -10
- package/src/data/provider.ts +25 -10
- package/src/data/sync.ts +107 -53
- 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 +67 -18
- 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 +39 -6
- package/src/editor/project.ts +157 -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 +7 -1
- 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 +142 -34
- 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 +525 -93
- package/src/tools/elevation.ts +5 -5
- 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 +11 -16
- 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 +24 -6
- package/src/units/parse.ts +4 -3
- package/src/units/prefs.ts +13 -1
- 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/src/data/sync.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
+
import { imagesOf } from '../model/images';
|
|
1
2
|
import { analyze } from '../app/edit';
|
|
2
3
|
import { ed } from '../app/state';
|
|
3
4
|
import { existsSel } from '../app/edit';
|
|
4
5
|
import { refreshDrawerSoon, renderElevation, updateCtx, updateStatus, updateTopBar } from '../editor/ports';
|
|
6
|
+
import { refreshLinks } from '../editor/links';
|
|
5
7
|
import { newPage } from '../model/demo';
|
|
6
|
-
import {
|
|
8
|
+
import { allCons } from '../model/faces';
|
|
9
|
+
import { syncFaces } from '../model/facesolve';
|
|
10
|
+
import { clearPageHistory, imageStored } from '../model/history';
|
|
7
11
|
import { defaultLayers, settings } from '../model/settings';
|
|
8
|
-
import {
|
|
12
|
+
import { store, type Persistence } from '../model/store';
|
|
9
13
|
import type { Constraint, Page, Project } from '../model/types';
|
|
14
|
+
import { dimMeasurement, dimValueOf } from '../model/measurement';
|
|
15
|
+
import { linkedMeasurements } from '../model/links';
|
|
10
16
|
import { setDimValue } from '../tools/dim';
|
|
11
17
|
import { aliasImage, requestDraw } from '../render/view';
|
|
12
18
|
import type { CadDataProvider, CadFileMeta, CadMeasurementValue, CadPageDoc } from './provider';
|
|
@@ -24,10 +30,16 @@ export class NotACadDrawing extends Error {
|
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
export interface CadSyncOptions {
|
|
27
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* The file was just created here: start its first page without waiting for the server's word on its pages (offline,
|
|
35
|
+
* the cache says there are none, as it says of any drawing never opened on this device). Also starts a new drawing
|
|
36
|
+
* when the file has no drawing record yet.
|
|
37
|
+
*/
|
|
28
38
|
initialize?: boolean;
|
|
29
39
|
/** a write or upload failed */
|
|
30
40
|
onError?: (e: unknown) => void;
|
|
41
|
+
/** closes the drawing while it's still opening (the person left): the promise rejects and nothing is written */
|
|
42
|
+
signal?: AbortSignal;
|
|
31
43
|
}
|
|
32
44
|
|
|
33
45
|
export interface CadSync {
|
|
@@ -41,78 +53,77 @@ export interface CadSync {
|
|
|
41
53
|
saveThumbnail(dataUrl: string): void;
|
|
42
54
|
/** the URL to draw a stored underlay from (`stored:` references; see CadDataProvider.uploadImage) */
|
|
43
55
|
imageUrl?(ref: string): Promise<string>;
|
|
56
|
+
/** whether the drawing open in the editor differs from what was last saved (or taken in) */
|
|
57
|
+
hasChanges(): boolean;
|
|
58
|
+
/** how many writes or uploads have failed so far (a save failed if this grew) */
|
|
59
|
+
failures(): number;
|
|
44
60
|
}
|
|
45
61
|
|
|
46
|
-
const LENGTHS = new Set<Constraint['type']>(['dist', 'pldist', 'diam']);
|
|
47
|
-
|
|
48
62
|
/**
|
|
49
|
-
* A driving dimension's value as BOLDR keeps it: lengths in micrometres, angles in degrees. Null for what isn't
|
|
50
|
-
*
|
|
63
|
+
* A driving dimension's value as BOLDR keeps it: lengths in micrometres, angles in degrees. Null for what isn't one of
|
|
64
|
+
* the drawing's own measurements: reference and print dimensions, constraints without a value, and dimensions linked
|
|
65
|
+
* to a measurement of the job (the job's, not the drawing's: see editor/links.ts).
|
|
51
66
|
*/
|
|
52
67
|
export function measurementOf(c: Constraint): CadMeasurementValue | null {
|
|
53
|
-
|
|
54
|
-
if (c.type === 'angle') return { kind: 'angle', value: Math.round(c.value * 100) / 100 };
|
|
55
|
-
if (LENGTHS.has(c.type)) return { kind: 'length', value: Math.round(c.value * 25400) };
|
|
56
|
-
return null;
|
|
68
|
+
return c.measurementRef ? null : dimMeasurement(c);
|
|
57
69
|
}
|
|
58
|
-
const toInches = (m: CadMeasurementValue): number => (m.kind === 'angle' ? m.value : m.value / 25400);
|
|
59
70
|
|
|
60
71
|
/** The id of a new drawing's first page. */
|
|
61
72
|
export const FIRST_PAGE_ID = 'page-1';
|
|
62
73
|
|
|
63
|
-
const pageJson = (p: { name: string; sk: unknown; underlay
|
|
74
|
+
const pageJson = (p: { name: string; sk: unknown; underlays?: unknown; underlay?: unknown }) =>
|
|
75
|
+
JSON.stringify({ name: p.name, sk: p.sk, underlays: imagesOf(p as Parameters<typeof imagesOf>[0]) });
|
|
64
76
|
const newClientId = () => Date.now().toString(36) + '-' + Math.floor(Math.random() * 0x100000000).toString(36);
|
|
65
77
|
|
|
66
78
|
export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions = {}): Promise<CadSync> {
|
|
67
79
|
const clientId = newClientId();
|
|
68
80
|
let seq = 0, file: { name: string; meta: CadFileMeta | null } | null | undefined, pages: Record<string, CadPageDoc> | undefined;
|
|
81
|
+
/** whether the latest file and pages snapshots are the cache's word rather than the server's */
|
|
82
|
+
let fileFromCache = false, pagesFromCache = false;
|
|
69
83
|
/** what each page looked like when last saved or taken in (to tell local edits from remote ones) */
|
|
70
84
|
const saved = new Map<string, string>();
|
|
85
|
+
/** removed pages whose delete is queued or in flight */
|
|
86
|
+
const deleting = new Set<string>();
|
|
71
87
|
/** pages with a write queued or in flight (count per page) */
|
|
72
88
|
const writing = new Map<string, number>();
|
|
73
89
|
let savedMeta = '', project: Project | null = null, chain: Promise<void> = Promise.resolve(), stopped = false;
|
|
74
|
-
|
|
90
|
+
let failures = 0;
|
|
91
|
+
const fail = (e: unknown) => { failures++; opts.onError?.(e); };
|
|
75
92
|
const meas = provider.measurements;
|
|
76
93
|
/** each measurement's value as last written or seen (undefined: not heard from BOLDR yet) */
|
|
77
94
|
const known = new Map<string, number>();
|
|
78
|
-
/** dimensions whose measurement is being created: "pageId|constraintId" */
|
|
79
|
-
const creating = new Set<string>();
|
|
80
95
|
/** each dimension's measurement, so a dimension that undo brought back without its id gets the same one again */
|
|
81
96
|
const linked = new Map<string, string>();
|
|
82
97
|
let placed = '', unsubMeas: (() => void) | null = null;
|
|
83
98
|
const pagesNow = () => (store.project === project ? store.project : project)?.pages ?? [];
|
|
84
99
|
|
|
85
|
-
/**
|
|
100
|
+
/**
|
|
101
|
+
* The drawing's own measurements in BOLDR follow its dimensions: one a dimension already has (made by an earlier
|
|
102
|
+
* version, which kept every driving dimension as one) gets its new value. A new dimension stays the drawing's alone
|
|
103
|
+
* until the person saves it to the group (editor/linkActions.ts), when it's linked like any other measurement of the
|
|
104
|
+
* job — and those are the job's to keep (the host's `links`), never written here.
|
|
105
|
+
*/
|
|
86
106
|
function linkMeasurements(p: Project): void {
|
|
87
107
|
if (!meas) return;
|
|
88
108
|
const ids = new Set<string>();
|
|
89
|
-
for (const pg of p.pages) for (const [cid, c] of
|
|
109
|
+
for (const pg of p.pages) for (const [cid, c] of allCons(pg.sk)) {
|
|
90
110
|
const key = pg.id + '|' + cid;
|
|
111
|
+
// (linked to the job's: not the drawing's own, whatever it was before)
|
|
112
|
+
if (c.measurementRef) { if (c.measurementId) delete c.measurementId; linked.delete(key); continue; }
|
|
91
113
|
if (!c.measurementId && linked.has(key)) c.measurementId = linked.get(key);
|
|
92
|
-
if (c.measurementId)
|
|
114
|
+
if (!c.measurementId) continue;
|
|
115
|
+
ids.add(c.measurementId);
|
|
116
|
+
linked.set(key, c.measurementId);
|
|
93
117
|
const m = measurementOf(c);
|
|
94
|
-
if (
|
|
95
|
-
if (!c.measurementId) {
|
|
96
|
-
if (creating.has(key)) continue;
|
|
97
|
-
creating.add(key);
|
|
98
|
-
queue(async () => {
|
|
99
|
-
try {
|
|
100
|
-
const id = await meas.create(m);
|
|
101
|
-
known.set(id, m.value);
|
|
102
|
-
linked.set(key, id);
|
|
103
|
-
// the page's sketch may have been replaced since (undo): stamp the dimension as it is now
|
|
104
|
-
const cur = pagesNow().find(x => x.id === pg.id)?.sk.cons[cid];
|
|
105
|
-
if (cur && !cur.measurementId) { cur.measurementId = id; saveSoon(); }
|
|
106
|
-
} finally { creating.delete(key); }
|
|
107
|
-
});
|
|
108
|
-
} else if (known.has(c.measurementId) && known.get(c.measurementId) !== m.value) {
|
|
118
|
+
if (m && known.has(c.measurementId) && known.get(c.measurementId) !== m.value) {
|
|
109
119
|
const id = c.measurementId;
|
|
110
120
|
known.set(id, m.value);
|
|
111
121
|
queue(() => meas.update(id, m.value));
|
|
112
122
|
}
|
|
113
123
|
}
|
|
114
|
-
|
|
115
|
-
|
|
124
|
+
// where the drawing shows measurements: its own, and the job's it's linked to (each with its own group)
|
|
125
|
+
const job = linkedMeasurements(p), pj = JSON.stringify([[...ids].sort(), job.map(j => j.groupId + '|' + j.id + '|' + (j.columnId ?? '')).sort()]);
|
|
126
|
+
if (meas.setPlaced && pj !== placed) { placed = pj; const own = [...ids].sort(); queue(() => meas.setPlaced!(own, job)); }
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
/** A measurement changed elsewhere (or while the drawing was closed): its dimension follows. */
|
|
@@ -121,13 +132,21 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
121
132
|
const prev = known.get(id);
|
|
122
133
|
known.set(id, mv.value);
|
|
123
134
|
if (prev === mv.value) continue;
|
|
124
|
-
for (const pg of pagesNow()) for (const [cid, c] of
|
|
135
|
+
for (const pg of pagesNow()) for (const [cid, c] of allCons(pg.sk)) {
|
|
125
136
|
if (c.measurementId !== id) continue;
|
|
126
137
|
const m = measurementOf(c);
|
|
127
138
|
if (!m || m.value === mv.value) continue;
|
|
139
|
+
const editing = store.project === project && pg.id === store.curPageId;
|
|
140
|
+
const v = dimValueOf(c, mv); // (a fillet's radius is kept as its diameter)
|
|
141
|
+
if (!pg.sk.cons[cid]) {
|
|
142
|
+
// on a wall face: the face solves now on the page being edited (positions stay if it can't), elsewhere when next edited
|
|
143
|
+
c.value = v;
|
|
144
|
+
if (editing) { ed.badFaceCons = syncFaces(pg.sk); analyze(); requestDraw(); renderElevation(); }
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
128
147
|
// on the page being edited the drawing solves now (or explains why it can't); elsewhere when next edited
|
|
129
|
-
if (
|
|
130
|
-
else c.value =
|
|
148
|
+
if (editing) setDimValue(cid, v);
|
|
149
|
+
else c.value = v;
|
|
131
150
|
}
|
|
132
151
|
}
|
|
133
152
|
}
|
|
@@ -137,7 +156,7 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
137
156
|
format: 'boldr-cad', version: 1, pageOrder: p.pages.map(pg => pg.id),
|
|
138
157
|
settings: { wallH: settings.wallH, layers: { ...settings.layers } },
|
|
139
158
|
});
|
|
140
|
-
const docOf = (pg: Page): CadPageDoc => ({ name: pg.name, sk: pg.sk,
|
|
159
|
+
const docOf = (pg: Page): CadPageDoc => ({ name: pg.name, sk: pg.sk, underlays: pg.underlays, rev: { clientId, seq: ++seq } });
|
|
141
160
|
|
|
142
161
|
/** Take in pages and the record someone else changed, where nothing local is unsaved. */
|
|
143
162
|
function takeIn(): void {
|
|
@@ -149,10 +168,11 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
149
168
|
const json = pageJson(doc), local = project.pages.find(p => p.id === id);
|
|
150
169
|
if (local) {
|
|
151
170
|
if (pageJson(local) !== saved.get(id) || json === saved.get(id)) continue; // edited here since, or nothing new
|
|
152
|
-
local.name = doc.name; local.sk = doc.sk; local.
|
|
171
|
+
local.name = doc.name; local.sk = doc.sk; local.underlays = imagesOf(doc);
|
|
153
172
|
clearPageHistory(id);
|
|
154
173
|
if (id === store.curPageId) curChanged = true;
|
|
155
|
-
} else
|
|
174
|
+
} else if (saved.has(id)) continue; // removed here (not saved yet, or its delete is on the way)
|
|
175
|
+
else project.pages.push({ id, name: doc.name, sk: doc.sk, underlays: imagesOf(doc), view: null });
|
|
156
176
|
saved.set(id, json);
|
|
157
177
|
changed = true;
|
|
158
178
|
}
|
|
@@ -165,7 +185,7 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
165
185
|
if (file && file.name !== project.name) { project.name = file.name; changed = true; }
|
|
166
186
|
if (!changed) return;
|
|
167
187
|
if (curChanged) { analyze(); ed.sel = ed.sel.filter(existsSel); }
|
|
168
|
-
updateTopBar(); updateCtx(); updateStatus(); refreshDrawerSoon(); renderElevation(); requestDraw();
|
|
188
|
+
updateTopBar(); updateCtx(); updateStatus(); refreshDrawerSoon(); renderElevation(); requestDraw(); refreshLinks();
|
|
169
189
|
}
|
|
170
190
|
|
|
171
191
|
const persistence: Persistence = {
|
|
@@ -176,6 +196,8 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
176
196
|
const st = file?.meta?.settings;
|
|
177
197
|
if (st?.wallH) settings.wallH = st.wallH;
|
|
178
198
|
if (st?.layers) settings.layers = Object.assign(defaultLayers(), st.layers);
|
|
199
|
+
// the record as this editor would write it (a record missing newer settings isn't an unsaved change)
|
|
200
|
+
if (file?.meta) savedMeta = JSON.stringify(metaOf(project));
|
|
179
201
|
},
|
|
180
202
|
save() {
|
|
181
203
|
const p = store.project;
|
|
@@ -190,24 +212,39 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
190
212
|
queue(async () => {
|
|
191
213
|
try {
|
|
192
214
|
// traced images are stored as files: upload, then keep the reference (the picture already shown stays)
|
|
193
|
-
|
|
194
|
-
|
|
215
|
+
for (const u of pg.underlays) {
|
|
216
|
+
if (!u.src.startsWith('data:')) continue;
|
|
217
|
+
const local = u.src, ref = await provider.uploadImage(pg.id, local);
|
|
195
218
|
aliasImage(local, ref);
|
|
196
|
-
|
|
219
|
+
// the same picture wherever it's held: the page (if it's still there), and its undo steps
|
|
220
|
+
for (const v of pg.underlays) if (v.src === local) v.src = ref;
|
|
221
|
+
imageStored(pg.id, local, ref);
|
|
197
222
|
saved.set(pg.id, pageJson(pg));
|
|
198
223
|
requestDraw();
|
|
199
224
|
}
|
|
200
225
|
await provider.writePage(pg.id, docOf(pg));
|
|
226
|
+
} catch (e) {
|
|
227
|
+
// not written: the page counts as changed again, so the next save retries it
|
|
228
|
+
if (saved.get(pg.id) === json || saved.get(pg.id) === pageJson(pg)) saved.delete(pg.id);
|
|
229
|
+
throw e;
|
|
201
230
|
} finally { done(); }
|
|
202
231
|
});
|
|
203
232
|
}
|
|
204
233
|
for (const id of [...saved.keys()]) {
|
|
205
|
-
if (p.pages.some(pg => pg.id === id)) continue;
|
|
206
|
-
|
|
207
|
-
queue(() =>
|
|
234
|
+
if (p.pages.some(pg => pg.id === id) || deleting.has(id)) continue;
|
|
235
|
+
deleting.add(id);
|
|
236
|
+
queue(async () => {
|
|
237
|
+
try { await provider.deletePage(id); saved.delete(id); } finally { deleting.delete(id); }
|
|
238
|
+
});
|
|
208
239
|
}
|
|
209
240
|
const meta = metaOf(p), mj = JSON.stringify(meta);
|
|
210
|
-
if (mj !== savedMeta) {
|
|
241
|
+
if (mj !== savedMeta) {
|
|
242
|
+
const was = savedMeta;
|
|
243
|
+
savedMeta = mj;
|
|
244
|
+
queue(async () => {
|
|
245
|
+
try { await provider.writeMeta(meta); } catch (e) { if (savedMeta === mj) savedMeta = was; throw e; }
|
|
246
|
+
});
|
|
247
|
+
}
|
|
211
248
|
return true;
|
|
212
249
|
},
|
|
213
250
|
};
|
|
@@ -216,12 +253,17 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
216
253
|
let ready = false;
|
|
217
254
|
const tryOpen = () => {
|
|
218
255
|
if (ready || file === undefined || pages === undefined) return;
|
|
256
|
+
// the cache's word isn't final: a file it hasn't got, or a drawing whose pages it hasn't got, may well be on the
|
|
257
|
+
// server — wait for its answer (a file just created here is fresh: its first page is made without waiting)
|
|
258
|
+
if (file === null && fileFromCache) return;
|
|
259
|
+
const fresh = !!opts.initialize && !file?.meta?.pageOrder.length;
|
|
260
|
+
if (file && !Object.keys(pages).length && pagesFromCache && !fresh) return;
|
|
219
261
|
ready = true;
|
|
220
262
|
if (file === null) { stop(); reject(new NotACadDrawing('missing')); return; }
|
|
221
263
|
if (!file.meta && !opts.initialize) { stop(); reject(new NotACadDrawing('legacy')); return; }
|
|
222
264
|
const order = file.meta?.pageOrder ?? [];
|
|
223
265
|
const ids = [...order.filter(id => pages![id]), ...Object.keys(pages!).filter(id => !order.includes(id))];
|
|
224
|
-
project = { name: file.name, pages: ids.map(id => ({ id, name: pages![id].name, sk: pages![id].sk,
|
|
266
|
+
project = { name: file.name, pages: ids.map(id => ({ id, name: pages![id].name, sk: pages![id].sk, underlays: imagesOf(pages![id]), view: null })) };
|
|
225
267
|
for (const id of ids) saved.set(id, pageJson(pages![id]));
|
|
226
268
|
if (file.meta) savedMeta = JSON.stringify(file.meta);
|
|
227
269
|
// a new drawing (or one whose pages are all gone) starts with one empty page, saved straight away; its id is
|
|
@@ -238,11 +280,23 @@ export function openCadDrawing(provider: CadDataProvider, opts: CadSyncOptions =
|
|
|
238
280
|
persistence, stop, idle: () => chain,
|
|
239
281
|
saveThumbnail: dataUrl => { if (provider.uploadThumbnail) queue(() => provider.uploadThumbnail!(dataUrl)); },
|
|
240
282
|
imageUrl: provider.imageUrl ? ref => provider.imageUrl!(ref) : undefined,
|
|
283
|
+
hasChanges: () => {
|
|
284
|
+
const p = store.project === project ? store.project : project;
|
|
285
|
+
if (!p) return false;
|
|
286
|
+
if (p.pages.some(pg => pageJson(pg) !== saved.get(pg.id))) return true;
|
|
287
|
+
if ([...saved.keys()].some(id => !p.pages.some(pg => pg.id === id))) return true;
|
|
288
|
+
return JSON.stringify(metaOf(p)) !== savedMeta;
|
|
289
|
+
},
|
|
290
|
+
failures: () => failures,
|
|
241
291
|
});
|
|
242
292
|
};
|
|
243
|
-
const unsubFile = provider.subscribeFile(f => { file = f; if (ready) takeIn(); else tryOpen(); });
|
|
244
|
-
const unsubPages = provider.subscribePages(p => { pages = p; if (ready) takeIn(); else tryOpen(); });
|
|
293
|
+
const unsubFile = provider.subscribeFile((f, m) => { file = f; fileFromCache = !!m?.fromCache; if (ready) takeIn(); else tryOpen(); });
|
|
294
|
+
const unsubPages = provider.subscribePages((p, m) => { pages = p; pagesFromCache = !!m?.fromCache; if (ready) takeIn(); else tryOpen(); });
|
|
245
295
|
unsubMeas = meas ? meas.subscribe(takeInMeasurements) : null;
|
|
246
296
|
function stop() { stopped = true; unsubFile(); unsubPages(); unsubMeas?.(); }
|
|
297
|
+
// left while still opening: let go of the drawing, nothing written
|
|
298
|
+
const abort = () => { if (ready) return; ready = true; stop(); reject(new Error('closed')); };
|
|
299
|
+
if (opts.signal?.aborted) abort();
|
|
300
|
+
else opts.signal?.addEventListener('abort', abort, { once: true });
|
|
247
301
|
});
|
|
248
302
|
}
|