chili3d 0.6.1
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/.github/workflows/main.yml +26 -0
- package/.vscode/c_cpp_properties.json +30 -0
- package/.vscode/launch.json +21 -0
- package/.vscode/settings.json +8 -0
- package/Dockerfile +7 -0
- package/LICENSE +661 -0
- package/README.md +184 -0
- package/biome.json +67 -0
- package/compose.yml +7 -0
- package/cpp/CMakeLists.txt +96 -0
- package/cpp/CMakePresets.json +43 -0
- package/cpp/README.md +21 -0
- package/cpp/src/converter.cpp +413 -0
- package/cpp/src/factory.cpp +612 -0
- package/cpp/src/geometry.cpp +204 -0
- package/cpp/src/mesher.cpp +330 -0
- package/cpp/src/opencascade.cpp +414 -0
- package/cpp/src/shape.cpp +447 -0
- package/cpp/src/shared.cpp +83 -0
- package/cpp/src/shared.hpp +211 -0
- package/cpp/src/transient.cpp +29 -0
- package/cpp/src/utils.cpp +114 -0
- package/cpp/src/utils.hpp +25 -0
- package/cpp/test/index.html +146 -0
- package/package.json +49 -0
- package/packages/chili/package.json +11 -0
- package/packages/chili/src/application.ts +200 -0
- package/packages/chili/src/bodys/arc.ts +61 -0
- package/packages/chili/src/bodys/boolean.ts +32 -0
- package/packages/chili/src/bodys/box.ts +73 -0
- package/packages/chili/src/bodys/circle.ts +57 -0
- package/packages/chili/src/bodys/cone.ts +64 -0
- package/packages/chili/src/bodys/cylinder.ts +69 -0
- package/packages/chili/src/bodys/ellipse.ts +85 -0
- package/packages/chili/src/bodys/face.ts +72 -0
- package/packages/chili/src/bodys/fuse.ts +44 -0
- package/packages/chili/src/bodys/index.ts +16 -0
- package/packages/chili/src/bodys/line.ts +48 -0
- package/packages/chili/src/bodys/polygon.ts +40 -0
- package/packages/chili/src/bodys/prism.ts +49 -0
- package/packages/chili/src/bodys/pyramid.ts +64 -0
- package/packages/chili/src/bodys/rect.ts +69 -0
- package/packages/chili/src/bodys/revolve.ts +54 -0
- package/packages/chili/src/bodys/sphere.ts +48 -0
- package/packages/chili/src/bodys/sweep.ts +67 -0
- package/packages/chili/src/bodys/wire.ts +36 -0
- package/packages/chili/src/commands/application/index.ts +10 -0
- package/packages/chili/src/commands/application/newDocument.ts +17 -0
- package/packages/chili/src/commands/application/openDocument.ts +35 -0
- package/packages/chili/src/commands/application/performanceTest.ts +64 -0
- package/packages/chili/src/commands/application/saveDocument.ts +24 -0
- package/packages/chili/src/commands/application/toFile.ts +35 -0
- package/packages/chili/src/commands/application/toggleDynamicWorkplane.ts +15 -0
- package/packages/chili/src/commands/application/wechatGroup.ts +42 -0
- package/packages/chili/src/commands/boolean.ts +109 -0
- package/packages/chili/src/commands/create/arc.ts +110 -0
- package/packages/chili/src/commands/create/bezier.ts +116 -0
- package/packages/chili/src/commands/create/box.ts +59 -0
- package/packages/chili/src/commands/create/circle.ts +54 -0
- package/packages/chili/src/commands/create/cone.ts +104 -0
- package/packages/chili/src/commands/create/converter.ts +159 -0
- package/packages/chili/src/commands/create/copySubShape.ts +37 -0
- package/packages/chili/src/commands/create/curveProjection.ts +61 -0
- package/packages/chili/src/commands/create/cylinder.ts +96 -0
- package/packages/chili/src/commands/create/ellipse.ts +95 -0
- package/packages/chili/src/commands/create/group.ts +205 -0
- package/packages/chili/src/commands/create/index.ts +26 -0
- package/packages/chili/src/commands/create/line.ts +61 -0
- package/packages/chili/src/commands/create/loft.ts +149 -0
- package/packages/chili/src/commands/create/offset.ts +131 -0
- package/packages/chili/src/commands/create/polygon.ts +104 -0
- package/packages/chili/src/commands/create/prism.ts +52 -0
- package/packages/chili/src/commands/create/pyramid.ts +56 -0
- package/packages/chili/src/commands/create/rect.ts +105 -0
- package/packages/chili/src/commands/create/revolve.ts +62 -0
- package/packages/chili/src/commands/create/section.ts +31 -0
- package/packages/chili/src/commands/create/sphere.ts +48 -0
- package/packages/chili/src/commands/create/sweep.ts +39 -0
- package/packages/chili/src/commands/create/thickSolid.ts +50 -0
- package/packages/chili/src/commands/createActCommand.ts +26 -0
- package/packages/chili/src/commands/createCommand.ts +41 -0
- package/packages/chili/src/commands/delete.ts +38 -0
- package/packages/chili/src/commands/folder.ts +18 -0
- package/packages/chili/src/commands/importExport.ts +97 -0
- package/packages/chili/src/commands/index.ts +17 -0
- package/packages/chili/src/commands/measure/angle.ts +130 -0
- package/packages/chili/src/commands/measure/index.ts +6 -0
- package/packages/chili/src/commands/measure/length.ts +57 -0
- package/packages/chili/src/commands/measure/select.module.css +68 -0
- package/packages/chili/src/commands/measure/select.ts +228 -0
- package/packages/chili/src/commands/modify/array.ts +447 -0
- package/packages/chili/src/commands/modify/break.ts +78 -0
- package/packages/chili/src/commands/modify/brush.ts +100 -0
- package/packages/chili/src/commands/modify/chamfer.ts +70 -0
- package/packages/chili/src/commands/modify/explode.ts +91 -0
- package/packages/chili/src/commands/modify/fillet.ts +69 -0
- package/packages/chili/src/commands/modify/index.ts +16 -0
- package/packages/chili/src/commands/modify/mirror.ts +49 -0
- package/packages/chili/src/commands/modify/move.ts +39 -0
- package/packages/chili/src/commands/modify/removeFeature.ts +56 -0
- package/packages/chili/src/commands/modify/removeSubShapes.ts +44 -0
- package/packages/chili/src/commands/modify/rotate.ts +112 -0
- package/packages/chili/src/commands/modify/split.ts +81 -0
- package/packages/chili/src/commands/modify/transformedCommand.ts +100 -0
- package/packages/chili/src/commands/modify/trim.ts +254 -0
- package/packages/chili/src/commands/multistepCommand.ts +125 -0
- package/packages/chili/src/commands/redo.ts +16 -0
- package/packages/chili/src/commands/undo.ts +16 -0
- package/packages/chili/src/commands/workingPlane.ts +150 -0
- package/packages/chili/src/comparers/NumberEqualityComparer.ts +12 -0
- package/packages/chili/src/comparers/XYZEqualityComparer.ts +12 -0
- package/packages/chili/src/comparers/index.ts +5 -0
- package/packages/chili/src/document.ts +145 -0
- package/packages/chili/src/editEventHandler.ts +20 -0
- package/packages/chili/src/index.ts +12 -0
- package/packages/chili/src/selection.ts +178 -0
- package/packages/chili/src/services/commandService.ts +105 -0
- package/packages/chili/src/services/editorService.ts +46 -0
- package/packages/chili/src/services/hotkeyService.ts +102 -0
- package/packages/chili/src/services/index.ts +6 -0
- package/packages/chili/src/snap/dimension.ts +33 -0
- package/packages/chili/src/snap/handlers/angleSnapEventHandler.ts +60 -0
- package/packages/chili/src/snap/handlers/index.ts +7 -0
- package/packages/chili/src/snap/handlers/lengthSnapEventHandler.ts +117 -0
- package/packages/chili/src/snap/handlers/pointSnapEventHandler.ts +176 -0
- package/packages/chili/src/snap/handlers/snapEventHandler.ts +288 -0
- package/packages/chili/src/snap/index.ts +6 -0
- package/packages/chili/src/snap/snap.ts +50 -0
- package/packages/chili/src/snap/snaps/axisSnap.ts +57 -0
- package/packages/chili/src/snap/snaps/baseSnap.ts +69 -0
- package/packages/chili/src/snap/snaps/featurePointStrategy.ts +64 -0
- package/packages/chili/src/snap/snaps/index.ts +7 -0
- package/packages/chili/src/snap/snaps/objectSnap.ts +264 -0
- package/packages/chili/src/snap/snaps/planeSnap.ts +55 -0
- package/packages/chili/src/snap/snaps/pointOnCurveSnap.ts +24 -0
- package/packages/chili/src/snap/tracking/axis.ts +32 -0
- package/packages/chili/src/snap/tracking/axisTracking.ts +46 -0
- package/packages/chili/src/snap/tracking/index.ts +6 -0
- package/packages/chili/src/snap/tracking/objectTracking.ts +90 -0
- package/packages/chili/src/snap/tracking/trackingBase.ts +40 -0
- package/packages/chili/src/snap/tracking/trackingSnap.ts +201 -0
- package/packages/chili/src/step/angleStep.ts +32 -0
- package/packages/chili/src/step/index.ts +8 -0
- package/packages/chili/src/step/lengthStep.ts +32 -0
- package/packages/chili/src/step/pointStep.ts +87 -0
- package/packages/chili/src/step/selectStep.ts +130 -0
- package/packages/chili/src/step/step.ts +55 -0
- package/packages/chili/src/utils.ts +19 -0
- package/packages/chili/test/command.test.ts +4 -0
- package/packages/chili-builder/package.json +13 -0
- package/packages/chili-builder/src/additionalModule.ts +15 -0
- package/packages/chili-builder/src/appBuilder.ts +176 -0
- package/packages/chili-builder/src/defaultDataExchange.ts +152 -0
- package/packages/chili-builder/src/index.ts +5 -0
- package/packages/chili-builder/src/ribbon.ts +129 -0
- package/packages/chili-controls/package.json +9 -0
- package/packages/chili-controls/src/collection.ts +96 -0
- package/packages/chili-controls/src/controls.ts +83 -0
- package/packages/chili-controls/src/converters/colorConverter.ts +39 -0
- package/packages/chili-controls/src/converters/index.ts +8 -0
- package/packages/chili-controls/src/converters/numberConverter.ts +15 -0
- package/packages/chili-controls/src/converters/stringConverter.ts +13 -0
- package/packages/chili-controls/src/converters/urlConverter.ts +10 -0
- package/packages/chili-controls/src/converters/xyzConverter.ts +28 -0
- package/packages/chili-controls/src/expander/expander.module.css +38 -0
- package/packages/chili-controls/src/expander/expander.ts +59 -0
- package/packages/chili-controls/src/expander/index.ts +4 -0
- package/packages/chili-controls/src/htmlProps.ts +10 -0
- package/packages/chili-controls/src/index.ts +10 -0
- package/packages/chili-controls/src/radioGroup.module.css +20 -0
- package/packages/chili-controls/src/radioGroup.ts +54 -0
- package/packages/chili-controls/src/utils.ts +20 -0
- package/packages/chili-controls/test/converter.test.ts +70 -0
- package/packages/chili-controls/test/styleMock.js +4 -0
- package/packages/chili-core/package.json +7 -0
- package/packages/chili-core/src/application.ts +38 -0
- package/packages/chili-core/src/command/command.ts +154 -0
- package/packages/chili-core/src/command/commandKeys.ts +8 -0
- package/packages/chili-core/src/command/decarator.ts +43 -0
- package/packages/chili-core/src/command/index.ts +6 -0
- package/packages/chili-core/src/config.ts +145 -0
- package/packages/chili-core/src/constants.ts +8 -0
- package/packages/chili-core/src/dataExchange.ts +12 -0
- package/packages/chili-core/src/document.ts +25 -0
- package/packages/chili-core/src/editor.ts +12 -0
- package/packages/chili-core/src/foundation/asyncController.ts +55 -0
- package/packages/chili-core/src/foundation/binding.ts +132 -0
- package/packages/chili-core/src/foundation/collection.ts +208 -0
- package/packages/chili-core/src/foundation/converter.ts +9 -0
- package/packages/chili-core/src/foundation/deepObserver.ts +154 -0
- package/packages/chili-core/src/foundation/disposable.ts +18 -0
- package/packages/chili-core/src/foundation/dto/index.ts +9 -0
- package/packages/chili-core/src/foundation/equalityComparer.ts +6 -0
- package/packages/chili-core/src/foundation/gc.ts +36 -0
- package/packages/chili-core/src/foundation/history.ts +237 -0
- package/packages/chili-core/src/foundation/id.ts +25 -0
- package/packages/chili-core/src/foundation/index.ts +26 -0
- package/packages/chili-core/src/foundation/lazy.ts +18 -0
- package/packages/chili-core/src/foundation/linkedList.ts +141 -0
- package/packages/chili-core/src/foundation/logger.ts +45 -0
- package/packages/chili-core/src/foundation/messageType.ts +8 -0
- package/packages/chili-core/src/foundation/objectStorage.ts +50 -0
- package/packages/chili-core/src/foundation/observer.ts +147 -0
- package/packages/chili-core/src/foundation/precision.ts +8 -0
- package/packages/chili-core/src/foundation/pubsub.ts +74 -0
- package/packages/chili-core/src/foundation/result.ts +69 -0
- package/packages/chili-core/src/foundation/storage.ts +10 -0
- package/packages/chili-core/src/foundation/transaction.ts +77 -0
- package/packages/chili-core/src/foundation/utils/debounce.ts +15 -0
- package/packages/chili-core/src/foundation/utils/download.ts +16 -0
- package/packages/chili-core/src/foundation/utils/index.ts +6 -0
- package/packages/chili-core/src/foundation/utils/readFileAsync.ts +84 -0
- package/packages/chili-core/src/i18n/i18n.ts +107 -0
- package/packages/chili-core/src/i18n/index.ts +5 -0
- package/packages/chili-core/src/i18n/keys.ts +265 -0
- package/packages/chili-core/src/index.ts +26 -0
- package/packages/chili-core/src/material.ts +269 -0
- package/packages/chili-core/src/math/boundingBox.ts +226 -0
- package/packages/chili-core/src/math/index.ts +14 -0
- package/packages/chili-core/src/math/line.ts +55 -0
- package/packages/chili-core/src/math/lineSegment.ts +166 -0
- package/packages/chili-core/src/math/mathUtils.ts +45 -0
- package/packages/chili-core/src/math/matrix4.ts +414 -0
- package/packages/chili-core/src/math/plane.ts +96 -0
- package/packages/chili-core/src/math/planeAngle.ts +53 -0
- package/packages/chili-core/src/math/quaternion.ts +131 -0
- package/packages/chili-core/src/math/ray.ts +30 -0
- package/packages/chili-core/src/math/xy.ts +104 -0
- package/packages/chili-core/src/math/xyz.ts +181 -0
- package/packages/chili-core/src/model/component.ts +305 -0
- package/packages/chili-core/src/model/facebaseNode.ts +17 -0
- package/packages/chili-core/src/model/folderNode.ts +289 -0
- package/packages/chili-core/src/model/geometryNode.ts +185 -0
- package/packages/chili-core/src/model/groupNode.ts +19 -0
- package/packages/chili-core/src/model/index.ts +12 -0
- package/packages/chili-core/src/model/meshNode.ts +53 -0
- package/packages/chili-core/src/model/node.ts +315 -0
- package/packages/chili-core/src/model/shapeNode.ts +195 -0
- package/packages/chili-core/src/model/visualNode.ts +39 -0
- package/packages/chili-core/src/modelManager.ts +147 -0
- package/packages/chili-core/src/navigation.ts +58 -0
- package/packages/chili-core/src/property.ts +60 -0
- package/packages/chili-core/src/selection.ts +33 -0
- package/packages/chili-core/src/selectionFilter.ts +28 -0
- package/packages/chili-core/src/serialize/index.ts +4 -0
- package/packages/chili-core/src/serialize/serializer.ts +231 -0
- package/packages/chili-core/src/service.ts +10 -0
- package/packages/chili-core/src/shape/curve.ts +174 -0
- package/packages/chili-core/src/shape/geometry.ts +17 -0
- package/packages/chili-core/src/shape/index.ts +12 -0
- package/packages/chili-core/src/shape/lineType.ts +7 -0
- package/packages/chili-core/src/shape/meshData.ts +347 -0
- package/packages/chili-core/src/shape/shape.ts +104 -0
- package/packages/chili-core/src/shape/shapeConverter.ts +17 -0
- package/packages/chili-core/src/shape/shapeFactory.ts +58 -0
- package/packages/chili-core/src/shape/shapeType.ts +75 -0
- package/packages/chili-core/src/shape/surface.ts +154 -0
- package/packages/chili-core/src/snapType.ts +32 -0
- package/packages/chili-core/src/ui/button.ts +16 -0
- package/packages/chili-core/src/ui/combobox.ts +27 -0
- package/packages/chili-core/src/ui/dialog.ts +7 -0
- package/packages/chili-core/src/ui/index.ts +8 -0
- package/packages/chili-core/src/ui/ribbon.ts +15 -0
- package/packages/chili-core/src/ui/window.ts +13 -0
- package/packages/chili-core/src/visual/act.ts +59 -0
- package/packages/chili-core/src/visual/cameraController.ts +22 -0
- package/packages/chili-core/src/visual/cursorType.ts +4 -0
- package/packages/chili-core/src/visual/detectedData.ts +14 -0
- package/packages/chili-core/src/visual/eventHandler.ts +15 -0
- package/packages/chili-core/src/visual/highlighter.ts +16 -0
- package/packages/chili-core/src/visual/index.ts +20 -0
- package/packages/chili-core/src/visual/meshExporter.ts +11 -0
- package/packages/chili-core/src/visual/meshUtils.ts +276 -0
- package/packages/chili-core/src/visual/textGenerator.ts +8 -0
- package/packages/chili-core/src/visual/view.ts +80 -0
- package/packages/chili-core/src/visual/viewGizmo.ts +8 -0
- package/packages/chili-core/src/visual/viewport.ts +10 -0
- package/packages/chili-core/src/visual/visual.ts +24 -0
- package/packages/chili-core/src/visual/visualContext.ts +29 -0
- package/packages/chili-core/src/visual/visualFactory.ts +10 -0
- package/packages/chili-core/src/visual/visualObject.ts +25 -0
- package/packages/chili-core/src/visual/visualShape.ts +30 -0
- package/packages/chili-core/test/binding.test.ts +95 -0
- package/packages/chili-core/test/boundingBox.test.ts +60 -0
- package/packages/chili-core/test/collection.test.ts +53 -0
- package/packages/chili-core/test/history.test.ts +42 -0
- package/packages/chili-core/test/line.test.ts +75 -0
- package/packages/chili-core/test/linesegment.test.ts +98 -0
- package/packages/chili-core/test/linkedList.test.ts +82 -0
- package/packages/chili-core/test/math.test.ts +34 -0
- package/packages/chili-core/test/matrix.test.ts +129 -0
- package/packages/chili-core/test/node.test.ts +122 -0
- package/packages/chili-core/test/nodeList.test.ts +247 -0
- package/packages/chili-core/test/observer.test.ts +91 -0
- package/packages/chili-core/test/plane.test.ts +31 -0
- package/packages/chili-core/test/quaternion.test.ts +14 -0
- package/packages/chili-core/test/result.test.ts +24 -0
- package/packages/chili-core/test/serializer.test.ts +58 -0
- package/packages/chili-core/test/snapType.test.ts +10 -0
- package/packages/chili-core/test/task.test.ts +41 -0
- package/packages/chili-core/test/testDocument.ts +70 -0
- package/packages/chili-core/test/transaction.test.ts +42 -0
- package/packages/chili-core/test/visual.test.ts +42 -0
- package/packages/chili-core/test/xyz.test.ts +260 -0
- package/packages/chili-geo/package.json +9 -0
- package/packages/chili-geo/src/index.ts +4 -0
- package/packages/chili-geo/src/utils.ts +113 -0
- package/packages/chili-i18n/package.json +9 -0
- package/packages/chili-i18n/src/en.ts +270 -0
- package/packages/chili-i18n/src/index.ts +8 -0
- package/packages/chili-i18n/src/pt-br.ts +67 -0
- package/packages/chili-i18n/src/zh-cn.ts +269 -0
- package/packages/chili-storage/package.json +9 -0
- package/packages/chili-storage/src/index.ts +4 -0
- package/packages/chili-storage/src/indexedDBStorage.ts +150 -0
- package/packages/chili-three/package.json +13 -0
- package/packages/chili-three/src/cameraController.ts +335 -0
- package/packages/chili-three/src/common.ts +65 -0
- package/packages/chili-three/src/constants.ts +12 -0
- package/packages/chili-three/src/highlightable.ts +13 -0
- package/packages/chili-three/src/index.ts +4 -0
- package/packages/chili-three/src/meshExporter.ts +69 -0
- package/packages/chili-three/src/outlinePass.js +340 -0
- package/packages/chili-three/src/texture_points.jpg +0 -0
- package/packages/chili-three/src/threeGeometry.ts +207 -0
- package/packages/chili-three/src/threeGeometryFactory.ts +120 -0
- package/packages/chili-three/src/threeHelper.ts +174 -0
- package/packages/chili-three/src/threeHighlighter.ts +257 -0
- package/packages/chili-three/src/threeView.module.css +39 -0
- package/packages/chili-three/src/threeView.ts +669 -0
- package/packages/chili-three/src/threeViewEventHandler.ts +193 -0
- package/packages/chili-three/src/threeVisual.ts +92 -0
- package/packages/chili-three/src/threeVisualContext.ts +435 -0
- package/packages/chili-three/src/threeVisualFactory.ts +12 -0
- package/packages/chili-three/src/threeVisualObject.ts +442 -0
- package/packages/chili-three/src/viewGizmo.ts +305 -0
- package/packages/chili-three/test/cameraControls.ts +10 -0
- package/packages/chili-three/test/testDocument.ts +68 -0
- package/packages/chili-three/test/testEdge.ts +171 -0
- package/packages/chili-three/test/testView.ts +78 -0
- package/packages/chili-three/test/three.test.ts +44 -0
- package/packages/chili-three/test/viewGizmo.ts +12 -0
- package/packages/chili-ui/package.json +12 -0
- package/packages/chili-ui/src/cursor/draw.cur +0 -0
- package/packages/chili-ui/src/cursor/index.ts +17 -0
- package/packages/chili-ui/src/dialog.module.css +63 -0
- package/packages/chili-ui/src/dialog.ts +42 -0
- package/packages/chili-ui/src/editor.module.css +83 -0
- package/packages/chili-ui/src/editor.ts +142 -0
- package/packages/chili-ui/src/home/home.module.css +301 -0
- package/packages/chili-ui/src/home/home.ts +243 -0
- package/packages/chili-ui/src/home/index.ts +4 -0
- package/packages/chili-ui/src/home/languageSelector.ts +27 -0
- package/packages/chili-ui/src/home/navigation3DSelector.ts +27 -0
- package/packages/chili-ui/src/home/themeSelector.ts +34 -0
- package/packages/chili-ui/src/index.ts +5 -0
- package/packages/chili-ui/src/mainWindow.module.css +144 -0
- package/packages/chili-ui/src/mainWindow.ts +154 -0
- package/packages/chili-ui/src/okCancel.module.css +54 -0
- package/packages/chili-ui/src/okCancel.ts +58 -0
- package/packages/chili-ui/src/permanent.module.css +44 -0
- package/packages/chili-ui/src/permanent.ts +31 -0
- package/packages/chili-ui/src/project/index.ts +4 -0
- package/packages/chili-ui/src/project/projectView.module.css +37 -0
- package/packages/chili-ui/src/project/projectView.ts +77 -0
- package/packages/chili-ui/src/project/toolBar.module.css +16 -0
- package/packages/chili-ui/src/project/toolBar.ts +73 -0
- package/packages/chili-ui/src/project/tree/index.ts +5 -0
- package/packages/chili-ui/src/project/tree/tree.module.css +16 -0
- package/packages/chili-ui/src/project/tree/tree.ts +265 -0
- package/packages/chili-ui/src/project/tree/treeItem.module.css +21 -0
- package/packages/chili-ui/src/project/tree/treeItem.ts +89 -0
- package/packages/chili-ui/src/project/tree/treeItemGroup.module.css +33 -0
- package/packages/chili-ui/src/project/tree/treeItemGroup.ts +85 -0
- package/packages/chili-ui/src/project/tree/treeModel.module.css +11 -0
- package/packages/chili-ui/src/project/tree/treeModel.ts +20 -0
- package/packages/chili-ui/src/property/check.ts +39 -0
- package/packages/chili-ui/src/property/colorPorperty.module.css +6 -0
- package/packages/chili-ui/src/property/colorProperty.ts +63 -0
- package/packages/chili-ui/src/property/common.module.css +14 -0
- package/packages/chili-ui/src/property/index.ts +4 -0
- package/packages/chili-ui/src/property/input.module.css +19 -0
- package/packages/chili-ui/src/property/input.ts +140 -0
- package/packages/chili-ui/src/property/material/index.ts +5 -0
- package/packages/chili-ui/src/property/material/materialDataContent.ts +44 -0
- package/packages/chili-ui/src/property/material/materialEditor.module.css +98 -0
- package/packages/chili-ui/src/property/material/materialEditor.ts +147 -0
- package/packages/chili-ui/src/property/material/textureEditor.module.css +46 -0
- package/packages/chili-ui/src/property/material/textureEditor.ts +61 -0
- package/packages/chili-ui/src/property/materialProperty.module.css +30 -0
- package/packages/chili-ui/src/property/materialProperty.ts +86 -0
- package/packages/chili-ui/src/property/matrixProperty.ts +147 -0
- package/packages/chili-ui/src/property/propertyBase.module.css +3 -0
- package/packages/chili-ui/src/property/propertyBase.ts +14 -0
- package/packages/chili-ui/src/property/propertyView.module.css +36 -0
- package/packages/chili-ui/src/property/propertyView.ts +115 -0
- package/packages/chili-ui/src/property/utils.ts +48 -0
- package/packages/chili-ui/src/ribbon/commandContext.module.css +73 -0
- package/packages/chili-ui/src/ribbon/commandContext.ts +239 -0
- package/packages/chili-ui/src/ribbon/index.ts +4 -0
- package/packages/chili-ui/src/ribbon/ribbon.module.css +286 -0
- package/packages/chili-ui/src/ribbon/ribbon.ts +288 -0
- package/packages/chili-ui/src/ribbon/ribbonButton.module.css +75 -0
- package/packages/chili-ui/src/ribbon/ribbonButton.ts +88 -0
- package/packages/chili-ui/src/ribbon/ribbonData.ts +66 -0
- package/packages/chili-ui/src/ribbon/ribbonStack.module.css +6 -0
- package/packages/chili-ui/src/ribbon/ribbonStack.ts +13 -0
- package/packages/chili-ui/src/ribbon/ribbonToggleButton.module.css +3 -0
- package/packages/chili-ui/src/ribbon/ribbonToggleButton.ts +6 -0
- package/packages/chili-ui/src/statusbar/index.ts +4 -0
- package/packages/chili-ui/src/statusbar/snapConfig.module.css +25 -0
- package/packages/chili-ui/src/statusbar/snapConfig.ts +92 -0
- package/packages/chili-ui/src/statusbar/statusbar.module.css +28 -0
- package/packages/chili-ui/src/statusbar/statusbar.ts +54 -0
- package/packages/chili-ui/src/toast/index.ts +4 -0
- package/packages/chili-ui/src/toast/toast.module.css +27 -0
- package/packages/chili-ui/src/toast/toast.ts +39 -0
- package/packages/chili-ui/src/viewport/flyout/flyout.module.css +9 -0
- package/packages/chili-ui/src/viewport/flyout/flyout.ts +77 -0
- package/packages/chili-ui/src/viewport/flyout/index.ts +6 -0
- package/packages/chili-ui/src/viewport/flyout/input.module.css +21 -0
- package/packages/chili-ui/src/viewport/flyout/input.ts +89 -0
- package/packages/chili-ui/src/viewport/flyout/tip.module.css +21 -0
- package/packages/chili-ui/src/viewport/flyout/tip.ts +45 -0
- package/packages/chili-ui/src/viewport/index.ts +4 -0
- package/packages/chili-ui/src/viewport/layoutViewport.module.css +21 -0
- package/packages/chili-ui/src/viewport/layoutViewport.ts +76 -0
- package/packages/chili-ui/src/viewport/viewport.module.css +179 -0
- package/packages/chili-ui/src/viewport/viewport.ts +296 -0
- package/packages/chili-vis/package.json +9 -0
- package/packages/chili-vis/src/index.ts +7 -0
- package/packages/chili-vis/src/nodeSelectionEventHandler.ts +122 -0
- package/packages/chili-vis/src/selectionEventHandler.ts +145 -0
- package/packages/chili-vis/src/shapeSelectionEventHandler.ts +176 -0
- package/packages/chili-vis/src/viewUtils.ts +64 -0
- package/packages/chili-wasm/lib/chili-wasm.d.ts +827 -0
- package/packages/chili-wasm/lib/chili-wasm.js +5275 -0
- package/packages/chili-wasm/lib/chili-wasm.wasm +0 -0
- package/packages/chili-wasm/package.json +10 -0
- package/packages/chili-wasm/src/converter.ts +124 -0
- package/packages/chili-wasm/src/curve.ts +589 -0
- package/packages/chili-wasm/src/factory.ts +331 -0
- package/packages/chili-wasm/src/geometry.ts +51 -0
- package/packages/chili-wasm/src/helper.ts +435 -0
- package/packages/chili-wasm/src/index.ts +5 -0
- package/packages/chili-wasm/src/mesher.ts +114 -0
- package/packages/chili-wasm/src/shape.ts +481 -0
- package/packages/chili-wasm/src/surface.ts +510 -0
- package/packages/chili-wasm/src/wasm.ts +13 -0
- package/packages/chili-web/package.json +9 -0
- package/packages/chili-web/src/index.ts +33 -0
- package/packages/chili-web/src/loading.ts +67 -0
- package/packages/global.d.ts +31 -0
- package/public/favicon.svg +10 -0
- package/public/fonts/fzhei.json +46120 -0
- package/public/iconfont.js +1 -0
- package/public/images/wechat.jpg +0 -0
- package/public/index.css +13 -0
- package/public/index.html +24 -0
- package/rspack.config.ts +93 -0
- package/rstest.config.ts +27 -0
- package/screenshots/screenshot.png +0 -0
- package/scripts/add_copyright.mjs +59 -0
- package/scripts/build-npm.mjs +105 -0
- package/scripts/common.mjs +24 -0
- package/scripts/release.mjs +92 -0
- package/scripts/restore-package-json.mjs +27 -0
- package/scripts/setup_wasm_deps.mjs +97 -0
- package/scripts/update-package-json.mjs +27 -0
- package/tsconfig.build.json +14 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { type IViewGizmo, XYZ } from "chili-core";
|
|
5
|
+
import { Matrix4, Vector3 } from "three";
|
|
6
|
+
import type { CameraController } from "./cameraController";
|
|
7
|
+
import type { ThreeView } from "./threeView";
|
|
8
|
+
|
|
9
|
+
const MOUSE_LEFT = 1;
|
|
10
|
+
|
|
11
|
+
const options = {
|
|
12
|
+
size: 200,
|
|
13
|
+
padding: 16,
|
|
14
|
+
bubbleSizePrimary: 18,
|
|
15
|
+
bubbleSizeSeconday: 10,
|
|
16
|
+
showSecondary: true,
|
|
17
|
+
lineWidth: 2,
|
|
18
|
+
fontSize: "24px",
|
|
19
|
+
fontFamily: "arial",
|
|
20
|
+
fontColor: "#151515",
|
|
21
|
+
fontYAdjust: 0,
|
|
22
|
+
colors: {
|
|
23
|
+
x: ["#f73c3c", "#942424"],
|
|
24
|
+
y: ["#6ccb26", "#417a17"],
|
|
25
|
+
z: ["#178cf0", "#0e5490"],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export interface Axis {
|
|
30
|
+
axis: string;
|
|
31
|
+
direction: Vector3;
|
|
32
|
+
size: number;
|
|
33
|
+
position: Vector3;
|
|
34
|
+
color: string[];
|
|
35
|
+
lineWidth?: number;
|
|
36
|
+
label?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class ViewGizmo extends HTMLElement implements IViewGizmo {
|
|
40
|
+
private readonly _axes: Axis[];
|
|
41
|
+
private readonly _center: Vector3;
|
|
42
|
+
private readonly _canvas: HTMLCanvasElement;
|
|
43
|
+
private readonly _context: CanvasRenderingContext2D;
|
|
44
|
+
readonly cameraController: CameraController;
|
|
45
|
+
private _canClick: boolean = true;
|
|
46
|
+
private _selectedAxis?: Axis;
|
|
47
|
+
private _mouse?: Vector3;
|
|
48
|
+
|
|
49
|
+
constructor(readonly view: ThreeView) {
|
|
50
|
+
super();
|
|
51
|
+
this.cameraController = view.cameraController;
|
|
52
|
+
this._axes = this._initAxes();
|
|
53
|
+
this._center = new Vector3(options.size * 0.5, options.size * 0.5, 0);
|
|
54
|
+
this._canvas = this._initCanvas();
|
|
55
|
+
this._context = this._canvas.getContext("2d")!;
|
|
56
|
+
this._initStyle();
|
|
57
|
+
}
|
|
58
|
+
setDom(dom: HTMLElement): void {
|
|
59
|
+
this.remove();
|
|
60
|
+
dom.appendChild(this);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
dispose(): void {
|
|
64
|
+
this.remove();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private _initStyle() {
|
|
68
|
+
this.style.zIndex = "999";
|
|
69
|
+
this.style.position = "absolute";
|
|
70
|
+
this.style.top = "20px";
|
|
71
|
+
this.style.right = "20px";
|
|
72
|
+
this.style.borderRadius = "100%";
|
|
73
|
+
this.style.cursor = "pointer";
|
|
74
|
+
this.style.userSelect = "none";
|
|
75
|
+
this.style.webkitUserSelect = "none";
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
private _initCanvas() {
|
|
79
|
+
const canvas = document.createElement("canvas");
|
|
80
|
+
canvas.width = options.size;
|
|
81
|
+
canvas.height = options.size;
|
|
82
|
+
canvas.style.width = `${options.size * 0.5}px`;
|
|
83
|
+
canvas.style.height = `${options.size * 0.5}px`;
|
|
84
|
+
this.append(canvas);
|
|
85
|
+
return canvas;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private _initAxes() {
|
|
89
|
+
return [
|
|
90
|
+
{
|
|
91
|
+
axis: "x",
|
|
92
|
+
direction: new Vector3(1, 0, 0),
|
|
93
|
+
position: new Vector3(),
|
|
94
|
+
size: options.bubbleSizePrimary,
|
|
95
|
+
color: options.colors.x,
|
|
96
|
+
lineWidth: options.lineWidth,
|
|
97
|
+
label: "X",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
axis: "y",
|
|
101
|
+
direction: new Vector3(0, 1, 0),
|
|
102
|
+
position: new Vector3(),
|
|
103
|
+
size: options.bubbleSizePrimary,
|
|
104
|
+
color: options.colors.y,
|
|
105
|
+
lineWidth: options.lineWidth,
|
|
106
|
+
label: "Y",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
axis: "z",
|
|
110
|
+
direction: new Vector3(0, 0, 1),
|
|
111
|
+
position: new Vector3(),
|
|
112
|
+
size: options.bubbleSizePrimary,
|
|
113
|
+
color: options.colors.z,
|
|
114
|
+
lineWidth: options.lineWidth,
|
|
115
|
+
label: "Z",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
axis: "-x",
|
|
119
|
+
direction: new Vector3(-1, 0, 0),
|
|
120
|
+
position: new Vector3(),
|
|
121
|
+
size: options.bubbleSizeSeconday,
|
|
122
|
+
color: options.colors.x,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
axis: "-y",
|
|
126
|
+
direction: new Vector3(0, -1, 0),
|
|
127
|
+
position: new Vector3(),
|
|
128
|
+
size: options.bubbleSizeSeconday,
|
|
129
|
+
color: options.colors.y,
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
axis: "-z",
|
|
133
|
+
direction: new Vector3(0, 0, -1),
|
|
134
|
+
position: new Vector3(),
|
|
135
|
+
size: options.bubbleSizeSeconday,
|
|
136
|
+
color: options.colors.z,
|
|
137
|
+
},
|
|
138
|
+
];
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
connectedCallback() {
|
|
142
|
+
this._canvas.addEventListener("pointermove", this._onPointerMove);
|
|
143
|
+
this._canvas.addEventListener("pointerenter", this._onPointerEnter);
|
|
144
|
+
this._canvas.addEventListener("pointerout", this._onPointerOut);
|
|
145
|
+
this._canvas.addEventListener("click", this._onClick);
|
|
146
|
+
this._canvas.addEventListener("pointerdown", this._onPointerDown);
|
|
147
|
+
this._canvas.addEventListener("pointerup", this._onPointerUp);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
disconnectedCallback() {
|
|
151
|
+
this._canvas.removeEventListener("pointermove", this._onPointerMove);
|
|
152
|
+
this._canvas.removeEventListener("pointerenter", this._onPointerEnter);
|
|
153
|
+
this._canvas.removeEventListener("pointerout", this._onPointerOut);
|
|
154
|
+
this._canvas.removeEventListener("click", this._onClick);
|
|
155
|
+
this._canvas.removeEventListener("pointerdown", this._onPointerDown);
|
|
156
|
+
this._canvas.removeEventListener("pointerup", this._onPointerUp);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
private readonly _onPointerMove = (e: PointerEvent) => {
|
|
160
|
+
e.stopPropagation();
|
|
161
|
+
if (e.buttons === MOUSE_LEFT && !(e.movementX === 0 && e.movementY === 0)) {
|
|
162
|
+
this.cameraController.rotate(e.movementX * 4, e.movementY * 4);
|
|
163
|
+
this._canClick = false;
|
|
164
|
+
}
|
|
165
|
+
const rect = this._canvas.getBoundingClientRect();
|
|
166
|
+
this._mouse = new Vector3(e.clientX - rect.left, e.clientY - rect.top, 0).multiplyScalar(2);
|
|
167
|
+
this.view.update();
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
private readonly _onPointerDown = (e: PointerEvent) => {
|
|
171
|
+
e.stopPropagation();
|
|
172
|
+
this._canvas.setPointerCapture(e.pointerId);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
private readonly _onPointerUp = (e: PointerEvent) => {
|
|
176
|
+
e.stopPropagation();
|
|
177
|
+
this._canvas.releasePointerCapture(e.pointerId);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
private readonly _onPointerOut = (e: PointerEvent) => {
|
|
181
|
+
e.stopPropagation();
|
|
182
|
+
this._mouse = undefined;
|
|
183
|
+
this.style.backgroundColor = "transparent";
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
private readonly _onPointerEnter = (e: PointerEvent) => {
|
|
187
|
+
e.stopPropagation();
|
|
188
|
+
this.style.backgroundColor = "rgba(66, 66, 66, .9)";
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
private readonly _onClick = (e: MouseEvent) => {
|
|
192
|
+
e.stopPropagation();
|
|
193
|
+
if (!this._canClick) {
|
|
194
|
+
this._canClick = true;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (this._selectedAxis) {
|
|
198
|
+
const distance = this.cameraController.camera.position.distanceTo(this.cameraController.target);
|
|
199
|
+
const position = this._selectedAxis.direction
|
|
200
|
+
.clone()
|
|
201
|
+
.multiplyScalar(distance)
|
|
202
|
+
.add(this.cameraController.target);
|
|
203
|
+
this.cameraController.camera.position.copy(position);
|
|
204
|
+
let up = new XYZ(0, 0, 1);
|
|
205
|
+
if (this._selectedAxis.axis === "z") up = new XYZ(0, 1, 0);
|
|
206
|
+
else if (this._selectedAxis.axis === "-z") up = new XYZ(0, -1, 0);
|
|
207
|
+
this.cameraController.lookAt(
|
|
208
|
+
this.cameraController.camera.position,
|
|
209
|
+
this.cameraController.target,
|
|
210
|
+
up,
|
|
211
|
+
);
|
|
212
|
+
this.view.update();
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
clear() {
|
|
217
|
+
this._context.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
update() {
|
|
221
|
+
this.clear();
|
|
222
|
+
const invRotMat = new Matrix4().makeRotationFromEuler(this.cameraController.camera.rotation).invert();
|
|
223
|
+
this._axes.forEach((axis) => {
|
|
224
|
+
axis.position = this.getBubblePosition(axis.direction.clone().applyMatrix4(invRotMat));
|
|
225
|
+
});
|
|
226
|
+
this._axes.sort((a, b) => a.position.z - b.position.z);
|
|
227
|
+
this.setSelectedAxis(this._axes);
|
|
228
|
+
this.drawAxes(this._axes);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
private setSelectedAxis(axes: Axis[]) {
|
|
232
|
+
this._selectedAxis = undefined;
|
|
233
|
+
if (this._mouse && this._canClick) {
|
|
234
|
+
let closestDist = Infinity;
|
|
235
|
+
for (const axis of axes) {
|
|
236
|
+
const distance = this._mouse.distanceTo(axis.position);
|
|
237
|
+
if (distance < closestDist && distance < axis.size) {
|
|
238
|
+
closestDist = distance;
|
|
239
|
+
this._selectedAxis = axis;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
drawAxes(axes: Axis[]) {
|
|
246
|
+
for (const axis of axes) {
|
|
247
|
+
const color = this.getAxisColor(axis);
|
|
248
|
+
this.drawCircle(axis.position, axis.size, color);
|
|
249
|
+
this.drawLine(this._center, axis.position, color, axis.lineWidth);
|
|
250
|
+
this.drawLabel(axis);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
private getAxisColor(axis: Axis) {
|
|
255
|
+
let color;
|
|
256
|
+
if (this._selectedAxis === axis) {
|
|
257
|
+
color = "#FFFFFF";
|
|
258
|
+
} else if (axis.position.z >= -0.01) {
|
|
259
|
+
color = axis.color[0];
|
|
260
|
+
} else {
|
|
261
|
+
color = axis.color[1];
|
|
262
|
+
}
|
|
263
|
+
return color;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private drawCircle(p: Vector3, radius = 10, color = "#FF0000") {
|
|
267
|
+
this._context.beginPath();
|
|
268
|
+
this._context.arc(p.x, p.y, radius, 0, 2 * Math.PI, false);
|
|
269
|
+
this._context.fillStyle = color;
|
|
270
|
+
this._context.fill();
|
|
271
|
+
this._context.closePath();
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private drawLine(p1: Vector3, p2: Vector3, color: string, width?: number) {
|
|
275
|
+
if (width) {
|
|
276
|
+
this._context.beginPath();
|
|
277
|
+
this._context.moveTo(p1.x, p1.y);
|
|
278
|
+
this._context.lineTo(p2.x, p2.y);
|
|
279
|
+
this._context.lineWidth = width;
|
|
280
|
+
this._context.strokeStyle = color;
|
|
281
|
+
this._context.stroke();
|
|
282
|
+
this._context.closePath();
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
private drawLabel(axis: Axis) {
|
|
287
|
+
if (axis.label) {
|
|
288
|
+
this._context.font = [options.fontSize, options.fontFamily].join(" ");
|
|
289
|
+
this._context.fillStyle = options.fontColor;
|
|
290
|
+
this._context.textBaseline = "middle";
|
|
291
|
+
this._context.textAlign = "center";
|
|
292
|
+
this._context.fillText(axis.label, axis.position.x, axis.position.y + options.fontYAdjust);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
private getBubblePosition(vector: Vector3) {
|
|
297
|
+
return new Vector3(
|
|
298
|
+
vector.x * (this._center.x - options.bubbleSizePrimary / 2 - options.padding) + this._center.x,
|
|
299
|
+
this._center.y - vector.y * (this._center.y - options.bubbleSizePrimary / 2 - options.padding),
|
|
300
|
+
vector.z,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
customElements.define("view-gizmo", ViewGizmo);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export default class CameraControls {
|
|
5
|
+
static install() {}
|
|
6
|
+
static ACTION = {};
|
|
7
|
+
mouseButtons = {};
|
|
8
|
+
setPosition() {}
|
|
9
|
+
setTarget() {}
|
|
10
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type Act,
|
|
6
|
+
History,
|
|
7
|
+
type IApplication,
|
|
8
|
+
type IDocument,
|
|
9
|
+
type ISelection,
|
|
10
|
+
type ISerialize,
|
|
11
|
+
type IView,
|
|
12
|
+
ModelManager,
|
|
13
|
+
ObservableCollection,
|
|
14
|
+
type PropertyChangedHandler,
|
|
15
|
+
type Serialized,
|
|
16
|
+
} from "chili-core";
|
|
17
|
+
import { ThreeVisual } from "../src/threeVisual";
|
|
18
|
+
|
|
19
|
+
export class TestDocument implements IDocument, ISerialize {
|
|
20
|
+
application: IApplication;
|
|
21
|
+
name: string;
|
|
22
|
+
id: string;
|
|
23
|
+
history: History;
|
|
24
|
+
selection: ISelection;
|
|
25
|
+
visual: ThreeVisual;
|
|
26
|
+
activeView: IView | undefined;
|
|
27
|
+
modelManager: ModelManager = new ModelManager(this);
|
|
28
|
+
acts: ObservableCollection<Act> = new ObservableCollection<Act>();
|
|
29
|
+
onPropertyChanged<K extends keyof this>(handler: PropertyChangedHandler<this, K>): void {
|
|
30
|
+
throw new Error("Method not implemented.");
|
|
31
|
+
}
|
|
32
|
+
removePropertyChanged<K extends keyof this>(handler: PropertyChangedHandler<this, K>): void {
|
|
33
|
+
throw new Error("Method not implemented.");
|
|
34
|
+
}
|
|
35
|
+
dispose() {
|
|
36
|
+
throw new Error("Method not implemented.");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
importFiles(files: File[] | FileList): Promise<void> {
|
|
40
|
+
return Promise.resolve();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
close(): Promise<void> {
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
serialize(): Serialized {
|
|
48
|
+
return {
|
|
49
|
+
classKey: "TestDocument",
|
|
50
|
+
properties: {},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
constructor() {
|
|
55
|
+
this.name = "test";
|
|
56
|
+
this.id = "test";
|
|
57
|
+
this.visual = new ThreeVisual(this);
|
|
58
|
+
this.history = new History();
|
|
59
|
+
this.selection = {} as any;
|
|
60
|
+
this.application = { views: [] } as any;
|
|
61
|
+
}
|
|
62
|
+
clearPropertyChanged(): void {
|
|
63
|
+
throw new Error("Method not implemented.");
|
|
64
|
+
}
|
|
65
|
+
save(): Promise<void> {
|
|
66
|
+
return Promise.resolve();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
type EdgeMeshData,
|
|
6
|
+
type I18nKeys,
|
|
7
|
+
type ICurve,
|
|
8
|
+
type IDocument,
|
|
9
|
+
type IEdge,
|
|
10
|
+
type IEqualityComparer,
|
|
11
|
+
type IShape,
|
|
12
|
+
type IShapeMeshData,
|
|
13
|
+
type ITrimmedCurve,
|
|
14
|
+
type IWire,
|
|
15
|
+
type Line,
|
|
16
|
+
LineType,
|
|
17
|
+
Matrix4,
|
|
18
|
+
Orientation,
|
|
19
|
+
ParameterShapeNode,
|
|
20
|
+
type Plane,
|
|
21
|
+
Result,
|
|
22
|
+
type Serialized,
|
|
23
|
+
ShapeType,
|
|
24
|
+
type XYZ,
|
|
25
|
+
type XYZLike,
|
|
26
|
+
} from "chili-core";
|
|
27
|
+
|
|
28
|
+
export class TestEdge implements IEdge {
|
|
29
|
+
constructor(
|
|
30
|
+
readonly start: XYZ,
|
|
31
|
+
readonly end: XYZ,
|
|
32
|
+
) {}
|
|
33
|
+
transformed(matrix: Matrix4): IShape {
|
|
34
|
+
throw new Error("Method not implemented.");
|
|
35
|
+
}
|
|
36
|
+
transformedMul(matrix: Matrix4): IShape {
|
|
37
|
+
throw new Error("Method not implemented.");
|
|
38
|
+
}
|
|
39
|
+
edgesMeshPosition(): EdgeMeshData {
|
|
40
|
+
throw new Error("Method not implemented.");
|
|
41
|
+
}
|
|
42
|
+
clone(): IShape {
|
|
43
|
+
throw new Error("Method not implemented.");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
dispose(): void {
|
|
47
|
+
throw new Error("Method not implemented.");
|
|
48
|
+
}
|
|
49
|
+
update(curve: ICurve): void {
|
|
50
|
+
throw new Error("Method not implemented.");
|
|
51
|
+
}
|
|
52
|
+
trim(start: number, end: number): IEdge {
|
|
53
|
+
throw new Error("Method not implemented.");
|
|
54
|
+
}
|
|
55
|
+
isClosed(): boolean {
|
|
56
|
+
throw new Error("Method not implemented.");
|
|
57
|
+
}
|
|
58
|
+
isNull(): boolean {
|
|
59
|
+
throw new Error("Method not implemented.");
|
|
60
|
+
}
|
|
61
|
+
reserve(): void {
|
|
62
|
+
throw new Error("Method not implemented.");
|
|
63
|
+
}
|
|
64
|
+
section(shape: IShape | Plane): IShape {
|
|
65
|
+
throw new Error("Method not implemented.");
|
|
66
|
+
}
|
|
67
|
+
splitByWire(edges: (IEdge | IWire)[]): IShape {
|
|
68
|
+
throw new Error("Method not implemented.");
|
|
69
|
+
}
|
|
70
|
+
split(shapes: IShape[]): IShape {
|
|
71
|
+
throw new Error("Method not implemented.");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
findAncestor(ancestorType: ShapeType, fromShape: IShape): IShape[] {
|
|
75
|
+
throw new Error("Method not implemented.");
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
findSubShapes(subshapeType: ShapeType): IShape[] {
|
|
79
|
+
throw new Error("Method not implemented.");
|
|
80
|
+
}
|
|
81
|
+
iterShape(): IShape[] {
|
|
82
|
+
throw new Error("Method not implemented.");
|
|
83
|
+
}
|
|
84
|
+
offset(distance: number, dir: XYZ): Result<IEdge> {
|
|
85
|
+
throw new Error("Method not implemented.");
|
|
86
|
+
}
|
|
87
|
+
hlr(position: XYZLike, direction: XYZLike, xDir: XYZLike): IShape {
|
|
88
|
+
throw new Error("Method not implemented.");
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
intersect(other: IEdge | Line) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
length(): number {
|
|
95
|
+
return this.start.distanceTo(this.end);
|
|
96
|
+
}
|
|
97
|
+
get curve(): ITrimmedCurve {
|
|
98
|
+
throw new Error("Method not implemented.");
|
|
99
|
+
}
|
|
100
|
+
get id(): string {
|
|
101
|
+
return "testEdge";
|
|
102
|
+
}
|
|
103
|
+
shapeType: ShapeType = ShapeType.Edge;
|
|
104
|
+
matrix: Matrix4 = Matrix4.identity();
|
|
105
|
+
get mesh(): IShapeMeshData {
|
|
106
|
+
return {
|
|
107
|
+
edges: {
|
|
108
|
+
position: new Float32Array([
|
|
109
|
+
this.start.x,
|
|
110
|
+
this.start.y,
|
|
111
|
+
this.start.z,
|
|
112
|
+
this.end.x,
|
|
113
|
+
this.end.y,
|
|
114
|
+
this.end.z,
|
|
115
|
+
]),
|
|
116
|
+
color: 0xff0000,
|
|
117
|
+
lineType: LineType.Solid,
|
|
118
|
+
range: [],
|
|
119
|
+
},
|
|
120
|
+
faces: undefined,
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
serialize(): Serialized {
|
|
124
|
+
return {
|
|
125
|
+
classKey: "Shape",
|
|
126
|
+
properties: {},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
orientation(): Orientation {
|
|
130
|
+
return Orientation.FORWARD;
|
|
131
|
+
}
|
|
132
|
+
isPartner(other: IShape): boolean {
|
|
133
|
+
return true;
|
|
134
|
+
}
|
|
135
|
+
isSame(other: IShape): boolean {
|
|
136
|
+
return true;
|
|
137
|
+
}
|
|
138
|
+
isEqual(other: IShape): boolean {
|
|
139
|
+
if (other instanceof TestEdge) {
|
|
140
|
+
return this.start.isEqualTo(other.start) && this.end.isEqualTo(other.end);
|
|
141
|
+
}
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export class TestNode extends ParameterShapeNode {
|
|
147
|
+
override display(): I18nKeys {
|
|
148
|
+
return "body.line";
|
|
149
|
+
}
|
|
150
|
+
constructor(
|
|
151
|
+
document: IDocument,
|
|
152
|
+
readonly start: XYZ,
|
|
153
|
+
readonly end: XYZ,
|
|
154
|
+
) {
|
|
155
|
+
super(document);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
protected override setProperty<K extends keyof this>(
|
|
159
|
+
property: K,
|
|
160
|
+
newValue: this[K],
|
|
161
|
+
onPropertyChanged?: ((property: K, oldValue: this[K]) => void) | undefined,
|
|
162
|
+
equals?: IEqualityComparer<this[K]> | undefined,
|
|
163
|
+
): boolean {
|
|
164
|
+
this.setPrivateValue(property, newValue);
|
|
165
|
+
return true;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
generateShape(): Result<IShape> {
|
|
169
|
+
return Result.ok(new TestEdge(this.start, this.end));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { type IDocument, Plane } from "chili-core";
|
|
5
|
+
import * as THREE from "three";
|
|
6
|
+
import { ThreeHighlighter } from "../src/threeHighlighter";
|
|
7
|
+
import { ThreeView } from "../src/threeView";
|
|
8
|
+
import type { ThreeVisualContext } from "../src/threeVisualContext";
|
|
9
|
+
|
|
10
|
+
class TestWebGLRenderer {
|
|
11
|
+
constructor(readonly domElement = document.createElement("canvas")) {}
|
|
12
|
+
|
|
13
|
+
render(scene: THREE.Object3D, camera: THREE.Camera): void {}
|
|
14
|
+
setSize(width: number, height: number, updateStyle?: boolean): void {}
|
|
15
|
+
|
|
16
|
+
getPixelRatio() {
|
|
17
|
+
return 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
getViewport() {
|
|
21
|
+
return new THREE.Vector4();
|
|
22
|
+
}
|
|
23
|
+
setViewport(v: THREE.Vector4) {}
|
|
24
|
+
|
|
25
|
+
setPixelRatio(value: number) {}
|
|
26
|
+
|
|
27
|
+
getSize(target: THREE.Vector2): THREE.Vector2 {
|
|
28
|
+
return new THREE.Vector2();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
setAnimationLoop(fn: (x: number) => void) {}
|
|
32
|
+
getRenderTarget() {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
setRenderTarget() {}
|
|
36
|
+
clear() {}
|
|
37
|
+
clearDepth() {}
|
|
38
|
+
getClearColor() {}
|
|
39
|
+
getClearAlpha() {}
|
|
40
|
+
getContext() {
|
|
41
|
+
return {
|
|
42
|
+
getExtension(str: string) {},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const container = document.createElement("canvas");
|
|
48
|
+
container.getBoundingClientRect = () => {
|
|
49
|
+
return { left: 0, top: 0, width: 100, height: 100 } as any;
|
|
50
|
+
};
|
|
51
|
+
Object.defineProperties(container, {
|
|
52
|
+
clientWidth: {
|
|
53
|
+
get() {
|
|
54
|
+
return 100;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
clientHeight: {
|
|
58
|
+
get() {
|
|
59
|
+
return 100;
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export class TestView extends ThreeView {
|
|
65
|
+
constructor(document: IDocument, content: ThreeVisualContext) {
|
|
66
|
+
super(document, "test", Plane.XY, new ThreeHighlighter(content), content);
|
|
67
|
+
this.setDom(container);
|
|
68
|
+
this.camera.position.set(0, 0, 100);
|
|
69
|
+
this.camera.lookAt(0, 0, 0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
protected override initRenderer() {
|
|
73
|
+
const render = new TestWebGLRenderer() as any;
|
|
74
|
+
render.setSize(container.clientWidth, container.clientHeight);
|
|
75
|
+
container.appendChild(render.domElement);
|
|
76
|
+
return render;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { type IVisualGeometry, Material, type ShapeNode, ShapeType, XY, XYZ } from "chili-core";
|
|
5
|
+
import { TestDocument } from "./testDocument";
|
|
6
|
+
import { TestNode } from "./testEdge";
|
|
7
|
+
import { TestView } from "./testView";
|
|
8
|
+
|
|
9
|
+
(global as any).ResizeObserver = rs.fn().mockImplementation(() => ({
|
|
10
|
+
observe: rs.fn(),
|
|
11
|
+
unobserve: rs.fn(),
|
|
12
|
+
disconnect: rs.fn(),
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
describe("three test", () => {
|
|
16
|
+
const doc = new TestDocument();
|
|
17
|
+
doc.modelManager.materials.push(new Material(doc, "test", 0x00ff00));
|
|
18
|
+
const view = new TestView(doc, doc.visual.context);
|
|
19
|
+
|
|
20
|
+
test("test view", () => {
|
|
21
|
+
expect(view.screenToCameraRect(0, 0)).toEqual(new XY(-1, 1));
|
|
22
|
+
expect(view.screenToCameraRect(100, 100)).toEqual(new XY(1, -1));
|
|
23
|
+
const world = view.screenToWorld(50, 50);
|
|
24
|
+
expect(view.worldToScreen(world)).toEqual(new XY(50, 50));
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("test context", () => {
|
|
28
|
+
const context = doc.visual.context;
|
|
29
|
+
const model = new TestNode(doc, XYZ.zero, new XYZ(100, 0, 0));
|
|
30
|
+
context.addNode([model]);
|
|
31
|
+
expect(context.getVisual(model)).not.toBeNull();
|
|
32
|
+
const mouse = view.worldToScreen(new XYZ(50, 0, 0));
|
|
33
|
+
const shapes = view.detectShapes(ShapeType.Shape, mouse.x, mouse.y);
|
|
34
|
+
expect(shapes.length).toEqual(1);
|
|
35
|
+
expect(shapes[0].shape.shapeType).toBe(ShapeType.Edge);
|
|
36
|
+
|
|
37
|
+
const shape = context.getVisual(model) as IVisualGeometry;
|
|
38
|
+
expect(shapes.at(0)?.shape).toEqual((shape?.geometryNode as ShapeNode).shape.value);
|
|
39
|
+
expect(context.getNode(shape)).toEqual(model);
|
|
40
|
+
|
|
41
|
+
context.removeNode([model]);
|
|
42
|
+
expect(view.detectShapes(ShapeType.Shape, mouse.x, mouse.y).length).toEqual(0);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Part of the Chili3d Project, under the AGPL-3.0 License.
|
|
2
|
+
// See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { IViewGizmo } from "chili-core";
|
|
5
|
+
|
|
6
|
+
export class ViewGizmo extends HTMLElement implements IViewGizmo {
|
|
7
|
+
update(): void {}
|
|
8
|
+
dispose(): void {}
|
|
9
|
+
setDom(dom: HTMLElement) {}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
customElements.define("view-gizmo", ViewGizmo);
|