@mlightcad/cad-simple-viewer 1.5.5 → 1.5.7
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/LICENSE +1 -1
- package/README.md +69 -1
- package/dist/{index.js → cad-simple-viewer.js} +34247 -29923
- package/dist/cad-simple-viewer.umd.cjs +913 -0
- package/dist/dxf-parser-worker.js +2091 -0
- package/dist/libredwg-parser-worker.js +5388 -5122
- package/dist/mtext-renderer-worker.js +3061 -2858
- package/lib/app/AcApContext.d.ts.map +1 -1
- package/lib/app/AcApContext.js +15 -2
- package/lib/app/AcApContext.js.map +1 -1
- package/lib/app/AcApDocManager.d.ts +63 -0
- package/lib/app/AcApDocManager.d.ts.map +1 -1
- package/lib/app/AcApDocManager.js +195 -23
- package/lib/app/AcApDocManager.js.map +1 -1
- package/lib/app/AcApDocument.d.ts +81 -0
- package/lib/app/AcApDocument.d.ts.map +1 -1
- package/lib/app/AcApDocument.js +154 -0
- package/lib/app/AcApDocument.js.map +1 -1
- package/lib/app/AcApLayerSessionState.d.ts +15 -0
- package/lib/app/AcApLayerSessionState.d.ts.map +1 -0
- package/lib/app/AcApLayerSessionState.js +2 -0
- package/lib/app/AcApLayerSessionState.js.map +1 -0
- package/lib/app/AcApOpenFileDialog.d.ts +35 -0
- package/lib/app/AcApOpenFileDialog.d.ts.map +1 -0
- package/lib/app/AcApOpenFileDialog.js +192 -0
- package/lib/app/AcApOpenFileDialog.js.map +1 -0
- package/lib/app/AcApWebworkerReadiness.d.ts +18 -0
- package/lib/app/AcApWebworkerReadiness.d.ts.map +1 -0
- package/lib/app/AcApWebworkerReadiness.js +126 -0
- package/lib/app/AcApWebworkerReadiness.js.map +1 -0
- package/lib/app/AcDbOpenDatabaseOptions.d.ts +29 -0
- package/lib/app/AcDbOpenDatabaseOptions.d.ts.map +1 -1
- package/lib/app/AcDbOpenDatabaseOptions.js +10 -1
- package/lib/app/AcDbOpenDatabaseOptions.js.map +1 -1
- package/lib/app/index.d.ts +4 -0
- package/lib/app/index.d.ts.map +1 -1
- package/lib/app/index.js +3 -0
- package/lib/app/index.js.map +1 -1
- package/lib/command/AcApCacheFontCmd.d.ts +25 -0
- package/lib/command/AcApCacheFontCmd.d.ts.map +1 -0
- package/lib/command/AcApCacheFontCmd.js +142 -0
- package/lib/command/AcApCacheFontCmd.js.map +1 -0
- package/lib/command/AcApOpenCmd.d.ts +3 -22
- package/lib/command/AcApOpenCmd.d.ts.map +1 -1
- package/lib/command/AcApOpenCmd.js +3 -22
- package/lib/command/AcApOpenCmd.js.map +1 -1
- package/lib/command/AcApRedoCmd.d.ts +10 -0
- package/lib/command/AcApRedoCmd.d.ts.map +1 -0
- package/lib/command/AcApRedoCmd.js +85 -0
- package/lib/command/AcApRedoCmd.js.map +1 -0
- package/lib/command/AcApSysVarCmd.d.ts.map +1 -1
- package/lib/command/AcApSysVarCmd.js +5 -11
- package/lib/command/AcApSysVarCmd.js.map +1 -1
- package/lib/command/AcApUndoCmd.d.ts +10 -0
- package/lib/command/AcApUndoCmd.d.ts.map +1 -0
- package/lib/command/AcApUndoCmd.js +85 -0
- package/lib/command/AcApUndoCmd.js.map +1 -0
- package/lib/command/convert/AcApPngConvertor.d.ts +1 -1
- package/lib/command/convert/AcApPngConvertor.d.ts.map +1 -1
- package/lib/command/convert/AcApPngConvertor.js +5 -2
- package/lib/command/convert/AcApPngConvertor.js.map +1 -1
- package/lib/command/draw/AcApArcCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApArcCmd.js +2 -5
- package/lib/command/draw/AcApArcCmd.js.map +1 -1
- package/lib/command/draw/AcApEllipseCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApEllipseCmd.js +14 -9
- package/lib/command/draw/AcApEllipseCmd.js.map +1 -1
- package/lib/command/draw/AcApHatchCmd.d.ts +1 -1
- package/lib/command/draw/AcApLineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApLineCmd.js +8 -2
- package/lib/command/draw/AcApLineCmd.js.map +1 -1
- package/lib/command/draw/AcApMLineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApMLineCmd.js +4 -2
- package/lib/command/draw/AcApMLineCmd.js.map +1 -1
- package/lib/command/draw/AcApPolygonCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApPolygonCmd.js +2 -5
- package/lib/command/draw/AcApPolygonCmd.js.map +1 -1
- package/lib/command/draw/AcApPolylineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApPolylineCmd.js +3 -0
- package/lib/command/draw/AcApPolylineCmd.js.map +1 -1
- package/lib/command/draw/AcApRectCmd.d.ts +6 -0
- package/lib/command/draw/AcApRectCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApRectCmd.js +12 -10
- package/lib/command/draw/AcApRectCmd.js.map +1 -1
- package/lib/command/draw/AcApSplineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApSplineCmd.js +2 -0
- package/lib/command/draw/AcApSplineCmd.js.map +1 -1
- package/lib/command/draw/AcApXLineCmd.d.ts.map +1 -1
- package/lib/command/draw/AcApXLineCmd.js +1 -1
- package/lib/command/draw/AcApXLineCmd.js.map +1 -1
- package/lib/command/index.d.ts +3 -0
- package/lib/command/index.d.ts.map +1 -1
- package/lib/command/index.js +3 -0
- package/lib/command/index.js.map +1 -1
- package/lib/command/layer/AcApLayerCmd.d.ts +3 -194
- package/lib/command/layer/AcApLayerCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerCmd.js +64 -398
- package/lib/command/layer/AcApLayerCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerCurCmd.d.ts +2 -34
- package/lib/command/layer/AcApLayerCurCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerCurCmd.js +18 -77
- package/lib/command/layer/AcApLayerCurCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerDelCmd.d.ts +2 -32
- package/lib/command/layer/AcApLayerDelCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerDelCmd.js +26 -169
- package/lib/command/layer/AcApLayerDelCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerFreezeCmd.d.ts +2 -16
- package/lib/command/layer/AcApLayerFreezeCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerFreezeCmd.js +32 -54
- package/lib/command/layer/AcApLayerFreezeCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerIsoCmd.d.ts +2 -31
- package/lib/command/layer/AcApLayerIsoCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerIsoCmd.js +19 -198
- package/lib/command/layer/AcApLayerIsoCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerLockCmd.d.ts +2 -40
- package/lib/command/layer/AcApLayerLockCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerLockCmd.js +18 -65
- package/lib/command/layer/AcApLayerLockCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerMutationCmd.d.ts +13 -0
- package/lib/command/layer/AcApLayerMutationCmd.d.ts.map +1 -0
- package/lib/command/layer/AcApLayerMutationCmd.js +42 -0
- package/lib/command/layer/AcApLayerMutationCmd.js.map +1 -0
- package/lib/command/layer/AcApLayerOffCmd.d.ts +2 -9
- package/lib/command/layer/AcApLayerOffCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerOffCmd.js +32 -43
- package/lib/command/layer/AcApLayerOffCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerOnCmd.d.ts +2 -22
- package/lib/command/layer/AcApLayerOnCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerOnCmd.js +8 -62
- package/lib/command/layer/AcApLayerOnCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerPCmd.d.ts +2 -75
- package/lib/command/layer/AcApLayerPCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerPCmd.js +6 -165
- package/lib/command/layer/AcApLayerPCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerThawCmd.d.ts +2 -29
- package/lib/command/layer/AcApLayerThawCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerThawCmd.js +8 -74
- package/lib/command/layer/AcApLayerThawCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerUnisoCmd.d.ts +2 -44
- package/lib/command/layer/AcApLayerUnisoCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerUnisoCmd.js +10 -122
- package/lib/command/layer/AcApLayerUnisoCmd.js.map +1 -1
- package/lib/command/layer/AcApLayerUnlockCmd.d.ts +2 -40
- package/lib/command/layer/AcApLayerUnlockCmd.d.ts.map +1 -1
- package/lib/command/layer/AcApLayerUnlockCmd.js +18 -65
- package/lib/command/layer/AcApLayerUnlockCmd.js.map +1 -1
- package/lib/command/modify/AcApCopyCmd.d.ts +12 -0
- package/lib/command/modify/AcApCopyCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApCopyCmd.js +67 -177
- package/lib/command/modify/AcApCopyCmd.js.map +1 -1
- package/lib/command/modify/AcApCopyPreviewJig.d.ts +21 -0
- package/lib/command/modify/AcApCopyPreviewJig.d.ts.map +1 -0
- package/lib/command/modify/AcApCopyPreviewJig.js +61 -0
- package/lib/command/modify/AcApCopyPreviewJig.js.map +1 -0
- package/lib/command/modify/AcApEraseCmd.d.ts +0 -6
- package/lib/command/modify/AcApEraseCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApEraseCmd.js +11 -38
- package/lib/command/modify/AcApEraseCmd.js.map +1 -1
- package/lib/command/modify/AcApHideObjectsCmd.d.ts +0 -7
- package/lib/command/modify/AcApHideObjectsCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApHideObjectsCmd.js +1 -8
- package/lib/command/modify/AcApHideObjectsCmd.js.map +1 -1
- package/lib/command/modify/AcApMoveCmd.d.ts +0 -6
- package/lib/command/modify/AcApMoveCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApMoveCmd.js +26 -105
- package/lib/command/modify/AcApMoveCmd.js.map +1 -1
- package/lib/command/modify/AcApMovePreviewJig.d.ts +18 -0
- package/lib/command/modify/AcApMovePreviewJig.d.ts.map +1 -0
- package/lib/command/modify/AcApMovePreviewJig.js +45 -0
- package/lib/command/modify/AcApMovePreviewJig.js.map +1 -0
- package/lib/command/modify/AcApOffsetCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApOffsetCmd.js +14 -37
- package/lib/command/modify/AcApOffsetCmd.js.map +1 -1
- package/lib/command/modify/AcApRotateCmd.d.ts +2 -2
- package/lib/command/modify/AcApRotateCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApRotateCmd.js +38 -204
- package/lib/command/modify/AcApRotateCmd.js.map +1 -1
- package/lib/command/modify/AcApRotatePreviewJig.d.ts +47 -0
- package/lib/command/modify/AcApRotatePreviewJig.d.ts.map +1 -0
- package/lib/command/modify/AcApRotatePreviewJig.js +97 -0
- package/lib/command/modify/AcApRotatePreviewJig.js.map +1 -0
- package/lib/command/modify/AcApUnisolateObjectsCmd.d.ts.map +1 -1
- package/lib/command/modify/AcApUnisolateObjectsCmd.js +3 -3
- package/lib/command/modify/AcApUnisolateObjectsCmd.js.map +1 -1
- package/lib/editor/command/AcEdCommand.d.ts +24 -0
- package/lib/editor/command/AcEdCommand.d.ts.map +1 -1
- package/lib/editor/command/AcEdCommand.js +71 -5
- package/lib/editor/command/AcEdCommand.js.map +1 -1
- package/lib/editor/global/AcEdUiColor.d.ts +13 -13
- package/lib/editor/global/AcEdUiColor.d.ts.map +1 -1
- package/lib/editor/global/AcEdUiColor.js +21 -20
- package/lib/editor/global/AcEdUiColor.js.map +1 -1
- package/lib/editor/global/eventBus.d.ts +16 -2
- package/lib/editor/global/eventBus.d.ts.map +1 -1
- package/lib/editor/global/eventBus.js.map +1 -1
- package/lib/editor/grip/AcEdGripAppearance.d.ts +18 -0
- package/lib/editor/grip/AcEdGripAppearance.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripAppearance.js +30 -0
- package/lib/editor/grip/AcEdGripAppearance.js.map +1 -0
- package/lib/editor/grip/AcEdGripEditSession.d.ts +29 -0
- package/lib/editor/grip/AcEdGripEditSession.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripEditSession.js +83 -0
- package/lib/editor/grip/AcEdGripEditSession.js.map +1 -0
- package/lib/editor/grip/AcEdGripHandle.d.ts +21 -0
- package/lib/editor/grip/AcEdGripHandle.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripHandle.js +62 -0
- package/lib/editor/grip/AcEdGripHandle.js.map +1 -0
- package/lib/editor/grip/AcEdGripManager.d.ts +171 -0
- package/lib/editor/grip/AcEdGripManager.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripManager.js +376 -0
- package/lib/editor/grip/AcEdGripManager.js.map +1 -0
- package/lib/editor/grip/AcEdGripPolicy.d.ts +6 -0
- package/lib/editor/grip/AcEdGripPolicy.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripPolicy.js +30 -0
- package/lib/editor/grip/AcEdGripPolicy.js.map +1 -0
- package/lib/editor/grip/AcEdGripPreviewJig.d.ts +21 -0
- package/lib/editor/grip/AcEdGripPreviewJig.d.ts.map +1 -0
- package/lib/editor/grip/AcEdGripPreviewJig.js +73 -0
- package/lib/editor/grip/AcEdGripPreviewJig.js.map +1 -0
- package/lib/editor/grip/index.d.ts +5 -0
- package/lib/editor/grip/index.d.ts.map +1 -0
- package/lib/editor/grip/index.js +5 -0
- package/lib/editor/grip/index.js.map +1 -0
- package/lib/editor/index.d.ts +1 -0
- package/lib/editor/index.d.ts.map +1 -1
- package/lib/editor/index.js +1 -0
- package/lib/editor/index.js.map +1 -1
- package/lib/editor/input/AcEdBatchPreview.d.ts +96 -0
- package/lib/editor/input/AcEdBatchPreview.d.ts.map +1 -0
- package/lib/editor/input/AcEdBatchPreview.js +125 -0
- package/lib/editor/input/AcEdBatchPreview.js.map +1 -0
- package/lib/editor/input/AcEdCursorManager.d.ts.map +1 -1
- package/lib/editor/input/AcEdCursorManager.js +2 -2
- package/lib/editor/input/AcEdCursorManager.js.map +1 -1
- package/lib/editor/input/AcEdOsnapResolver.d.ts +34 -0
- package/lib/editor/input/AcEdOsnapResolver.d.ts.map +1 -0
- package/lib/editor/input/AcEdOsnapResolver.js +117 -0
- package/lib/editor/input/AcEdOsnapResolver.js.map +1 -0
- package/lib/editor/input/AcEdPreviewJig.d.ts +1 -1
- package/lib/editor/input/AcEdPreviewJig.d.ts.map +1 -1
- package/lib/editor/input/AcEdPreviewJig.js +14 -0
- package/lib/editor/input/AcEdPreviewJig.js.map +1 -1
- package/lib/editor/input/AcEdSelectionPreviewJig.d.ts +109 -0
- package/lib/editor/input/AcEdSelectionPreviewJig.d.ts.map +1 -0
- package/lib/editor/input/AcEdSelectionPreviewJig.js +185 -0
- package/lib/editor/input/AcEdSelectionPreviewJig.js.map +1 -0
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts +2 -1
- package/lib/editor/input/handler/AcEdAngleHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdAngleHandler.js +6 -0
- package/lib/editor/input/handler/AcEdAngleHandler.js.map +1 -1
- package/lib/editor/input/handler/AcEdInputHandler.d.ts +20 -1
- package/lib/editor/input/handler/AcEdInputHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdKeywordHandler.d.ts +2 -1
- package/lib/editor/input/handler/AcEdKeywordHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdKeywordHandler.js +3 -0
- package/lib/editor/input/handler/AcEdKeywordHandler.js.map +1 -1
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts +2 -1
- package/lib/editor/input/handler/AcEdNumericalHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdNumericalHandler.js +6 -0
- package/lib/editor/input/handler/AcEdNumericalHandler.js.map +1 -1
- package/lib/editor/input/handler/AcEdPointHandler.d.ts +17 -1
- package/lib/editor/input/handler/AcEdPointHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdPointHandler.js +89 -0
- package/lib/editor/input/handler/AcEdPointHandler.js.map +1 -1
- package/lib/editor/input/handler/AcEdStringHandler.d.ts +2 -1
- package/lib/editor/input/handler/AcEdStringHandler.d.ts.map +1 -1
- package/lib/editor/input/handler/AcEdStringHandler.js +3 -0
- package/lib/editor/input/handler/AcEdStringHandler.js.map +1 -1
- package/lib/editor/input/index.d.ts +3 -0
- package/lib/editor/input/index.d.ts.map +1 -1
- package/lib/editor/input/index.js +3 -0
- package/lib/editor/input/index.js.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts +7 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.d.ts.map +1 -1
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js +17 -0
- package/lib/editor/input/prompt/AcEdPromptAngleOptions.js.map +1 -1
- package/lib/editor/input/session/AcEdInputSession.d.ts +11 -1
- package/lib/editor/input/session/AcEdInputSession.d.ts.map +1 -1
- package/lib/editor/input/session/AcEdInputSession.js.map +1 -1
- package/lib/editor/input/session/AcEdPromptInputSession.d.ts +51 -0
- package/lib/editor/input/session/AcEdPromptInputSession.d.ts.map +1 -0
- package/lib/editor/input/session/AcEdPromptInputSession.js +109 -0
- package/lib/editor/input/session/AcEdPromptInputSession.js.map +1 -0
- package/lib/editor/input/session/index.d.ts +1 -0
- package/lib/editor/input/session/index.d.ts.map +1 -1
- package/lib/editor/input/session/index.js +1 -0
- package/lib/editor/input/session/index.js.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.d.ts +10 -0
- package/lib/editor/input/ui/AcEdCommandLine.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdCommandLine.js +67 -35
- package/lib/editor/input/ui/AcEdCommandLine.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts +0 -11
- package/lib/editor/input/ui/AcEdFloatingInput.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInput.js +9 -119
- package/lib/editor/input/ui/AcEdFloatingInput.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBox.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBox.js +10 -2
- package/lib/editor/input/ui/AcEdFloatingInputBox.js.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js +9 -4
- package/lib/editor/input/ui/AcEdFloatingInputBoxes.js.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.d.ts +26 -23
- package/lib/editor/input/ui/AcEdInputManager.d.ts.map +1 -1
- package/lib/editor/input/ui/AcEdInputManager.js +135 -83
- package/lib/editor/input/ui/AcEdInputManager.js.map +1 -1
- package/lib/editor/input/ui/AcEdMTextEditor.js +2 -2
- package/lib/editor/input/ui/AcEdMTextEditor.js.map +1 -1
- package/lib/editor/view/AcEdBaseView.d.ts +44 -2
- package/lib/editor/view/AcEdBaseView.d.ts.map +1 -1
- package/lib/editor/view/AcEdBaseView.js +26 -12
- package/lib/editor/view/AcEdBaseView.js.map +1 -1
- package/lib/editor/view/AcEdSpatialQueryResult.d.ts +28 -0
- package/lib/editor/view/AcEdSpatialQueryResult.d.ts.map +1 -1
- package/lib/editor/view/AcEdSpatialQueryResult.js +65 -1
- package/lib/editor/view/AcEdSpatialQueryResult.js.map +1 -1
- package/lib/i18n/AcApI18n.d.ts +42 -0
- package/lib/i18n/AcApI18n.d.ts.map +1 -1
- package/lib/i18n/AcApI18n.js +56 -4
- package/lib/i18n/AcApI18n.js.map +1 -1
- package/lib/i18n/en/command.d.ts +26 -0
- package/lib/i18n/en/command.d.ts.map +1 -1
- package/lib/i18n/en/command.js +26 -0
- package/lib/i18n/en/command.js.map +1 -1
- package/lib/i18n/en/jig.d.ts +26 -0
- package/lib/i18n/en/jig.d.ts.map +1 -1
- package/lib/i18n/en/jig.js +134 -108
- package/lib/i18n/en/jig.js.map +1 -1
- package/lib/i18n/en/main.d.ts +3 -0
- package/lib/i18n/en/main.d.ts.map +1 -1
- package/lib/i18n/en/main.js +4 -1
- package/lib/i18n/en/main.js.map +1 -1
- package/lib/i18n/zh/command.d.ts +26 -0
- package/lib/i18n/zh/command.d.ts.map +1 -1
- package/lib/i18n/zh/command.js +26 -0
- package/lib/i18n/zh/command.js.map +1 -1
- package/lib/i18n/zh/jig.d.ts +26 -0
- package/lib/i18n/zh/jig.d.ts.map +1 -1
- package/lib/i18n/zh/jig.js +134 -108
- package/lib/i18n/zh/jig.js.map +1 -1
- package/lib/i18n/zh/main.d.ts +3 -0
- package/lib/i18n/zh/main.d.ts.map +1 -1
- package/lib/i18n/zh/main.js +4 -1
- package/lib/i18n/zh/main.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/plugin/AcApLazyPluginRegistration.d.ts +3 -8
- package/lib/plugin/AcApLazyPluginRegistration.d.ts.map +1 -1
- package/lib/service/AcApEntitySelection.d.ts +42 -0
- package/lib/service/AcApEntitySelection.d.ts.map +1 -0
- package/lib/service/AcApEntitySelection.js +156 -0
- package/lib/service/AcApEntitySelection.js.map +1 -0
- package/lib/service/AcApEntityService.d.ts +115 -0
- package/lib/service/AcApEntityService.d.ts.map +1 -0
- package/lib/service/AcApEntityService.js +194 -0
- package/lib/service/AcApEntityService.js.map +1 -0
- package/lib/{command/layer → service}/AcApLayerIsoState.d.ts +6 -24
- package/lib/service/AcApLayerIsoState.d.ts.map +1 -0
- package/lib/service/AcApLayerIsoState.js +28 -0
- package/lib/service/AcApLayerIsoState.js.map +1 -0
- package/lib/service/AcApLayerService.d.ts +400 -0
- package/lib/service/AcApLayerService.d.ts.map +1 -0
- package/lib/service/AcApLayerService.js +1240 -0
- package/lib/service/AcApLayerService.js.map +1 -0
- package/lib/service/AcApLayerStore.d.ts +198 -0
- package/lib/service/AcApLayerStore.d.ts.map +1 -0
- package/lib/service/AcApLayerStore.js +335 -0
- package/lib/service/AcApLayerStore.js.map +1 -0
- package/lib/service/AcApServiceEdit.d.ts +18 -0
- package/lib/service/AcApServiceEdit.d.ts.map +1 -0
- package/lib/service/AcApServiceEdit.js +34 -0
- package/lib/service/AcApServiceEdit.js.map +1 -0
- package/lib/service/index.d.ts +16 -0
- package/lib/service/index.d.ts.map +1 -0
- package/lib/service/index.js +16 -0
- package/lib/service/index.js.map +1 -0
- package/lib/service/types.d.ts +116 -0
- package/lib/service/types.d.ts.map +1 -0
- package/lib/service/types.js +5 -0
- package/lib/service/types.js.map +1 -0
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts +22 -7
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js +58 -12
- package/lib/spatialIndex/AcTrHierarchicalSpatialIndex.js.map +1 -1
- package/lib/spatialIndex/AcTrLinearSpatialIndex.d.ts +2 -2
- package/lib/spatialIndex/AcTrLinearSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrLinearSpatialIndex.js +9 -3
- package/lib/spatialIndex/AcTrLinearSpatialIndex.js.map +1 -1
- package/lib/spatialIndex/AcTrRBushSpatialIndex.d.ts +2 -2
- package/lib/spatialIndex/AcTrRBushSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrRBushSpatialIndex.js +19 -5
- package/lib/spatialIndex/AcTrRBushSpatialIndex.js.map +1 -1
- package/lib/spatialIndex/AcTrSpatialIndex.d.ts +10 -1
- package/lib/spatialIndex/AcTrSpatialIndex.d.ts.map +1 -1
- package/lib/spatialIndex/AcTrSpatialIndex.js +7 -1
- package/lib/spatialIndex/AcTrSpatialIndex.js.map +1 -1
- package/lib/util/AcApDatabaseEdit.d.ts +11 -0
- package/lib/util/AcApDatabaseEdit.d.ts.map +1 -0
- package/lib/util/AcApDatabaseEdit.js +20 -0
- package/lib/util/AcApDatabaseEdit.js.map +1 -0
- package/lib/util/AcApFontUtil.d.ts +14 -2
- package/lib/util/AcApFontUtil.d.ts.map +1 -1
- package/lib/util/AcApFontUtil.js +18 -0
- package/lib/util/AcApFontUtil.js.map +1 -1
- package/lib/util/AcApGeTransform.d.ts +10 -0
- package/lib/util/AcApGeTransform.d.ts.map +1 -0
- package/lib/util/AcApGeTransform.js +15 -0
- package/lib/util/AcApGeTransform.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.d.ts.map +1 -1
- package/lib/util/index.js +2 -0
- package/lib/util/index.js.map +1 -1
- package/lib/view/AcEdViewKeyHandler.d.ts +32 -0
- package/lib/view/AcEdViewKeyHandler.d.ts.map +1 -0
- package/lib/view/AcEdViewKeyHandler.js +101 -0
- package/lib/view/AcEdViewKeyHandler.js.map +1 -0
- package/lib/view/AcTrEntityDisplayController.d.ts +46 -0
- package/lib/view/AcTrEntityDisplayController.d.ts.map +1 -0
- package/lib/view/AcTrEntityDisplayController.js +114 -0
- package/lib/view/AcTrEntityDisplayController.js.map +1 -0
- package/lib/view/AcTrGroupWcsBboxAssert.d.ts +43 -0
- package/lib/view/AcTrGroupWcsBboxAssert.d.ts.map +1 -0
- package/lib/view/AcTrGroupWcsBboxAssert.js +84 -0
- package/lib/view/AcTrGroupWcsBboxAssert.js.map +1 -0
- package/lib/view/AcTrInheritedLayerMaterialMapper.d.ts +49 -0
- package/lib/view/AcTrInheritedLayerMaterialMapper.d.ts.map +1 -0
- package/lib/view/AcTrInheritedLayerMaterialMapper.js +138 -0
- package/lib/view/AcTrInheritedLayerMaterialMapper.js.map +1 -0
- package/lib/view/AcTrLayer.d.ts +33 -2
- package/lib/view/AcTrLayer.d.ts.map +1 -1
- package/lib/view/AcTrLayer.js +75 -2
- package/lib/view/AcTrLayer.js.map +1 -1
- package/lib/view/AcTrLayerAppearanceController.d.ts +55 -0
- package/lib/view/AcTrLayerAppearanceController.d.ts.map +1 -0
- package/lib/view/AcTrLayerAppearanceController.js +86 -0
- package/lib/view/AcTrLayerAppearanceController.js.map +1 -0
- package/lib/view/AcTrLayout.d.ts +37 -2
- package/lib/view/AcTrLayout.d.ts.map +1 -1
- package/lib/view/AcTrLayout.js +161 -15
- package/lib/view/AcTrLayout.js.map +1 -1
- package/lib/view/AcTrProgressiveOpenFitController.d.ts +64 -0
- package/lib/view/AcTrProgressiveOpenFitController.d.ts.map +1 -0
- package/lib/view/AcTrProgressiveOpenFitController.js +209 -0
- package/lib/view/AcTrProgressiveOpenFitController.js.map +1 -0
- package/lib/view/AcTrScene.d.ts +47 -1
- package/lib/view/AcTrScene.d.ts.map +1 -1
- package/lib/view/AcTrScene.js +78 -3
- package/lib/view/AcTrScene.js.map +1 -1
- package/lib/view/AcTrView2d.d.ts +118 -27
- package/lib/view/AcTrView2d.d.ts.map +1 -1
- package/lib/view/AcTrView2d.js +584 -362
- package/lib/view/AcTrView2d.js.map +1 -1
- package/lib/view/index.d.ts +3 -0
- package/lib/view/index.d.ts.map +1 -1
- package/lib/view/index.js +3 -0
- package/lib/view/index.js.map +1 -1
- package/package.json +13 -11
- package/dist/index.umd.cjs +0 -897
- package/lib/command/layer/AcApLayerIsoState.d.ts.map +0 -1
- package/lib/command/layer/AcApLayerIsoState.js +0 -53
- package/lib/command/layer/AcApLayerIsoState.js.map +0 -1
package/lib/view/AcTrView2d.js
CHANGED
|
@@ -71,25 +71,60 @@ var __values = (this && this.__values) || function(o) {
|
|
|
71
71
|
};
|
|
72
72
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
73
73
|
};
|
|
74
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
75
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
76
|
+
if (!m) return o;
|
|
77
|
+
var i = m.call(o), r, ar = [], e;
|
|
78
|
+
try {
|
|
79
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
80
|
+
}
|
|
81
|
+
catch (error) { e = { error: error }; }
|
|
82
|
+
finally {
|
|
83
|
+
try {
|
|
84
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
85
|
+
}
|
|
86
|
+
finally { if (e) throw e.error; }
|
|
87
|
+
}
|
|
88
|
+
return ar;
|
|
89
|
+
};
|
|
90
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
91
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
92
|
+
if (ar || !(i in from)) {
|
|
93
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
94
|
+
ar[i] = from[i];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
98
|
+
};
|
|
74
99
|
import { acdbHostApplicationServices, AcDbMText, AcDbRasterImage, AcDbRay, AcDbSysVarManager, AcDbViewport, AcDbXline, AcGeBox2d, AcGePoint2d, log } from '@mlightcad/data-model';
|
|
75
100
|
import { AcDbSystemVariables } from '@mlightcad/data-model';
|
|
76
|
-
import { AcTrEntity, AcTrGroup, AcTrRenderer, AcTrViewportView
|
|
101
|
+
import { AcTrEntity, AcTrGroup, AcTrRenderer, AcTrViewportView } from '@mlightcad/three-renderer';
|
|
102
|
+
import { AcTrMatrixUtil } from '@mlightcad/three-renderer';
|
|
77
103
|
import * as THREE from 'three';
|
|
78
104
|
import Stats from 'three/examples/jsm/libs/stats.module';
|
|
79
105
|
import { CSS2DRenderer } from 'three/examples/jsm/renderers/CSS2DRenderer.js';
|
|
80
106
|
import { AcApDocManager, AcApSettingManager } from '../app';
|
|
81
|
-
import { AcEdBaseView, AcEdConditionWaiter, AcEdCorsorType, AcEdMTextEditor, AcEdOpenMode, AcEdViewMode, eventBus, resolvePointerSelectionAction } from '../editor';
|
|
82
|
-
import {
|
|
107
|
+
import { AcEdBaseView, AcEdConditionWaiter, AcEdCorsorType, AcEdGripManager, AcEdMTextEditor, AcEdOpenMode, AcEdViewMode, eventBus, resolvePointerSelectionAction } from '../editor';
|
|
108
|
+
import { ACGI_MODEL_SPACE_BACKGROUND, isModelSpaceDatabase, readLayoutBackgroundColor } from '../editor/global/AcEdUiColor';
|
|
109
|
+
import { isEffectiveSpatialQueryHit } from '../editor/view/AcEdSpatialQueryResult';
|
|
83
110
|
import { AcTrGeometryUtil } from '../util';
|
|
111
|
+
import { acapRunDatabaseEdit } from '../util/AcApDatabaseEdit';
|
|
112
|
+
import { AcEdViewKeyHandler } from './AcEdViewKeyHandler';
|
|
113
|
+
import { AcTrEntityDisplayController } from './AcTrEntityDisplayController';
|
|
114
|
+
import { assertAcTrGroupWcsBboxesConsistent, unionGroupWcsChildBoxes } from './AcTrGroupWcsBboxAssert';
|
|
115
|
+
import { AcTrInheritedLayerMaterialMapper } from './AcTrInheritedLayerMaterialMapper';
|
|
116
|
+
import { AcTrLayer } from './AcTrLayer';
|
|
117
|
+
import { AcTrLayerAppearanceController } from './AcTrLayerAppearanceController';
|
|
84
118
|
import { AcTrLayoutView } from './AcTrLayoutView';
|
|
85
119
|
import { AcTrLayoutViewManager } from './AcTrLayoutViewManager';
|
|
86
120
|
import { sortPickResults } from './AcTrPickResultUtil';
|
|
121
|
+
import { AcTrProgressiveOpenFitController } from './AcTrProgressiveOpenFitController';
|
|
87
122
|
import { AcTrScene } from './AcTrScene';
|
|
88
123
|
/**
|
|
89
124
|
* Default view option values
|
|
90
125
|
*/
|
|
91
126
|
export var DEFAULT_VIEW_2D_OPTIONS = {
|
|
92
|
-
background:
|
|
127
|
+
background: ACGI_MODEL_SPACE_BACKGROUND
|
|
93
128
|
};
|
|
94
129
|
/**
|
|
95
130
|
* A 2D CAD viewer component that renders CAD drawings using Three.js.
|
|
@@ -129,11 +164,15 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
129
164
|
var mergedOptions = __assign(__assign({}, DEFAULT_VIEW_2D_OPTIONS), options);
|
|
130
165
|
var container = (_a = mergedOptions.container) !== null && _a !== void 0 ? _a : document.createElement('div');
|
|
131
166
|
mergedOptions.container = container;
|
|
167
|
+
container.style.overflow = 'hidden';
|
|
132
168
|
var renderer = new THREE.WebGLRenderer({
|
|
133
169
|
antialias: true,
|
|
134
170
|
alpha: true
|
|
135
171
|
});
|
|
136
172
|
container.appendChild(renderer.domElement);
|
|
173
|
+
renderer.domElement.style.display = 'block';
|
|
174
|
+
renderer.domElement.style.maxWidth = '100%';
|
|
175
|
+
renderer.domElement.style.maxHeight = '100%';
|
|
137
176
|
_this = _super.call(this, renderer.domElement, container) || this;
|
|
138
177
|
/**
|
|
139
178
|
* ID of the currently scheduled requestAnimationFrame callback.
|
|
@@ -185,6 +224,21 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
185
224
|
* race during document open.
|
|
186
225
|
*/
|
|
187
226
|
_this._externallyFramedLayouts = new Set();
|
|
227
|
+
/**
|
|
228
|
+
* Layer names with an in-flight {@link convertMissingEntitiesOnLayer} pass.
|
|
229
|
+
*
|
|
230
|
+
* {@link updateLayer} triggers that conversion fire-and-forget when a layer
|
|
231
|
+
* becomes visible again. Rapid or repeated layer-on events for the same name
|
|
232
|
+
* would otherwise start parallel {@link batchConvert} runs over the same
|
|
233
|
+
* pending entities. `hasEntity` prevents duplicate scene entries, but not the
|
|
234
|
+
* wasted conversion work — this set skips re-entry until the current pass ends.
|
|
235
|
+
*/
|
|
236
|
+
_this._convertingLayers = new Set();
|
|
237
|
+
/**
|
|
238
|
+
* When true, entity conversion during document open is deferred across
|
|
239
|
+
* event-loop turns so geometry appears incrementally.
|
|
240
|
+
*/
|
|
241
|
+
_this._progressiveRendering = false;
|
|
188
242
|
_this.animate = function () {
|
|
189
243
|
var _a;
|
|
190
244
|
_this._rafId = requestAnimationFrame(_this.animate);
|
|
@@ -193,15 +247,20 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
193
247
|
camera: _this.internalCamera
|
|
194
248
|
});
|
|
195
249
|
var stillLoading = _this._numOfEntitiesToProcess > 0;
|
|
250
|
+
var deferRenderWhileLoading = stillLoading && !_this._progressiveRendering;
|
|
196
251
|
if (!_this._isDirty && !stillLoading)
|
|
197
252
|
return;
|
|
253
|
+
if (deferRenderWhileLoading)
|
|
254
|
+
return;
|
|
198
255
|
var needsRedraw = _this._layoutViewManager.render(_this._scene);
|
|
199
256
|
if (_this.internalCamera) {
|
|
200
257
|
_this._css2dRenderer.render(_this._scene.internalScene, _this.internalCamera);
|
|
201
258
|
}
|
|
202
259
|
(_a = _this._stats) === null || _a === void 0 ? void 0 : _a.update();
|
|
203
|
-
_this._isDirty = stillLoading || needsRedraw;
|
|
260
|
+
_this._isDirty = (_this._progressiveRendering && stillLoading) || needsRedraw;
|
|
204
261
|
};
|
|
262
|
+
_this._gripManager = new AcEdGripManager(_this);
|
|
263
|
+
_this._keyHandler = new AcEdViewKeyHandler(_this);
|
|
205
264
|
if (options.calculateSizeCallback) {
|
|
206
265
|
_this.setCalculateSizeCallback(options.calculateSizeCallback);
|
|
207
266
|
}
|
|
@@ -218,8 +277,11 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
218
277
|
});
|
|
219
278
|
});
|
|
220
279
|
_this._scene = _this.createScene();
|
|
280
|
+
_this._layerAppearance = new AcTrLayerAppearanceController(_this._scene, _this._renderer);
|
|
281
|
+
_this._inheritedLayerMaterialMapper = new AcTrInheritedLayerMaterialMapper(function (layerName) { return _this._layerAppearance.getEffectiveLayerTraits(layerName); }, _this._renderer);
|
|
221
282
|
// Initialize background color through setter to keep renderer/cursor in sync.
|
|
222
|
-
_this.backgroundColor =
|
|
283
|
+
_this.backgroundColor =
|
|
284
|
+
(_b = mergedOptions.background) !== null && _b !== void 0 ? _b : ACGI_MODEL_SPACE_BACKGROUND;
|
|
223
285
|
_this._stats = _this.createStats(AcApSettingManager.instance.isShowStats);
|
|
224
286
|
// Layout background sysvars drive the canvas clear colour and ACI-7
|
|
225
287
|
// inversion (`MODELBKCOLOR` for model space, `PAPERBKCOLOR` for the
|
|
@@ -251,7 +313,8 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
251
313
|
var canHandleSelectionGesture = function () {
|
|
252
314
|
return (_this.mode === AcEdViewMode.SELECTION &&
|
|
253
315
|
!_this.editor.isActive &&
|
|
254
|
-
!AcEdMTextEditor.getActiveInputBox()
|
|
316
|
+
!AcEdMTextEditor.getActiveInputBox() &&
|
|
317
|
+
!_this._gripManager.isDragging);
|
|
255
318
|
};
|
|
256
319
|
var clearSelectionPreview = function () {
|
|
257
320
|
selectionPreviewEl === null || selectionPreviewEl === void 0 ? void 0 : selectionPreviewEl.remove();
|
|
@@ -297,6 +360,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
297
360
|
selectionPreviewEl.style.setProperty('--line-color', style.lineColor);
|
|
298
361
|
});
|
|
299
362
|
_this.canvas.addEventListener('mouseup', function (e) {
|
|
363
|
+
if (_this._gripManager.isDragging) {
|
|
364
|
+
selectionStartWcs = null;
|
|
365
|
+
selectionStartCanvas = null;
|
|
366
|
+
clearSelectionPreview();
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
300
369
|
if (!selectionStartWcs || !selectionStartCanvas)
|
|
301
370
|
return;
|
|
302
371
|
var endCanvas = _this.viewportToCanvas({
|
|
@@ -339,31 +408,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
339
408
|
// such as the canvas or the entire document. This can interfere with other event listeners you
|
|
340
409
|
// add, including the keydown event.
|
|
341
410
|
document.addEventListener('keydown', function (e) {
|
|
342
|
-
|
|
343
|
-
var target = e.target;
|
|
344
|
-
var isEditableTarget = target instanceof HTMLInputElement ||
|
|
345
|
-
target instanceof HTMLTextAreaElement ||
|
|
346
|
-
(target === null || target === void 0 ? void 0 : target.isContentEditable) === true;
|
|
347
|
-
// keyCode 229 is commonly reported by IME composing key events.
|
|
348
|
-
var isImeComposing = e.isComposing || e.keyCode === 229;
|
|
349
|
-
if (isEditableTarget || isImeComposing) {
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
switch (e.code) {
|
|
353
|
-
case 'Escape':
|
|
354
|
-
_this.selectionSet.clear();
|
|
355
|
-
break;
|
|
356
|
-
case 'Delete':
|
|
357
|
-
case 'Backspace':
|
|
358
|
-
// Only dispatch erase when no command is currently active.
|
|
359
|
-
// Dispatching erase mid-command (e.g. while LINE awaits the next
|
|
360
|
-
// point) corrupts the active command's input pipeline because
|
|
361
|
-
// sendStringToExecute clears scripted inputs unconditionally.
|
|
362
|
-
if (!_this.editor.isActive) {
|
|
363
|
-
AcApDocManager.instance.sendStringToExecute('erase');
|
|
364
|
-
}
|
|
365
|
-
break;
|
|
366
|
-
}
|
|
411
|
+
_this._keyHandler.handleKeyDown(e);
|
|
367
412
|
});
|
|
368
413
|
acdbHostApplicationServices().layoutManager.events.layoutSwitched.addEventListener(function (args) {
|
|
369
414
|
var btrId = args.layout.blockTableRecordId;
|
|
@@ -419,9 +464,18 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
419
464
|
_this._css2dRenderer.domElement.style.left = '0px';
|
|
420
465
|
_this._css2dRenderer.domElement.style.pointerEvents = 'none';
|
|
421
466
|
_this._css2dRenderer.domElement.style.zIndex = '99998';
|
|
467
|
+
_this._css2dRenderer.domElement.style.maxWidth = '100%';
|
|
468
|
+
_this._css2dRenderer.domElement.style.maxHeight = '100%';
|
|
422
469
|
container.appendChild(_this._css2dRenderer.domElement);
|
|
423
470
|
_this._missedImages = new Map();
|
|
424
471
|
_this._layoutViewManager = new AcTrLayoutViewManager();
|
|
472
|
+
_this._progressiveOpenFit = new AcTrProgressiveOpenFitController(function (box, margin) {
|
|
473
|
+
_this.activeLayoutView.zoomTo(box, margin !== null && margin !== void 0 ? margin : 1.1);
|
|
474
|
+
_this._isDirty = true;
|
|
475
|
+
});
|
|
476
|
+
_this._entityDisplay = new AcTrEntityDisplayController(function (layerName) {
|
|
477
|
+
return _this.resolveLayerInfo(layerName);
|
|
478
|
+
});
|
|
425
479
|
_this.initialize();
|
|
426
480
|
_this.onWindowResize();
|
|
427
481
|
_this._isDirty = true;
|
|
@@ -479,6 +533,14 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
479
533
|
enumerable: false,
|
|
480
534
|
configurable: true
|
|
481
535
|
});
|
|
536
|
+
Object.defineProperty(AcTrView2d.prototype, "gripManager", {
|
|
537
|
+
/** Grip point manager for the view (Write mode only). */
|
|
538
|
+
get: function () {
|
|
539
|
+
return this._gripManager;
|
|
540
|
+
},
|
|
541
|
+
enumerable: false,
|
|
542
|
+
configurable: true
|
|
543
|
+
});
|
|
482
544
|
Object.defineProperty(AcTrView2d.prototype, "isDirty", {
|
|
483
545
|
/**
|
|
484
546
|
* Gets whether the view needs to be re-rendered.
|
|
@@ -499,6 +561,46 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
499
561
|
enumerable: false,
|
|
500
562
|
configurable: true
|
|
501
563
|
});
|
|
564
|
+
Object.defineProperty(AcTrView2d.prototype, "isProcessingEntities", {
|
|
565
|
+
/**
|
|
566
|
+
* True while {@link addEntity} batch-conversion callbacks are still running.
|
|
567
|
+
*
|
|
568
|
+
* Parsing can report 100% before this reaches zero; callers opening files
|
|
569
|
+
* should wait on this (as {@link zoomToFitDrawing} does) before hiding
|
|
570
|
+
* progress UI or assuming the canvas is ready.
|
|
571
|
+
*/
|
|
572
|
+
get: function () {
|
|
573
|
+
return this._numOfEntitiesToProcess > 0;
|
|
574
|
+
},
|
|
575
|
+
enumerable: false,
|
|
576
|
+
configurable: true
|
|
577
|
+
});
|
|
578
|
+
Object.defineProperty(AcTrView2d.prototype, "progressiveRendering", {
|
|
579
|
+
/**
|
|
580
|
+
* Whether entity conversion during document open is deferred for progressive display.
|
|
581
|
+
*/
|
|
582
|
+
get: function () {
|
|
583
|
+
return this._progressiveRendering;
|
|
584
|
+
},
|
|
585
|
+
set: function (value) {
|
|
586
|
+
this._progressiveRendering = value;
|
|
587
|
+
},
|
|
588
|
+
enumerable: false,
|
|
589
|
+
configurable: true
|
|
590
|
+
});
|
|
591
|
+
/**
|
|
592
|
+
* Enables progressive camera framing while entities are batch-converted at
|
|
593
|
+
* document open. Pair with {@link zoomToFitDrawing} for the final accurate fit.
|
|
594
|
+
*/
|
|
595
|
+
AcTrView2d.prototype.beginProgressiveOpenFit = function () {
|
|
596
|
+
this._progressiveOpenFit.begin(this._numOfEntitiesToProcess);
|
|
597
|
+
};
|
|
598
|
+
/**
|
|
599
|
+
* Disables progressive open framing after the final zoom-to-fit runs.
|
|
600
|
+
*/
|
|
601
|
+
AcTrView2d.prototype.endProgressiveOpenFit = function () {
|
|
602
|
+
this._progressiveOpenFit.end();
|
|
603
|
+
};
|
|
502
604
|
Object.defineProperty(AcTrView2d.prototype, "missedData", {
|
|
503
605
|
/**
|
|
504
606
|
* Gets information about missing data during rendering (fonts and images).
|
|
@@ -552,8 +654,9 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
552
654
|
*/
|
|
553
655
|
AcTrView2d.prototype.applyCanvasBackground = function (value) {
|
|
554
656
|
this._renderer.setClearColor(value);
|
|
657
|
+
// Updates style-manager background, repaints ACI-7 / bg-follow materials.
|
|
555
658
|
this._renderer.currentBackgroundColor = value;
|
|
556
|
-
this.
|
|
659
|
+
this._layerAppearance.refreshTextMaterialsInObjectTree(this._scene.internalScene);
|
|
557
660
|
this.editor.syncCursorBackground(value);
|
|
558
661
|
this._isDirty = true;
|
|
559
662
|
};
|
|
@@ -563,11 +666,21 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
563
666
|
}
|
|
564
667
|
return isModelSpaceDatabase(database);
|
|
565
668
|
};
|
|
669
|
+
/**
|
|
670
|
+
* Binds the active drawing database on the renderer draw context.
|
|
671
|
+
*
|
|
672
|
+
* Called before document read so layer-table traits are available while layers
|
|
673
|
+
* are appended during open, and again after open to refresh display sysvars.
|
|
674
|
+
*/
|
|
675
|
+
AcTrView2d.prototype.bindDrawDatabase = function (database) {
|
|
676
|
+
this._renderer.context.database = database;
|
|
677
|
+
};
|
|
566
678
|
/**
|
|
567
679
|
* Re-reads layout background sysvars from the active database. Called after
|
|
568
680
|
* a document is opened so DWG-stored values take effect.
|
|
569
681
|
*/
|
|
570
682
|
AcTrView2d.prototype.syncDisplaySysVars = function (database) {
|
|
683
|
+
this.bindDrawDatabase(database);
|
|
571
684
|
this.applyCanvasBackground(readLayoutBackgroundColor(database, this.isModelSpaceLayout(database)));
|
|
572
685
|
};
|
|
573
686
|
/**
|
|
@@ -641,6 +754,55 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
641
754
|
enumerable: false,
|
|
642
755
|
configurable: true
|
|
643
756
|
});
|
|
757
|
+
/**
|
|
758
|
+
* Converts every drawable entity into the scene before offline export.
|
|
759
|
+
*
|
|
760
|
+
* Interactive viewing skips off/frozen layers for performance; HTML snapshots
|
|
761
|
+
* store layer visibility separately and need full geometry so the exported
|
|
762
|
+
* layer panel can toggle layers on later.
|
|
763
|
+
*
|
|
764
|
+
* Converted geometry remains in the live scene after this call completes.
|
|
765
|
+
*/
|
|
766
|
+
AcTrView2d.prototype.ensureEntitiesConvertedForExport = function (options) {
|
|
767
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
768
|
+
var includeInvisibleLayers, db, pending, _a, _b, _c, layoutBtrId, blockTableRecord;
|
|
769
|
+
var e_1, _d;
|
|
770
|
+
var _this = this;
|
|
771
|
+
return __generator(this, function (_e) {
|
|
772
|
+
switch (_e.label) {
|
|
773
|
+
case 0:
|
|
774
|
+
includeInvisibleLayers = (options === null || options === void 0 ? void 0 : options.includeInvisibleLayers) !== false;
|
|
775
|
+
db = AcApDocManager.instance.curDocument.database;
|
|
776
|
+
pending = [];
|
|
777
|
+
try {
|
|
778
|
+
for (_a = __values(this._scene.layouts), _b = _a.next(); !_b.done; _b = _a.next()) {
|
|
779
|
+
_c = __read(_b.value, 1), layoutBtrId = _c[0];
|
|
780
|
+
blockTableRecord = db.tables.blockTable.getIdAt(layoutBtrId);
|
|
781
|
+
if (!blockTableRecord) {
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
pending.push.apply(pending, __spreadArray([], __read(this._entityDisplay.collectMissingEntitiesForExport(blockTableRecord, function (objectId) { return _this.hasEntity(objectId); }, includeInvisibleLayers)), false));
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
788
|
+
finally {
|
|
789
|
+
try {
|
|
790
|
+
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
|
|
791
|
+
}
|
|
792
|
+
finally { if (e_1) throw e_1.error; }
|
|
793
|
+
}
|
|
794
|
+
if (pending.length === 0) {
|
|
795
|
+
return [2 /*return*/];
|
|
796
|
+
}
|
|
797
|
+
this._numOfEntitiesToProcess += pending.length;
|
|
798
|
+
return [4 /*yield*/, this.batchConvert(pending, { forExport: true })];
|
|
799
|
+
case 1:
|
|
800
|
+
_e.sent();
|
|
801
|
+
return [2 /*return*/];
|
|
802
|
+
}
|
|
803
|
+
});
|
|
804
|
+
});
|
|
805
|
+
};
|
|
644
806
|
Object.defineProperty(AcTrView2d.prototype, "internalScene", {
|
|
645
807
|
/**
|
|
646
808
|
* The internal THREE scene used by this view.
|
|
@@ -736,15 +898,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
736
898
|
var _this = this;
|
|
737
899
|
if (timeout === void 0) { timeout = 0; }
|
|
738
900
|
var waiter = new AcEdConditionWaiter(function () { return _this._numOfEntitiesToProcess <= 0; }, function () {
|
|
739
|
-
if (layoutBtrId &&
|
|
740
|
-
_this.
|
|
901
|
+
if (layoutBtrId && _this._externallyFramedLayouts.delete(layoutBtrId)) {
|
|
902
|
+
_this.endProgressiveOpenFit();
|
|
741
903
|
return;
|
|
742
904
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
_this.zoomTo(box);
|
|
746
|
-
_this._isDirty = true;
|
|
747
|
-
}
|
|
905
|
+
_this._progressiveOpenFit.applyFinalFit(function () { return _this.resolveLayoutFitBox(); });
|
|
906
|
+
_this.endProgressiveOpenFit();
|
|
748
907
|
}, 300, // check every 300 ms
|
|
749
908
|
timeout);
|
|
750
909
|
waiter.start();
|
|
@@ -800,13 +959,18 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
800
959
|
};
|
|
801
960
|
AcTrView2d.prototype.editMTextEntity = function (mtext) {
|
|
802
961
|
return __awaiter(this, void 0, void 0, function () {
|
|
803
|
-
var editor, applied,
|
|
962
|
+
var db, editor, applied, result_1;
|
|
804
963
|
return __generator(this, function (_a) {
|
|
805
964
|
switch (_a.label) {
|
|
806
965
|
case 0:
|
|
966
|
+
db = mtext.database;
|
|
807
967
|
if (mtext.lineSpacingFactor !== AcEdMTextEditor.defaultLineSpacingFactor) {
|
|
808
|
-
|
|
809
|
-
|
|
968
|
+
acapRunDatabaseEdit(db, 'Edit MText', function () {
|
|
969
|
+
var opened = db.openEntityForWrite(mtext);
|
|
970
|
+
if (!(opened instanceof AcDbMText))
|
|
971
|
+
return;
|
|
972
|
+
opened.lineSpacingFactor = AcEdMTextEditor.defaultLineSpacingFactor;
|
|
973
|
+
});
|
|
810
974
|
}
|
|
811
975
|
// Hide the in-scene MTEXT while the inline editor renders its own copy; otherwise
|
|
812
976
|
// both draw at once (double text) when the user double-clicks to edit.
|
|
@@ -827,16 +991,20 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
827
991
|
toolbarFontFamilies: this.getMTextToolbarFontFamilies()
|
|
828
992
|
})];
|
|
829
993
|
case 2:
|
|
830
|
-
|
|
831
|
-
if (!
|
|
994
|
+
result_1 = _a.sent();
|
|
995
|
+
if (!result_1)
|
|
832
996
|
return [2 /*return*/];
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
997
|
+
acapRunDatabaseEdit(db, 'Edit MText', function () {
|
|
998
|
+
var opened = db.openEntityForWrite(mtext);
|
|
999
|
+
if (!(opened instanceof AcDbMText))
|
|
1000
|
+
return;
|
|
1001
|
+
opened.location = result_1.location;
|
|
1002
|
+
opened.contents = result_1.contents;
|
|
1003
|
+
opened.width = result_1.width;
|
|
1004
|
+
opened.height = result_1.height;
|
|
1005
|
+
opened.lineSpacingFactor = result_1.lineSpacingFactor;
|
|
1006
|
+
opened.attachmentPoint = result_1.attachmentPoint;
|
|
1007
|
+
});
|
|
840
1008
|
applied = true;
|
|
841
1009
|
return [3 /*break*/, 4];
|
|
842
1010
|
case 3:
|
|
@@ -897,7 +1065,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
897
1065
|
* don't have to land pixel-perfect on the viewport line to grab it.
|
|
898
1066
|
*/
|
|
899
1067
|
AcTrView2d.prototype.pick = function (point, hitRadius, pickOneOnly) {
|
|
900
|
-
var
|
|
1068
|
+
var e_2, _a;
|
|
901
1069
|
if (point == null)
|
|
902
1070
|
point = this.curPos;
|
|
903
1071
|
var results = [];
|
|
@@ -928,12 +1096,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
928
1096
|
}
|
|
929
1097
|
}
|
|
930
1098
|
}
|
|
931
|
-
catch (
|
|
1099
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
932
1100
|
finally {
|
|
933
1101
|
try {
|
|
934
1102
|
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
935
1103
|
}
|
|
936
|
-
finally { if (
|
|
1104
|
+
finally { if (e_2) throw e_2.error; }
|
|
937
1105
|
}
|
|
938
1106
|
}
|
|
939
1107
|
// 1) Resolve hits in the active layout. Skip the `AcDbViewport`
|
|
@@ -945,6 +1113,8 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
945
1113
|
firstQueryResults.forEach(function (item) {
|
|
946
1114
|
if (drillThroughViewportIds.has(item.id))
|
|
947
1115
|
return;
|
|
1116
|
+
if (!isEffectiveSpatialQueryHit(item))
|
|
1117
|
+
return;
|
|
948
1118
|
if (activeLayout.isIntersectWith(item.id, raycaster)) {
|
|
949
1119
|
results.push(item);
|
|
950
1120
|
}
|
|
@@ -974,7 +1144,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
974
1144
|
* paper-space pick.
|
|
975
1145
|
*/
|
|
976
1146
|
AcTrView2d.prototype.pickThroughViewports = function (paperPoint, paperBox, viewports, results) {
|
|
977
|
-
var
|
|
1147
|
+
var e_3, _a;
|
|
978
1148
|
var modelLayout = this._scene.modelSpaceLayout;
|
|
979
1149
|
if (!modelLayout)
|
|
980
1150
|
return;
|
|
@@ -996,6 +1166,8 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
996
1166
|
var vpRaycaster = vpView.resetRaycaster(modelPt, modelRadius);
|
|
997
1167
|
var modelHits = modelLayout.search(modelBox);
|
|
998
1168
|
modelHits.forEach(function (item) {
|
|
1169
|
+
if (!isEffectiveSpatialQueryHit(item))
|
|
1170
|
+
return;
|
|
999
1171
|
if (modelLayout.isIntersectWith(item.id, vpRaycaster)) {
|
|
1000
1172
|
results.push(item);
|
|
1001
1173
|
}
|
|
@@ -1007,19 +1179,19 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1007
1179
|
_loop_1(vpView);
|
|
1008
1180
|
}
|
|
1009
1181
|
}
|
|
1010
|
-
catch (
|
|
1182
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1011
1183
|
finally {
|
|
1012
1184
|
try {
|
|
1013
1185
|
if (viewports_1_1 && !viewports_1_1.done && (_a = viewports_1.return)) _a.call(viewports_1);
|
|
1014
1186
|
}
|
|
1015
|
-
finally { if (
|
|
1187
|
+
finally { if (e_3) throw e_3.error; }
|
|
1016
1188
|
}
|
|
1017
1189
|
};
|
|
1018
1190
|
/**
|
|
1019
1191
|
* @inheritdoc
|
|
1020
1192
|
*/
|
|
1021
|
-
AcTrView2d.prototype.search = function (box) {
|
|
1022
|
-
return this._scene.search(box);
|
|
1193
|
+
AcTrView2d.prototype.search = function (box, options) {
|
|
1194
|
+
return this._scene.search(box, options);
|
|
1023
1195
|
};
|
|
1024
1196
|
/**
|
|
1025
1197
|
* @inheritdoc
|
|
@@ -1041,61 +1213,22 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1041
1213
|
* @inheritdoc
|
|
1042
1214
|
*/
|
|
1043
1215
|
AcTrView2d.prototype.addLayer = function (layer) {
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
isFrozen: layer.isFrozen,
|
|
1047
|
-
isOff: layer.isOff,
|
|
1048
|
-
color: layer.color
|
|
1049
|
-
});
|
|
1050
|
-
var traits = {
|
|
1051
|
-
layer: layer.name,
|
|
1052
|
-
color: layer.color.clone(),
|
|
1053
|
-
rgbColor: layer.color.RGB,
|
|
1054
|
-
lineType: layer.lineStyle,
|
|
1055
|
-
lineWeight: layer.lineWeight,
|
|
1056
|
-
transparency: layer.transparency
|
|
1057
|
-
};
|
|
1058
|
-
var materials = this._renderer.updateLayerMaterial(layer.name, traits);
|
|
1059
|
-
updatedLayers.forEach(function (updatedLayer) {
|
|
1060
|
-
for (var id in materials) {
|
|
1061
|
-
var material = materials[id];
|
|
1062
|
-
updatedLayer.updateMaterial(Number(id), material);
|
|
1063
|
-
}
|
|
1064
|
-
});
|
|
1216
|
+
this._scene.addLayer(this.toLayerInfo(layer));
|
|
1217
|
+
this._layerAppearance.syncFromLiveRecord(layer);
|
|
1065
1218
|
this._isDirty = true;
|
|
1066
1219
|
};
|
|
1067
1220
|
/**
|
|
1068
1221
|
* @inheritdoc
|
|
1069
1222
|
*/
|
|
1070
1223
|
AcTrView2d.prototype.updateLayer = function (layer, changes) {
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
isOff: layer.isOff,
|
|
1075
|
-
color: layer.color
|
|
1076
|
-
});
|
|
1077
|
-
var traits = {};
|
|
1078
|
-
if (changes.color) {
|
|
1079
|
-
traits.color = changes.color.clone();
|
|
1080
|
-
traits.rgbColor = changes.color.RGB;
|
|
1081
|
-
}
|
|
1082
|
-
if (changes.lineStyle) {
|
|
1083
|
-
traits.lineType = layer.lineStyle;
|
|
1224
|
+
this._scene.updateLayer(this.toLayerInfo(layer));
|
|
1225
|
+
if (this._layerAppearance.layerStyleMayHaveChanged(changes)) {
|
|
1226
|
+
this._layerAppearance.syncFromLiveRecord(layer);
|
|
1084
1227
|
}
|
|
1085
|
-
if (changes
|
|
1086
|
-
|
|
1228
|
+
if (this._entityDisplay.layerVisibilityMayHaveChanged(changes) &&
|
|
1229
|
+
AcTrLayer.isLayerVisible(this.toLayerInfo(layer))) {
|
|
1230
|
+
void this.convertMissingEntitiesOnLayer(layer.name);
|
|
1087
1231
|
}
|
|
1088
|
-
if (changes.transparency !== undefined) {
|
|
1089
|
-
traits.transparency = changes.transparency;
|
|
1090
|
-
}
|
|
1091
|
-
traits.layer = layer.name; // always present
|
|
1092
|
-
var materials = this._renderer.updateLayerMaterial(layer.name, traits);
|
|
1093
|
-
updatedLayers.forEach(function (layer) {
|
|
1094
|
-
for (var id in materials) {
|
|
1095
|
-
var material = materials[id];
|
|
1096
|
-
layer.updateMaterial(Number(id), material);
|
|
1097
|
-
}
|
|
1098
|
-
});
|
|
1099
1232
|
this._isDirty = true;
|
|
1100
1233
|
};
|
|
1101
1234
|
/**
|
|
@@ -1109,6 +1242,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1109
1242
|
var threeEntity = this.drawEntity(entity_1, true);
|
|
1110
1243
|
if (threeEntity) {
|
|
1111
1244
|
threeEntity.objectId = entity_1.objectId;
|
|
1245
|
+
threeEntity.syncDraw();
|
|
1112
1246
|
this._scene.addTransientEntity(threeEntity);
|
|
1113
1247
|
this._isDirty = true;
|
|
1114
1248
|
}
|
|
@@ -1122,6 +1256,49 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1122
1256
|
this._scene.removeTransientEntity(objectId);
|
|
1123
1257
|
this._isDirty = true;
|
|
1124
1258
|
};
|
|
1259
|
+
/**
|
|
1260
|
+
* @inheritdoc
|
|
1261
|
+
*/
|
|
1262
|
+
AcTrView2d.prototype.canCreateEntityPreview = function (entityIds) {
|
|
1263
|
+
return this._scene.canCreatePreview(entityIds);
|
|
1264
|
+
};
|
|
1265
|
+
/**
|
|
1266
|
+
* @inheritdoc
|
|
1267
|
+
*/
|
|
1268
|
+
AcTrView2d.prototype.createEntityPreview = function (entityIds) {
|
|
1269
|
+
var handleId = this._scene.createPreview(entityIds);
|
|
1270
|
+
if (handleId) {
|
|
1271
|
+
this._isDirty = true;
|
|
1272
|
+
}
|
|
1273
|
+
return handleId;
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* @inheritdoc
|
|
1277
|
+
*/
|
|
1278
|
+
AcTrView2d.prototype.updateEntityPreview = function (handleId, matrix) {
|
|
1279
|
+
if (this._scene.updatePreview(handleId, AcTrMatrixUtil.createMatrix4(matrix))) {
|
|
1280
|
+
this._isDirty = true;
|
|
1281
|
+
}
|
|
1282
|
+
};
|
|
1283
|
+
/**
|
|
1284
|
+
* @inheritdoc
|
|
1285
|
+
*/
|
|
1286
|
+
AcTrView2d.prototype.removeEntityPreview = function (handleId) {
|
|
1287
|
+
if (this._scene.removePreview(handleId)) {
|
|
1288
|
+
this._isDirty = true;
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
/**
|
|
1292
|
+
* @inheritdoc
|
|
1293
|
+
*/
|
|
1294
|
+
AcTrView2d.prototype.updateTransientPreviewTransforms = function (transforms) {
|
|
1295
|
+
if (this._scene.updateTransientPreviewTransforms(transforms.map(function (entry) { return ({
|
|
1296
|
+
objectId: entry.objectId,
|
|
1297
|
+
matrix: AcTrMatrixUtil.createMatrix4(entry.matrix)
|
|
1298
|
+
}); }))) {
|
|
1299
|
+
this._isDirty = true;
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1125
1302
|
/**
|
|
1126
1303
|
* @inheritdoc
|
|
1127
1304
|
*/
|
|
@@ -1129,7 +1306,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1129
1306
|
var _this = this;
|
|
1130
1307
|
var entities = Array.isArray(entity) ? entity : [entity];
|
|
1131
1308
|
this._numOfEntitiesToProcess += entities.length;
|
|
1132
|
-
|
|
1309
|
+
var convert = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1133
1310
|
return __generator(this, function (_a) {
|
|
1134
1311
|
switch (_a.label) {
|
|
1135
1312
|
case 0: return [4 /*yield*/, this.batchConvert(entities)];
|
|
@@ -1138,8 +1315,14 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1138
1315
|
return [2 /*return*/];
|
|
1139
1316
|
}
|
|
1140
1317
|
});
|
|
1141
|
-
}); }
|
|
1142
|
-
this.
|
|
1318
|
+
}); };
|
|
1319
|
+
if (this._progressiveRendering) {
|
|
1320
|
+
setTimeout(convert);
|
|
1321
|
+
this._isDirty = true;
|
|
1322
|
+
}
|
|
1323
|
+
else {
|
|
1324
|
+
void convert();
|
|
1325
|
+
}
|
|
1143
1326
|
};
|
|
1144
1327
|
/**
|
|
1145
1328
|
* @inheritdoc
|
|
@@ -1192,28 +1375,30 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1192
1375
|
this._scene.setEntityVisible(objectId, false);
|
|
1193
1376
|
};
|
|
1194
1377
|
/**
|
|
1195
|
-
*
|
|
1378
|
+
* Rebuilds scene geometry for entities whose shape or styling changed.
|
|
1379
|
+
*
|
|
1380
|
+
* Pure translations should use {@link translateEntity} instead.
|
|
1196
1381
|
*/
|
|
1197
1382
|
AcTrView2d.prototype.updateEntity = function (entity) {
|
|
1198
1383
|
var _this = this;
|
|
1199
|
-
var entities = [];
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
else {
|
|
1204
|
-
entities.push(entity);
|
|
1205
|
-
}
|
|
1384
|
+
var entities = Array.isArray(entity) ? entity : [entity];
|
|
1385
|
+
var selectedIds = entities
|
|
1386
|
+
.map(function (item) { return item.objectId; })
|
|
1387
|
+
.filter(function (objectId) { return _this.selectionSet.has(objectId); });
|
|
1206
1388
|
for (var i = 0; i < entities.length; ++i) {
|
|
1207
1389
|
var entity_2 = entities[i];
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
threeEntity.objectId = entity_2.objectId;
|
|
1211
|
-
threeEntity.ownerId = entity_2.ownerId;
|
|
1212
|
-
threeEntity.layerName = entity_2.layer;
|
|
1213
|
-
threeEntity.visible = entity_2.visibility;
|
|
1214
|
-
this._scene.updateEntity(threeEntity);
|
|
1390
|
+
if (this._scene.hasEntity(entity_2.objectId)) {
|
|
1391
|
+
this._scene.removeEntity(entity_2.objectId);
|
|
1215
1392
|
}
|
|
1216
1393
|
}
|
|
1394
|
+
// Reconvert through the same path as initial load so block references are
|
|
1395
|
+
// split by layer correctly and deferred MTEXT/SHAPE geometry is drawn.
|
|
1396
|
+
void this.batchConvert(entities).then(function () {
|
|
1397
|
+
if (selectedIds.length > 0) {
|
|
1398
|
+
_this.highlight(selectedIds);
|
|
1399
|
+
}
|
|
1400
|
+
_this._gripManager.refresh();
|
|
1401
|
+
});
|
|
1217
1402
|
this._isDirty = true;
|
|
1218
1403
|
// Not sure why texture for image entity isn't updated even if 'isDirty' flag is already set to true.
|
|
1219
1404
|
// So add one timeout event to set 'isDirty' flag to true again to make it work
|
|
@@ -1408,6 +1593,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1408
1593
|
if (layoutView == null) {
|
|
1409
1594
|
layoutView = new AcTrLayoutView(this._renderer, layoutBtrId, this.width, this.height);
|
|
1410
1595
|
layoutView.events.viewChanged.addEventListener(function () {
|
|
1596
|
+
_this._progressiveOpenFit.onLayoutViewChanged();
|
|
1411
1597
|
_this._isDirty = true;
|
|
1412
1598
|
_this.events.viewChanged.dispatch();
|
|
1413
1599
|
_this.clearHover();
|
|
@@ -1438,7 +1624,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1438
1624
|
* @param layoutBtrId Input the block table record id of the layout
|
|
1439
1625
|
*/
|
|
1440
1626
|
AcTrView2d.prototype.loadLayoutEntitiesIfNeeded = function (layoutBtrId) {
|
|
1441
|
-
var
|
|
1627
|
+
var e_4, _a;
|
|
1442
1628
|
var _this = this;
|
|
1443
1629
|
try {
|
|
1444
1630
|
var db = AcApDocManager.instance.curDocument.database;
|
|
@@ -1509,12 +1695,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1509
1695
|
entities_1.push(entity);
|
|
1510
1696
|
}
|
|
1511
1697
|
}
|
|
1512
|
-
catch (
|
|
1698
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1513
1699
|
finally {
|
|
1514
1700
|
try {
|
|
1515
1701
|
if (iterator_1_1 && !iterator_1_1.done && (_a = iterator_1.return)) _a.call(iterator_1);
|
|
1516
1702
|
}
|
|
1517
|
-
finally { if (
|
|
1703
|
+
finally { if (e_4) throw e_4.error; }
|
|
1518
1704
|
}
|
|
1519
1705
|
if (entities_1.length === 0) {
|
|
1520
1706
|
// Empty layout (e.g. a freshly-created paper space tab). Mark as
|
|
@@ -1525,10 +1711,10 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1525
1711
|
}
|
|
1526
1712
|
return;
|
|
1527
1713
|
}
|
|
1528
|
-
// Load entities asynchronously
|
|
1714
|
+
// Load entities asynchronously when progressive rendering is enabled.
|
|
1529
1715
|
this._loadingLayouts.add(layoutBtrId);
|
|
1530
1716
|
this._numOfEntitiesToProcess += entities_1.length;
|
|
1531
|
-
|
|
1717
|
+
var convert = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1532
1718
|
var layout;
|
|
1533
1719
|
return __generator(this, function (_a) {
|
|
1534
1720
|
switch (_a.label) {
|
|
@@ -1548,7 +1734,13 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1548
1734
|
case 3: return [2 /*return*/];
|
|
1549
1735
|
}
|
|
1550
1736
|
});
|
|
1551
|
-
}); }
|
|
1737
|
+
}); };
|
|
1738
|
+
if (this._progressiveRendering) {
|
|
1739
|
+
setTimeout(convert);
|
|
1740
|
+
}
|
|
1741
|
+
else {
|
|
1742
|
+
void convert();
|
|
1743
|
+
}
|
|
1552
1744
|
}
|
|
1553
1745
|
catch (error) {
|
|
1554
1746
|
log.error('[AcTrView2d] Error loading layout entities:', error);
|
|
@@ -1567,9 +1759,91 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1567
1759
|
stats.dom.style.display = 'none'; // Hide the stats
|
|
1568
1760
|
}
|
|
1569
1761
|
};
|
|
1762
|
+
AcTrView2d.prototype.toLayerInfo = function (layer) {
|
|
1763
|
+
return {
|
|
1764
|
+
name: layer.name,
|
|
1765
|
+
isFrozen: layer.isFrozen,
|
|
1766
|
+
isOff: layer.isOff,
|
|
1767
|
+
color: layer.color
|
|
1768
|
+
};
|
|
1769
|
+
};
|
|
1770
|
+
AcTrView2d.prototype.resolveLayerInfo = function (layerName) {
|
|
1771
|
+
var layer = AcApDocManager.instance.curDocument.database.tables.layerTable.getAt(layerName);
|
|
1772
|
+
return layer ? this.toLayerInfo(layer) : undefined;
|
|
1773
|
+
};
|
|
1774
|
+
/**
|
|
1775
|
+
* Converts entities on the given layer that were skipped while the layer was
|
|
1776
|
+
* off/frozen and therefore are not yet present in the scene.
|
|
1777
|
+
*/
|
|
1778
|
+
AcTrView2d.prototype.convertMissingEntitiesOnLayer = function (layerName) {
|
|
1779
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1780
|
+
var db, blockTableRecord, pending_1;
|
|
1781
|
+
var _this = this;
|
|
1782
|
+
return __generator(this, function (_a) {
|
|
1783
|
+
switch (_a.label) {
|
|
1784
|
+
case 0:
|
|
1785
|
+
if (this._convertingLayers.has(layerName)) {
|
|
1786
|
+
return [2 /*return*/];
|
|
1787
|
+
}
|
|
1788
|
+
this._convertingLayers.add(layerName);
|
|
1789
|
+
_a.label = 1;
|
|
1790
|
+
case 1:
|
|
1791
|
+
_a.trys.push([1, , 3, 4]);
|
|
1792
|
+
db = AcApDocManager.instance.curDocument.database;
|
|
1793
|
+
blockTableRecord = db.tables.blockTable.getIdAt(this.activeLayoutBtrId);
|
|
1794
|
+
if (!blockTableRecord) {
|
|
1795
|
+
return [2 /*return*/];
|
|
1796
|
+
}
|
|
1797
|
+
pending_1 = this._entityDisplay.collectMissingEntitiesOnLayer(layerName, blockTableRecord, function (objectId) { return _this.hasEntity(objectId); });
|
|
1798
|
+
if (pending_1.length === 0) {
|
|
1799
|
+
return [2 /*return*/];
|
|
1800
|
+
}
|
|
1801
|
+
this._numOfEntitiesToProcess += pending_1.length;
|
|
1802
|
+
return [4 /*yield*/, this.batchConvert(pending_1)];
|
|
1803
|
+
case 2:
|
|
1804
|
+
_a.sent();
|
|
1805
|
+
return [3 /*break*/, 4];
|
|
1806
|
+
case 3:
|
|
1807
|
+
this._convertingLayers.delete(layerName);
|
|
1808
|
+
return [7 /*endfinally*/];
|
|
1809
|
+
case 4: return [2 /*return*/];
|
|
1810
|
+
}
|
|
1811
|
+
});
|
|
1812
|
+
});
|
|
1813
|
+
};
|
|
1570
1814
|
AcTrView2d.prototype.drawEntity = function (entity, delay) {
|
|
1571
1815
|
return entity.worldDraw(this._renderer, delay);
|
|
1572
1816
|
};
|
|
1817
|
+
/**
|
|
1818
|
+
* Finishes geometry for a converted entity. Block groups always use
|
|
1819
|
+
* {@link AcTrGroup.syncDraw} to finalize deferred children. Progressive mode
|
|
1820
|
+
* defers MTEXT/SHAPE to async workers; non-progressive mode uses
|
|
1821
|
+
* {@link AcTrEntity.syncDraw}.
|
|
1822
|
+
*/
|
|
1823
|
+
AcTrView2d.prototype.finishEntityGeometry = function (threeEntity, progressive) {
|
|
1824
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1825
|
+
return __generator(this, function (_a) {
|
|
1826
|
+
switch (_a.label) {
|
|
1827
|
+
case 0:
|
|
1828
|
+
if (threeEntity instanceof AcTrGroup) {
|
|
1829
|
+
threeEntity.syncDraw();
|
|
1830
|
+
return [2 /*return*/];
|
|
1831
|
+
}
|
|
1832
|
+
if (!progressive) return [3 /*break*/, 2];
|
|
1833
|
+
return [4 /*yield*/, threeEntity.asyncDraw()];
|
|
1834
|
+
case 1:
|
|
1835
|
+
_a.sent();
|
|
1836
|
+
return [2 /*return*/];
|
|
1837
|
+
case 2:
|
|
1838
|
+
if (threeEntity.hasDrawableGeometry()) {
|
|
1839
|
+
return [2 /*return*/];
|
|
1840
|
+
}
|
|
1841
|
+
threeEntity.syncDraw();
|
|
1842
|
+
return [2 /*return*/];
|
|
1843
|
+
}
|
|
1844
|
+
});
|
|
1845
|
+
});
|
|
1846
|
+
};
|
|
1573
1847
|
/**
|
|
1574
1848
|
* Walks the given block table record once and creates one
|
|
1575
1849
|
* `AcTrViewportView` for every real `AcDbViewport` entity it finds
|
|
@@ -1589,7 +1863,7 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1589
1863
|
* paper layouts.
|
|
1590
1864
|
*/
|
|
1591
1865
|
AcTrView2d.prototype.ensureViewportViews = function (blockTableRecord, layoutView) {
|
|
1592
|
-
var
|
|
1866
|
+
var e_5, _a;
|
|
1593
1867
|
var iterator = blockTableRecord.newIterator();
|
|
1594
1868
|
try {
|
|
1595
1869
|
for (var iterator_2 = __values(iterator), iterator_2_1 = iterator_2.next(); !iterator_2_1.done; iterator_2_1 = iterator_2.next()) {
|
|
@@ -1602,12 +1876,12 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1602
1876
|
layoutView.addViewport(viewportView);
|
|
1603
1877
|
}
|
|
1604
1878
|
}
|
|
1605
|
-
catch (
|
|
1879
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1606
1880
|
finally {
|
|
1607
1881
|
try {
|
|
1608
1882
|
if (iterator_2_1 && !iterator_2_1.done && (_a = iterator_2.return)) _a.call(iterator_2);
|
|
1609
1883
|
}
|
|
1610
|
-
finally { if (
|
|
1884
|
+
finally { if (e_5) throw e_5.error; }
|
|
1611
1885
|
}
|
|
1612
1886
|
};
|
|
1613
1887
|
/**
|
|
@@ -1615,20 +1889,23 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1615
1889
|
* @param entities - The database entities
|
|
1616
1890
|
* @returns The converted three entities
|
|
1617
1891
|
*/
|
|
1618
|
-
AcTrView2d.prototype.batchConvert = function (
|
|
1619
|
-
return __awaiter(this,
|
|
1620
|
-
var i, entity, threeEntity, isExtendBbox, layoutView, viewportView, fileName, error_1;
|
|
1892
|
+
AcTrView2d.prototype.batchConvert = function (entities_2) {
|
|
1893
|
+
return __awaiter(this, arguments, void 0, function (entities, options) {
|
|
1894
|
+
var progressive, i, entity, shouldConvert, threeEntity, isExtendBbox, layoutView, viewportView, fileName, error_1;
|
|
1895
|
+
var _this = this;
|
|
1896
|
+
if (options === void 0) { options = {}; }
|
|
1621
1897
|
return __generator(this, function (_a) {
|
|
1622
1898
|
switch (_a.label) {
|
|
1623
1899
|
case 0:
|
|
1900
|
+
progressive = this._progressiveRendering && !options.forExport;
|
|
1624
1901
|
i = 0;
|
|
1625
1902
|
_a.label = 1;
|
|
1626
1903
|
case 1:
|
|
1627
|
-
if (!(i < entities.length)) return [3 /*break*/,
|
|
1904
|
+
if (!(i < entities.length)) return [3 /*break*/, 11];
|
|
1628
1905
|
entity = entities[i];
|
|
1629
1906
|
_a.label = 2;
|
|
1630
1907
|
case 2:
|
|
1631
|
-
_a.trys.push([2,
|
|
1908
|
+
_a.trys.push([2, 8, 9, 10]);
|
|
1632
1909
|
// Skip the default paper-space viewport (`*Paper_Space`) entirely:
|
|
1633
1910
|
// it is an AutoCAD-internal viewport that exists in every paper
|
|
1634
1911
|
// layout and must not be drawn (would render a giant rectangle in
|
|
@@ -1642,40 +1919,55 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1642
1919
|
// parsers).
|
|
1643
1920
|
if (entity instanceof AcDbViewport &&
|
|
1644
1921
|
AcTrViewportView.isDefaultPaperSpaceViewport(entity)) {
|
|
1645
|
-
return [3 /*break*/,
|
|
1922
|
+
return [3 /*break*/, 10];
|
|
1646
1923
|
}
|
|
1647
|
-
|
|
1648
|
-
|
|
1924
|
+
shouldConvert = options.forExport
|
|
1925
|
+
? this._entityDisplay.shouldConvertForExport(entity)
|
|
1926
|
+
: this._entityDisplay.shouldConvert(entity);
|
|
1927
|
+
if (!shouldConvert) {
|
|
1928
|
+
return [3 /*break*/, 10];
|
|
1649
1929
|
}
|
|
1650
|
-
threeEntity = this.drawEntity(entity,
|
|
1651
|
-
|
|
1652
|
-
|
|
1930
|
+
threeEntity = this.drawEntity(entity, progressive);
|
|
1931
|
+
// Viewports may produce no border geometry (e.g. on a no-plot layer) while
|
|
1932
|
+
// still needing an AcTrViewportView for model content below.
|
|
1933
|
+
if (!threeEntity && !(entity instanceof AcDbViewport))
|
|
1934
|
+
return [3 /*break*/, 10];
|
|
1935
|
+
if (!threeEntity) return [3 /*break*/, 7];
|
|
1653
1936
|
threeEntity.objectId = entity.objectId;
|
|
1654
1937
|
threeEntity.ownerId = entity.ownerId;
|
|
1655
1938
|
threeEntity.layerName = entity.layer;
|
|
1656
|
-
threeEntity.visible = entity.visibility;
|
|
1939
|
+
threeEntity.visible = entity.visibility !== false;
|
|
1657
1940
|
if (threeEntity instanceof AcTrGroup &&
|
|
1658
1941
|
threeEntity.isOnTheSameLayer) {
|
|
1659
1942
|
// Even when a block expands to a single layer bucket, children authored on
|
|
1660
1943
|
// layer "0" still inherit the INSERT layer for ByLayer traits (color, etc.).
|
|
1661
|
-
this.
|
|
1944
|
+
this._inheritedLayerMaterialMapper.remap(threeEntity.children, '0', threeEntity.layerName);
|
|
1662
1945
|
}
|
|
1663
1946
|
if (!(threeEntity instanceof AcTrGroup &&
|
|
1664
|
-
!threeEntity.isOnTheSameLayer)) return [3 /*break*/,
|
|
1665
|
-
this.handleGroup(threeEntity);
|
|
1666
|
-
return [3 /*break*/, 5];
|
|
1947
|
+
!threeEntity.isOnTheSameLayer)) return [3 /*break*/, 4];
|
|
1948
|
+
return [4 /*yield*/, this.handleGroup(threeEntity, progressive)];
|
|
1667
1949
|
case 3:
|
|
1668
|
-
|
|
1669
|
-
return [
|
|
1950
|
+
_a.sent();
|
|
1951
|
+
return [3 /*break*/, 7];
|
|
1670
1952
|
case 4:
|
|
1953
|
+
isExtendBbox = !(entity instanceof AcDbRay || entity instanceof AcDbXline);
|
|
1954
|
+
return [4 /*yield*/, this.finishEntityGeometry(threeEntity, progressive)];
|
|
1955
|
+
case 5:
|
|
1671
1956
|
_a.sent();
|
|
1957
|
+
if (threeEntity instanceof AcTrGroup) {
|
|
1958
|
+
this.syncGroupSpatialBoundsForIndexing(threeEntity);
|
|
1959
|
+
}
|
|
1672
1960
|
this._scene.addEntity(threeEntity, isExtendBbox);
|
|
1673
1961
|
this.applySessionHiddenObjectState(entity.objectId);
|
|
1674
1962
|
// Release memory occupied by this entity
|
|
1675
1963
|
threeEntity.dispose();
|
|
1964
|
+
if (!progressive) return [3 /*break*/, 7];
|
|
1676
1965
|
this._isDirty = true;
|
|
1677
|
-
|
|
1678
|
-
case
|
|
1966
|
+
return [4 /*yield*/, this._progressiveOpenFit.afterGeometryBatch(function () { return _this.resolveLayoutFitBox(); }, i)];
|
|
1967
|
+
case 6:
|
|
1968
|
+
_a.sent();
|
|
1969
|
+
_a.label = 7;
|
|
1970
|
+
case 7:
|
|
1679
1971
|
if (entity instanceof AcDbViewport) {
|
|
1680
1972
|
// Default paper-space viewport was already filtered out at the
|
|
1681
1973
|
// top of the loop, so anything that reaches here is a real
|
|
@@ -1695,229 +1987,155 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1695
1987
|
if (fileName)
|
|
1696
1988
|
this._missedImages.set(entity.objectId, fileName);
|
|
1697
1989
|
}
|
|
1698
|
-
return [3 /*break*/,
|
|
1699
|
-
case
|
|
1990
|
+
return [3 /*break*/, 10];
|
|
1991
|
+
case 8:
|
|
1700
1992
|
error_1 = _a.sent();
|
|
1701
1993
|
log.error("[AcTrView2d] Failed to convert entity ".concat(entity.objectId, " (").concat(entity.type, "):"), error_1);
|
|
1702
|
-
return [3 /*break*/,
|
|
1703
|
-
case
|
|
1994
|
+
return [3 /*break*/, 10];
|
|
1995
|
+
case 9:
|
|
1704
1996
|
this.decreaseNumOfEntitiesToProcess();
|
|
1705
1997
|
return [7 /*endfinally*/];
|
|
1706
|
-
case
|
|
1998
|
+
case 10:
|
|
1707
1999
|
++i;
|
|
1708
2000
|
return [3 /*break*/, 1];
|
|
1709
|
-
case
|
|
2001
|
+
case 11: return [2 /*return*/];
|
|
1710
2002
|
}
|
|
1711
2003
|
});
|
|
1712
2004
|
});
|
|
1713
2005
|
};
|
|
1714
|
-
AcTrView2d.prototype.handleGroup = function (group) {
|
|
1715
|
-
var e_5, _a;
|
|
1716
|
-
var _this = this;
|
|
1717
|
-
var children = group.children;
|
|
1718
|
-
var objectsGroupByLayer = new Map();
|
|
1719
|
-
children.forEach(function (child) {
|
|
1720
|
-
var _a;
|
|
1721
|
-
if (!child.visible) {
|
|
1722
|
-
return;
|
|
1723
|
-
}
|
|
1724
|
-
var layerName = child.userData.layerName;
|
|
1725
|
-
if (!objectsGroupByLayer.has(layerName)) {
|
|
1726
|
-
objectsGroupByLayer.set(layerName, []);
|
|
1727
|
-
}
|
|
1728
|
-
(_a = objectsGroupByLayer.get(layerName)) === null || _a === void 0 ? void 0 : _a.push(child);
|
|
1729
|
-
});
|
|
1730
|
-
// Important:
|
|
1731
|
-
// Sometimes one group may contain huge amount of objects (> 100,000). So it is important
|
|
1732
|
-
// to re-parent object with the fast approach. Calling add/remove method in THREE.Object3D
|
|
1733
|
-
// is very slow because it do lots of things
|
|
1734
|
-
// - Remove children from old group
|
|
1735
|
-
// - Insert them into new group
|
|
1736
|
-
// - Reset parent pointer
|
|
1737
|
-
// - Do one updateMatrixWorld() at the end (optional)
|
|
1738
|
-
// So we operate its children directly.
|
|
1739
|
-
group.children = [];
|
|
1740
|
-
try {
|
|
1741
|
-
for (var children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
|
|
1742
|
-
var child = children_1_1.value;
|
|
1743
|
-
child.parent = null;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1747
|
-
finally {
|
|
1748
|
-
try {
|
|
1749
|
-
if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
|
|
1750
|
-
}
|
|
1751
|
-
finally { if (e_5) throw e_5.error; }
|
|
1752
|
-
}
|
|
1753
|
-
var styleManager = group.styleManager;
|
|
1754
|
-
var groupObjectId = group.objectId;
|
|
1755
|
-
var groupLayerName = group.layerName;
|
|
1756
|
-
var worldGroupBox = group.box.clone();
|
|
1757
|
-
worldGroupBox.applyMatrix4(group.matrix);
|
|
1758
|
-
var groupChildBoxes = group.boxes.map(function (box) {
|
|
1759
|
-
var e_6, _a, e_7, _b;
|
|
1760
|
-
var points = [
|
|
1761
|
-
new THREE.Vector3(box.minX, box.minY, 0),
|
|
1762
|
-
new THREE.Vector3(box.maxX, box.minY, 0),
|
|
1763
|
-
new THREE.Vector3(box.maxX, box.maxY, 0),
|
|
1764
|
-
new THREE.Vector3(box.minX, box.maxY, 0)
|
|
1765
|
-
];
|
|
1766
|
-
try {
|
|
1767
|
-
for (var points_1 = __values(points), points_1_1 = points_1.next(); !points_1_1.done; points_1_1 = points_1.next()) {
|
|
1768
|
-
var point = points_1_1.value;
|
|
1769
|
-
point.applyMatrix4(group.matrix);
|
|
1770
|
-
}
|
|
1771
|
-
}
|
|
1772
|
-
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1773
|
-
finally {
|
|
1774
|
-
try {
|
|
1775
|
-
if (points_1_1 && !points_1_1.done && (_a = points_1.return)) _a.call(points_1);
|
|
1776
|
-
}
|
|
1777
|
-
finally { if (e_6) throw e_6.error; }
|
|
1778
|
-
}
|
|
1779
|
-
var minX = Infinity;
|
|
1780
|
-
var minY = Infinity;
|
|
1781
|
-
var maxX = -Infinity;
|
|
1782
|
-
var maxY = -Infinity;
|
|
1783
|
-
try {
|
|
1784
|
-
for (var points_2 = __values(points), points_2_1 = points_2.next(); !points_2_1.done; points_2_1 = points_2.next()) {
|
|
1785
|
-
var point = points_2_1.value;
|
|
1786
|
-
minX = Math.min(minX, point.x);
|
|
1787
|
-
minY = Math.min(minY, point.y);
|
|
1788
|
-
maxX = Math.max(maxX, point.x);
|
|
1789
|
-
maxY = Math.max(maxY, point.y);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1793
|
-
finally {
|
|
1794
|
-
try {
|
|
1795
|
-
if (points_2_1 && !points_2_1.done && (_b = points_2.return)) _b.call(points_2);
|
|
1796
|
-
}
|
|
1797
|
-
finally { if (e_7) throw e_7.error; }
|
|
1798
|
-
}
|
|
1799
|
-
return {
|
|
1800
|
-
minX: minX,
|
|
1801
|
-
minY: minY,
|
|
1802
|
-
maxX: maxX,
|
|
1803
|
-
maxY: maxY,
|
|
1804
|
-
id: box.id
|
|
1805
|
-
};
|
|
1806
|
-
});
|
|
1807
|
-
objectsGroupByLayer.forEach(function (objects, layerName) {
|
|
1808
|
-
// AutoCAD block rule: entities authored on layer "0" inherit the INSERT's layer.
|
|
1809
|
-
// Non-zero layers keep their original layer name.
|
|
1810
|
-
var effectiveLayerName = layerName === '0' ? groupLayerName : layerName;
|
|
1811
|
-
// Keep runtime layer metadata/material cache aligned with the inherited layer so
|
|
1812
|
-
// later layer style edits (color, linetype, lineweight, transparency) target this
|
|
1813
|
-
// object set correctly.
|
|
1814
|
-
_this.remapInheritedLayerObjects(objects, layerName, effectiveLayerName);
|
|
1815
|
-
// One INSERT can expand to children from multiple layers. Here we create one
|
|
1816
|
-
// render entity per layer bucket but preserve the INSERT object id for all
|
|
1817
|
-
// buckets, so selection/highlight still maps back to the same database object.
|
|
1818
|
-
// Within each layer bucket, the object id remains unique in scene indexing.
|
|
1819
|
-
var entity = new AcTrEntity(styleManager);
|
|
1820
|
-
entity.applyMatrix4(group.matrix);
|
|
1821
|
-
entity.objectId = groupObjectId;
|
|
1822
|
-
entity.ownerId = group.ownerId;
|
|
1823
|
-
// If block-definition entities are on layer "0", this bucket now uses the layer
|
|
1824
|
-
// of the block reference itself (effectiveLayerName).
|
|
1825
|
-
entity.layerName = effectiveLayerName;
|
|
1826
|
-
entity.box = worldGroupBox;
|
|
1827
|
-
var entityUserData = entity.userData;
|
|
1828
|
-
entityUserData.spatialIndexChildBoxes = groupChildBoxes;
|
|
1829
|
-
// Important:
|
|
1830
|
-
// DO NOT USE spread operator when adding objects because it may be one very large array
|
|
1831
|
-
// and can result in maximum call stack size exceeded
|
|
1832
|
-
for (var i = 0; i < objects.length; i++) {
|
|
1833
|
-
entity.add(objects[i]);
|
|
1834
|
-
}
|
|
1835
|
-
_this._scene.addEntity(entity, true);
|
|
1836
|
-
_this.applySessionHiddenObjectState(groupObjectId);
|
|
1837
|
-
entity.dispose();
|
|
1838
|
-
});
|
|
1839
|
-
group.dispose();
|
|
1840
|
-
this._isDirty = true;
|
|
1841
|
-
};
|
|
1842
2006
|
/**
|
|
1843
|
-
*
|
|
1844
|
-
*
|
|
1845
|
-
* During block decomposition, one INSERT may be split into multiple layer buckets. For
|
|
1846
|
-
* children authored on layer "0", AutoCAD requires inheriting the INSERT's own layer.
|
|
1847
|
-
* This method applies that inheritance by mutating each child's `userData.layerName` and
|
|
1848
|
-
* re-binding materials via renderer cache, so subsequent layer-level style changes still
|
|
1849
|
-
* hit the correct material instances.
|
|
1850
|
-
*
|
|
1851
|
-
* @param objects - Root objects in the current layer bucket to traverse and remap.
|
|
1852
|
-
* @param sourceLayerName - Layer name found in block definition before inheritance.
|
|
1853
|
-
* @param effectiveLayerName - Final layer name used by rendering and style updates.
|
|
2007
|
+
* Rebuilds block-reference child boxes and aligns aggregate {@link AcTrGroup.wcsBbox}
|
|
2008
|
+
* with their union before spatial-index registration.
|
|
1854
2009
|
*/
|
|
1855
|
-
AcTrView2d.prototype.
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
if (sourceLayerName === effectiveLayerName)
|
|
2010
|
+
AcTrView2d.prototype.syncGroupSpatialBoundsForIndexing = function (group) {
|
|
2011
|
+
group.refreshWcsChildBoxesFromChildren();
|
|
2012
|
+
if (group.wcsChildBoxes.length === 0) {
|
|
1859
2013
|
return;
|
|
1860
|
-
var renderer = this._renderer;
|
|
1861
|
-
var layerTraits = this.getEffectiveLayerTraits(effectiveLayerName);
|
|
1862
|
-
try {
|
|
1863
|
-
for (var objects_1 = __values(objects), objects_1_1 = objects_1.next(); !objects_1_1.done; objects_1_1 = objects_1.next()) {
|
|
1864
|
-
var object = objects_1_1.value;
|
|
1865
|
-
object.traverse(function (child) {
|
|
1866
|
-
if (child.userData.layerName === sourceLayerName) {
|
|
1867
|
-
child.userData.layerName = effectiveLayerName;
|
|
1868
|
-
}
|
|
1869
|
-
if (!('material' in child))
|
|
1870
|
-
return;
|
|
1871
|
-
var material = child.material;
|
|
1872
|
-
if (Array.isArray(material)) {
|
|
1873
|
-
var materials = material;
|
|
1874
|
-
child.material = materials.map(function (entry) {
|
|
1875
|
-
return renderer.getLayerBoundMaterial(_this.promoteLayerZeroByLayerColor(entry, sourceLayerName), effectiveLayerName, layerTraits);
|
|
1876
|
-
});
|
|
1877
|
-
return;
|
|
1878
|
-
}
|
|
1879
|
-
var remappedMaterial = renderer.getLayerBoundMaterial(_this.promoteLayerZeroByLayerColor(material, sourceLayerName), effectiveLayerName, layerTraits);
|
|
1880
|
-
child.material = remappedMaterial;
|
|
1881
|
-
child.userData.styleMaterialId = remappedMaterial.id;
|
|
1882
|
-
});
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
1885
|
-
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
1886
|
-
finally {
|
|
1887
|
-
try {
|
|
1888
|
-
if (objects_1_1 && !objects_1_1.done && (_a = objects_1.return)) _a.call(objects_1);
|
|
1889
|
-
}
|
|
1890
|
-
finally { if (e_8) throw e_8.error; }
|
|
1891
|
-
}
|
|
1892
|
-
};
|
|
1893
|
-
/**
|
|
1894
|
-
* Some DXF conversion paths lose `isByLayerColor` on layer-0 block contents while still
|
|
1895
|
-
* retaining other ByLayer markers (lineType/lineWeight/transparency). For AutoCAD-compatible
|
|
1896
|
-
* INSERT inheritance, treat such colors as inheritable when remapping from layer "0".
|
|
1897
|
-
*/
|
|
1898
|
-
AcTrView2d.prototype.promoteLayerZeroByLayerColor = function (material, sourceLayerName) {
|
|
1899
|
-
var metadata = getMaterialMetadata(material);
|
|
1900
|
-
var hasAnyOtherByLayerBinding = hasByLayerBinding(metadata) && metadata.isByLayerColor !== true;
|
|
1901
|
-
if (sourceLayerName === '0' && hasAnyOtherByLayerBinding) {
|
|
1902
|
-
setMaterialMetadata(material, { isByLayerColor: true });
|
|
1903
2014
|
}
|
|
1904
|
-
return
|
|
2015
|
+
var childBoxes = group.wcsChildBoxes.map(function (box) { return ({
|
|
2016
|
+
minX: box.minX,
|
|
2017
|
+
minY: box.minY,
|
|
2018
|
+
maxX: box.maxX,
|
|
2019
|
+
maxY: box.maxY,
|
|
2020
|
+
id: box.id
|
|
2021
|
+
}); });
|
|
2022
|
+
group.wcsBbox = unionGroupWcsChildBoxes(group);
|
|
2023
|
+
var userData = group.userData;
|
|
2024
|
+
userData.spatialIndexChildBoxes = childBoxes;
|
|
1905
2025
|
};
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
2026
|
+
AcTrView2d.prototype.handleGroup = function (group, progressive) {
|
|
2027
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
2028
|
+
var children, objectsGroupByLayer, children_1, children_1_1, child, renderContext, groupObjectId, groupLayerName, groupChildBoxes, aggregateSpatialBbox;
|
|
2029
|
+
var e_6, _a;
|
|
2030
|
+
var _this = this;
|
|
2031
|
+
return __generator(this, function (_b) {
|
|
2032
|
+
switch (_b.label) {
|
|
2033
|
+
case 0: return [4 /*yield*/, this.finishEntityGeometry(group, progressive)];
|
|
2034
|
+
case 1:
|
|
2035
|
+
_b.sent();
|
|
2036
|
+
this.syncGroupSpatialBoundsForIndexing(group);
|
|
2037
|
+
children = group.children;
|
|
2038
|
+
objectsGroupByLayer = new Map();
|
|
2039
|
+
children.forEach(function (child) {
|
|
2040
|
+
var _a;
|
|
2041
|
+
if (child.visible === false) {
|
|
2042
|
+
return;
|
|
2043
|
+
}
|
|
2044
|
+
var layerName = child.userData.layerName;
|
|
2045
|
+
if (!objectsGroupByLayer.has(layerName)) {
|
|
2046
|
+
objectsGroupByLayer.set(layerName, []);
|
|
2047
|
+
}
|
|
2048
|
+
(_a = objectsGroupByLayer.get(layerName)) === null || _a === void 0 ? void 0 : _a.push(child);
|
|
2049
|
+
});
|
|
2050
|
+
// Important:
|
|
2051
|
+
// Sometimes one group may contain huge amount of objects (> 100,000). So it is important
|
|
2052
|
+
// to re-parent object with the fast approach. Calling add/remove method in THREE.Object3D
|
|
2053
|
+
// is very slow because it do lots of things
|
|
2054
|
+
// - Remove children from old group
|
|
2055
|
+
// - Insert them into new group
|
|
2056
|
+
// - Reset parent pointer
|
|
2057
|
+
// - Do one updateMatrixWorld() at the end (optional)
|
|
2058
|
+
// So we operate its children directly.
|
|
2059
|
+
group.children = [];
|
|
2060
|
+
try {
|
|
2061
|
+
for (children_1 = __values(children), children_1_1 = children_1.next(); !children_1_1.done; children_1_1 = children_1.next()) {
|
|
2062
|
+
child = children_1_1.value;
|
|
2063
|
+
child.parent = null;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2067
|
+
finally {
|
|
2068
|
+
try {
|
|
2069
|
+
if (children_1_1 && !children_1_1.done && (_a = children_1.return)) _a.call(children_1);
|
|
2070
|
+
}
|
|
2071
|
+
finally { if (e_6) throw e_6.error; }
|
|
2072
|
+
}
|
|
2073
|
+
renderContext = group.renderContext;
|
|
2074
|
+
groupObjectId = group.objectId;
|
|
2075
|
+
groupLayerName = group.layerName;
|
|
2076
|
+
// AcDbRenderingCache.draw (and similar paths such as AcDbTable) already call
|
|
2077
|
+
// applyMatrix on the group, which updates wcsBbbox and wcsChildBoxes to WCS.
|
|
2078
|
+
// Do not multiply group.matrix here — that would double-transform spatial bounds.
|
|
2079
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
2080
|
+
assertAcTrGroupWcsBboxesConsistent(group);
|
|
2081
|
+
}
|
|
2082
|
+
groupChildBoxes = group.wcsChildBoxes.map(function (box) { return ({
|
|
2083
|
+
minX: box.minX,
|
|
2084
|
+
minY: box.minY,
|
|
2085
|
+
maxX: box.maxX,
|
|
2086
|
+
maxY: box.maxY,
|
|
2087
|
+
id: box.id
|
|
2088
|
+
}); });
|
|
2089
|
+
aggregateSpatialBbox = groupChildBoxes.length > 0
|
|
2090
|
+
? unionGroupWcsChildBoxes(group)
|
|
2091
|
+
: group.wcsBbox.clone();
|
|
2092
|
+
if (groupChildBoxes.length > 0) {
|
|
2093
|
+
group.wcsBbox = aggregateSpatialBbox.clone();
|
|
2094
|
+
}
|
|
2095
|
+
objectsGroupByLayer.forEach(function (objects, layerName) {
|
|
2096
|
+
// AutoCAD block rule: entities authored on layer "0" inherit the INSERT's layer.
|
|
2097
|
+
// Non-zero layers keep their original layer name.
|
|
2098
|
+
var effectiveLayerName = layerName === '0' ? groupLayerName : layerName;
|
|
2099
|
+
// Keep runtime layer metadata/material cache aligned with the inherited layer so
|
|
2100
|
+
// later layer style edits (color, linetype, lineweight, transparency) target this
|
|
2101
|
+
// object set correctly.
|
|
2102
|
+
_this._inheritedLayerMaterialMapper.remap(objects, layerName, effectiveLayerName);
|
|
2103
|
+
// One INSERT can expand to children from multiple layers. Here we create one
|
|
2104
|
+
// render entity per layer bucket but preserve the INSERT object id for all
|
|
2105
|
+
// buckets, so selection/highlight still maps back to the same database object.
|
|
2106
|
+
// Within each layer bucket, the object id remains unique in scene indexing.
|
|
2107
|
+
var entity = new AcTrEntity(renderContext);
|
|
2108
|
+
entity.applyMatrix4(group.matrix);
|
|
2109
|
+
entity.objectId = groupObjectId;
|
|
2110
|
+
entity.ownerId = group.ownerId;
|
|
2111
|
+
// If block-definition entities are on layer "0", this bucket now uses the layer
|
|
2112
|
+
// of the block reference itself (effectiveLayerName).
|
|
2113
|
+
entity.layerName = effectiveLayerName;
|
|
2114
|
+
entity.wcsBbox = aggregateSpatialBbox.clone();
|
|
2115
|
+
var entityUserData = entity.userData;
|
|
2116
|
+
entityUserData.spatialIndexChildBoxes = groupChildBoxes;
|
|
2117
|
+
// Important:
|
|
2118
|
+
// DO NOT USE spread operator when adding objects because it may be one very large array
|
|
2119
|
+
// and can result in maximum call stack size exceeded
|
|
2120
|
+
for (var i = 0; i < objects.length; i++) {
|
|
2121
|
+
entity.add(objects[i]);
|
|
2122
|
+
}
|
|
2123
|
+
_this._layerAppearance.refreshTextMaterialsInObjectTree(entity);
|
|
2124
|
+
_this._scene.addEntity(entity, true);
|
|
2125
|
+
_this.applySessionHiddenObjectState(groupObjectId);
|
|
2126
|
+
entity.dispose();
|
|
2127
|
+
});
|
|
2128
|
+
group.dispose();
|
|
2129
|
+
if (this._progressiveRendering) {
|
|
2130
|
+
this._isDirty = true;
|
|
2131
|
+
void this._progressiveOpenFit.afterGeometryBatch(function () {
|
|
2132
|
+
return _this.resolveLayoutFitBox();
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
return [2 /*return*/];
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
2138
|
+
});
|
|
1921
2139
|
};
|
|
1922
2140
|
AcTrView2d.prototype.decreaseNumOfEntitiesToProcess = function () {
|
|
1923
2141
|
this._numOfEntitiesToProcess--;
|
|
@@ -1925,6 +2143,10 @@ var AcTrView2d = /** @class */ (function (_super) {
|
|
|
1925
2143
|
this._numOfEntitiesToProcess = 0;
|
|
1926
2144
|
log.warn('Something wrong! The number of entities to process should not be less than 0.');
|
|
1927
2145
|
}
|
|
2146
|
+
else if (this._numOfEntitiesToProcess === 0 &&
|
|
2147
|
+
!this._progressiveRendering) {
|
|
2148
|
+
this._isDirty = true;
|
|
2149
|
+
}
|
|
1928
2150
|
};
|
|
1929
2151
|
return AcTrView2d;
|
|
1930
2152
|
}(AcEdBaseView));
|