@realsee/dnalogel 4.0.0-webgpu.3 → 4.0.0-webgpu.4
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/CHANGELOG.md +6 -0
- package/dist/floorplan.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +270 -35
- package/dist/index.js.map +1 -0
- package/dist/internal/{BasePlugin-CT5K8m36.js → BasePlugin-DC5m72La.js} +3 -3
- package/dist/internal/{BasePlugin-CT5K8m36.js.map → BasePlugin-DC5m72La.js.map} +1 -1
- package/dist/internal/BasePluginWithData-D_0W46_q.js +7 -0
- package/dist/internal/{BasePluginWithData-9z4tpAT4.js.map → BasePluginWithData-D_0W46_q.js.map} +1 -1
- package/dist/internal/{BetterTween-BX0aTvP1.js → BetterTween-DmptqE8m.js} +2 -2
- package/dist/internal/{BetterTween-BX0aTvP1.js.map → BetterTween-DmptqE8m.js.map} +1 -1
- package/dist/internal/{CSS3DRenderPlugin-ccSpcvwd.js → CSS3DRenderPlugin-CEatgl0m.js} +3 -3
- package/dist/internal/CSS3DRenderPlugin-CEatgl0m.js.map +1 -0
- package/dist/internal/{Controller-Csut_kcH.js → Controller-D6o4OGWJ.js} +8 -8
- package/dist/internal/{Controller-Csut_kcH.js.map → Controller-D6o4OGWJ.js.map} +1 -1
- package/dist/internal/{FiveDomEvents-3H9NvDOz.js → FiveDomEvents-BUBLFzti.js} +2 -2
- package/dist/internal/{FiveDomEvents-3H9NvDOz.js.map → FiveDomEvents-BUBLFzti.js.map} +1 -1
- package/dist/internal/FivePuppet-C6QmVY70.js +67 -0
- package/dist/internal/FivePuppet-C6QmVY70.js.map +1 -0
- package/dist/internal/{PointHelper-D565h9b_.js → PointHelper-DIhgdjY2.js} +48 -48
- package/dist/internal/{PointHelper-D565h9b_.js.map → PointHelper-DIhgdjY2.js.map} +1 -1
- package/dist/internal/{Polygon-CBGvYUfJ.js → Polygon-D3xIL1Pl.js} +30 -30
- package/dist/internal/{Polygon-CBGvYUfJ.js.map → Polygon-D3xIL1Pl.js.map} +1 -1
- package/dist/internal/{Prism-Dm5ESkgg.js → Prism-CJlyAEAU.js} +13 -13
- package/dist/internal/{Prism-Dm5ESkgg.js.map → Prism-CJlyAEAU.js.map} +1 -1
- package/dist/internal/{Rectangle-D-zkDycu.js → Rectangle-BpL9lNKU.js} +118 -129
- package/dist/internal/Rectangle-BpL9lNKU.js.map +1 -0
- package/dist/internal/{Work-DF8j5GnL.js → Work-BE4AgdwH.js} +9 -9
- package/dist/internal/{Work-DF8j5GnL.js.map → Work-BE4AgdwH.js.map} +1 -1
- package/dist/internal/{animationFrame-XGKHIeQK.js → animationFrame-CacKXN8l.js} +14 -3
- package/dist/internal/animationFrame-CacKXN8l.js.map +1 -0
- package/dist/internal/{area-maker-Bd9l2pIp.js → area-maker-Bnhx4SkH.js} +4 -4
- package/dist/internal/{area-maker-Bd9l2pIp.js.map → area-maker-Bnhx4SkH.js.map} +1 -1
- package/dist/internal/{boundingBox-DvCor5Hd.js → boundingBox-CIqXgNXW.js} +2 -2
- package/dist/internal/{boundingBox-DvCor5Hd.js.map → boundingBox-CIqXgNXW.js.map} +1 -1
- package/dist/internal/{camera-movement-CwI7UqUk.js → camera-movement-C1pwfMk_.js} +2 -2
- package/dist/internal/camera-movement-C1pwfMk_.js.map +1 -0
- package/dist/internal/{changeMode-BVGYCoqu.js → changeMode-D_I2AOjH.js} +2 -2
- package/dist/internal/{changeMode-BVGYCoqu.js.map → changeMode-D_I2AOjH.js.map} +1 -1
- package/dist/internal/{controller-BWkZT0l1.js → controller-DIDtFrBE.js} +1991 -2050
- package/dist/internal/controller-DIDtFrBE.js.map +1 -0
- package/dist/internal/{cruise-C3F0eNQ-.js → cruise-B50Tcq66.js} +2 -2
- package/dist/internal/{cruise-C3F0eNQ-.js.map → cruise-B50Tcq66.js.map} +1 -1
- package/dist/internal/{current-pano-image-DKUWluR-.js → current-pano-image-BCFr6njt.js} +4 -4
- package/dist/internal/{current-pano-image-DKUWluR-.js.map → current-pano-image-BCFr6njt.js.map} +1 -1
- package/dist/internal/{defaultUrls-CjKkS9k9.js → defaultUrls-CfMtGzqM.js} +14 -3
- package/dist/internal/defaultUrls-CfMtGzqM.js.map +1 -0
- package/dist/internal/{fire-scene-CczaBz2_.js → fire-scene-BzZGvyh_.js} +9 -4
- package/dist/internal/fire-scene-BzZGvyh_.js.map +1 -0
- package/dist/internal/{fiveModelLoad-mg-TnpnM.js → fiveModelLoad-BUIBYxzp.js} +2 -2
- package/dist/internal/{fiveModelLoad-mg-TnpnM.js.map → fiveModelLoad-BUIBYxzp.js.map} +1 -1
- package/dist/internal/{floorplan-KWlIsTvO.js → floorplan-C8BGw87S.js} +5 -5
- package/dist/internal/{floorplan-KWlIsTvO.js.map → floorplan-C8BGw87S.js.map} +1 -1
- package/dist/internal/{generatePolygonGeometry-B_5JFq8y.js → generatePolygonGeometry-BOnzdCaG.js} +181 -178
- package/dist/internal/generatePolygonGeometry-BOnzdCaG.js.map +1 -0
- package/dist/internal/{lookObject-wesf8xt6.js → lookObject-DuRab5wf.js} +2 -2
- package/dist/internal/{lookObject-wesf8xt6.js.map → lookObject-DuRab5wf.js.map} +1 -1
- package/dist/internal/{measure-BX6boAC7.js → measure-B4jFwdQ6.js} +5 -5
- package/dist/internal/{measure-BX6boAC7.js.map → measure-B4jFwdQ6.js.map} +1 -1
- package/dist/internal/{model-chassis-compass-InVNmOAQ.js → model-chassis-compass-C6NTVMLo.js} +2 -2
- package/dist/internal/{model-chassis-compass-InVNmOAQ.js.map → model-chassis-compass-C6NTVMLo.js.map} +1 -1
- package/dist/internal/{model-entry-door-guide-wZbyY77a.js → model-entry-door-guide-DnGTLY2s.js} +2 -2
- package/dist/internal/{model-entry-door-guide-wZbyY77a.js.map → model-entry-door-guide-DnGTLY2s.js.map} +1 -1
- package/dist/internal/{model-maker-uO8xlTuO.js → model-maker-B1mnDdKY.js} +15 -15
- package/dist/internal/{model-maker-uO8xlTuO.js.map → model-maker-B1mnDdKY.js.map} +1 -1
- package/dist/internal/{model-tv-video-DzXb2JRf.js → model-tv-video-BP-7HoDC.js} +2 -2
- package/dist/internal/{model-tv-video-DzXb2JRf.js.map → model-tv-video-BP-7HoDC.js.map} +1 -1
- package/dist/internal/{model-view-CBeeMM98.js → model-view-BWUU0-uq.js} +2 -2
- package/dist/internal/{model-view-CBeeMM98.js.map → model-view-BWUU0-uq.js.map} +1 -1
- package/dist/internal/object3d-helper-CbRRhnLV.js +7 -0
- package/dist/internal/{object3d-helper-DDYsVPN6.js.map → object3d-helper-CbRRhnLV.js.map} +1 -1
- package/dist/internal/{pano-compass-jSr629BP.js → pano-compass-BRTM0dCc.js} +7 -7
- package/dist/internal/{pano-compass-jSr629BP.js.map → pano-compass-BRTM0dCc.js.map} +1 -1
- package/dist/internal/{pano-door-label-DKoYIKLa.js → pano-door-label-BLjYGZrr.js} +3 -3
- package/dist/internal/{pano-door-label-DKoYIKLa.js.map → pano-door-label-BLjYGZrr.js.map} +1 -1
- package/dist/internal/{pano-measure-DW9mdx1O.js → pano-measure-BIgCWkVJ.js} +14 -14
- package/dist/internal/{pano-measure-DW9mdx1O.js.map → pano-measure-BIgCWkVJ.js.map} +1 -1
- package/dist/internal/{pano-ruler-pro-D7q0Ob21.js → pano-ruler-pro-D9yTbHJz.js} +2 -2
- package/dist/internal/{pano-ruler-pro-D7q0Ob21.js.map → pano-ruler-pro-D9yTbHJz.js.map} +1 -1
- package/dist/internal/{pano-spatial-tag-D0qn-__S.js → pano-spatial-tag-B7Gxn3BS.js} +3 -3
- package/dist/internal/{pano-spatial-tag-D0qn-__S.js.map → pano-spatial-tag-B7Gxn3BS.js.map} +1 -1
- package/dist/internal/{pano-tag-BW5MXXws.js → pano-tag-Bchz-jED.js} +2 -2
- package/dist/internal/{pano-tag-BW5MXXws.js.map → pano-tag-Bchz-jED.js.map} +1 -1
- package/dist/internal/{pano-video-Bmud_CAn.js → pano-video-BufYQMqo.js} +3 -3
- package/dist/internal/{pano-video-Bmud_CAn.js.map → pano-video-BufYQMqo.js.map} +1 -1
- package/dist/internal/{pipeline-DDqgb1gw.js → pipeline-t_3IMXKB.js} +4 -4
- package/dist/internal/{pipeline-DDqgb1gw.js.map → pipeline-t_3IMXKB.js.map} +1 -1
- package/dist/internal/{sculpt-BNkLJR6p.js → sculpt-BCK4PMwL.js} +64 -63
- package/dist/internal/{sculpt-BNkLJR6p.js.map → sculpt-BCK4PMwL.js.map} +1 -1
- package/dist/internal/tagPosition-DA9YguT8.js +176 -0
- package/dist/internal/tagPosition-DA9YguT8.js.map +1 -0
- package/dist/internal/withResolvers-DVr4bnnk.js +15 -0
- package/dist/internal/withResolvers-DVr4bnnk.js.map +1 -0
- package/dist/plugins/area-maker.js +1 -1
- package/dist/plugins/camera-movement.js +1 -1
- package/dist/plugins/cruise.js +2 -2
- package/dist/plugins/css3d-render.js +1 -1
- package/dist/plugins/current-pano-image.js +1 -1
- package/dist/plugins/digital-performance.d.ts +1 -1
- package/dist/plugins/digital-performance.js +1 -1
- package/dist/plugins/fire-scene.d.ts +1 -1
- package/dist/plugins/fire-scene.js +1 -1
- package/dist/plugins/guide-line.js +1 -1
- package/dist/plugins/measure.js +1 -1
- package/dist/plugins/model-chassis-compass.js +1 -1
- package/dist/plugins/model-entry-door-guide.js +1 -1
- package/dist/plugins/model-maker.d.ts +1 -1
- package/dist/plugins/model-maker.js +1 -1
- package/dist/plugins/model-tv-video.js +1 -1
- package/dist/plugins/model-view.js +1 -1
- package/dist/plugins/object3d-helper.d.ts +1 -1
- package/dist/plugins/object3d-helper.js +3 -1
- package/dist/plugins/pano-compass.js +1 -1
- package/dist/plugins/pano-door-label.js +1 -1
- package/dist/plugins/pano-measure.js +1 -1
- package/dist/plugins/pano-ruler-pro.js +1 -1
- package/dist/plugins/pano-spatial-tag.js +1 -1
- package/dist/plugins/pano-tag.d.ts +1 -1
- package/dist/plugins/pano-tag.js +4 -1
- package/dist/plugins/pano-video.js +1 -1
- package/dist/plugins/pipeline.js +1 -1
- package/dist/plugins/sculpt.d.ts +1 -1
- package/dist/plugins/sculpt.js +7 -1
- package/dist/types/public/index.d.ts +2 -0
- package/dist/types/public/plugins/digital-performance.d.ts +1 -0
- package/dist/types/public/plugins/fire-scene.d.ts +1 -0
- package/dist/types/public/plugins/model-maker.d.ts +1 -0
- package/dist/types/public/plugins/object3d-helper.d.ts +1 -0
- package/dist/types/public/plugins/pano-tag.d.ts +2 -0
- package/dist/types/public/plugins/sculpt.d.ts +8 -0
- package/dist/types/public/utils.d.ts +5 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +16 -50
- package/package.json +1 -1
- package/dist/internal/BasePluginWithData-9z4tpAT4.js +0 -7
- package/dist/internal/CSS3DRenderPlugin-ccSpcvwd.js.map +0 -1
- package/dist/internal/Rectangle-D-zkDycu.js.map +0 -1
- package/dist/internal/animationFrame-XGKHIeQK.js.map +0 -1
- package/dist/internal/blink-DD_0mH-m.js +0 -113
- package/dist/internal/blink-DD_0mH-m.js.map +0 -1
- package/dist/internal/camera-movement-CwI7UqUk.js.map +0 -1
- package/dist/internal/controller-BWkZT0l1.js.map +0 -1
- package/dist/internal/defaultUrls-CjKkS9k9.js.map +0 -1
- package/dist/internal/fire-scene-CczaBz2_.js.map +0 -1
- package/dist/internal/generatePolygonGeometry-B_5JFq8y.js.map +0 -1
- package/dist/internal/object3d-helper-DDYsVPN6.js +0 -7
- package/dist/utils.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sculpt-BNkLJR6p.js","names":["Subscribe","getIntersectByRaycaster","bindFiveOwner","LineMesh","IObject3D","getNormal","notNil","rayOnLine","AreaMesh","LineEditorAbstract","createPolygon","BaseEditor","bindObjectModules","Box","vector3ToArray","SculptModules","Polygon","LineEditor","Rectangle","BaseEditorWithObjectHelper","PointMesh","ColoredMesh","LineWithDotsMesh","PolylineWithDotsMesh","PolylineMesh","PrismMesh","recurveFindObject","THREE","PolylineEditor","originObject","intersects","event","point","Polyline","BaseObject","modules","data","config","anyPositionToVector3","polyLineMesh","params","createPolyline","container","withResolvers","limit","previewLine","verticalLine","pointSelector","points","previewPoint","planeHelper","lastIntersection","undoStack","canUndo","canRedo","undo","onPreview","redo","onSelect","intersection","clearProview","lastPoint","reject","promise","PointEditor","Point","style","createPoint","pointMesh","selectEnd","cancel","resolve","PrismMeshEditor","prismMesh","bottomPosition","topPosition","offset","center","bottomCenter","topCenter","scalePosition","id","offsetToBottom","intersectPoint","basePosition","offsetToTop","v","Prism","createPrism","bottomPolygon","lineHelper","normal","startPoint","endPoint","pointOnLineHelper","CircleMeshEditor","circleMesh","radiusToSegments","radius","CircleMesh","n","segments","CircleWithEdgeMesh","position","edgePoints","index","Circle","child","createCircle","plane","CylinderMesh","quaternion","CylinderMeshEditor","cylinderMesh","getInfo","info","Cylinder","createCylinder","pointOnPlane","vector","forReverseEach","i","array","Line","lineMesh","createLine","clearPreview","Sculpt","item","five","theme","element","o","origDomEvent","types","items","dataWithdefaultStyle","d","object","object3DHelper","selectedItem","createParams","ItemClass","error","SculptPlugin","options","isPrismMesh"],"sources":["../../src/Sculpt/Objects/Polyline/Editor.ts","../../src/Sculpt/Objects/Polyline/index.ts","../../src/Sculpt/Objects/Point/Editor.ts","../../src/Sculpt/Objects/Point/index.ts","../../src/Sculpt/Editors/PrismMeshEditor.ts","../../src/Sculpt/Objects/Prism/index.ts","../../src/Sculpt/Editors/CircleMeshEditor.ts","../../src/Sculpt/utils/radiusToSegments.ts","../../src/Sculpt/Meshes/Circle.ts","../../src/Sculpt/Meshes/CircleWithEdge.ts","../../src/Sculpt/Objects/Circle/index.ts","../../src/Sculpt/Meshes/Cylinder.ts","../../src/Sculpt/Editors/CylinderMeshEditor.ts","../../src/Sculpt/Objects/Cylinder/index.ts","../../src/shared-utils/forReverseEach.ts","../../src/Sculpt/Objects/Line/index.ts","../../src/Sculpt/index.ts","../../src/public/plugins/sculpt.ts"],"sourcesContent":["import type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents'\nimport type { Polyline } from '.'\nimport { getIntersectByRaycaster } from '../../../shared-utils/five/getPosition'\nimport { LineEditorAbstract } from '../Line/Editor'\n\nexport class PolylineEditor extends LineEditorAbstract<Polyline> {\n public get points() {\n return this.originObject.polyLineMesh.points\n }\n\n public constructor(originObject: Polyline) {\n super(originObject)\n }\n\n protected onDrag = (event: FiveDomEvent) => {\n if (!this.draggingPoints || this.draggingPoints.length === 0) return\n const intersects = getIntersectByRaycaster(this.modules.five, event.raycaster)\n\n this.draggingPoints.forEach((point) => point.position.copy(intersects.point))\n this.originObject.polyLineMesh.setPoints(this.pointMeshes.map((point) => point.position))\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport type { Color } from '../../../Object3DHelperPlugin'\nimport { PolylineMesh, PolylineWithDotsMesh, type PolylineData, type PolylineStyle } from '../../Meshes/Polyline'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { PolylineEditor } from './Editor'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport type { CreateLimitConfig } from '../../typings/style'\nimport { withResolvers } from '../../../shared-utils/promise/withResolvers'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface PolylineImportData extends BaseImportData, PolylineData {\n type: LiteralString<'Polyline'>\n style?: Partial<PolylineStyle>\n}\n\nexport class Polyline extends BaseObject<PolylineImportData> {\n public readonly type = 'Polyline'\n public polyLineMesh: PolylineWithDotsMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PolylineEditor(this)\n }\n return this._editor\n }\n\n public _editor: PolylineEditor\n\n private creatingObject?: ReturnType<typeof createPolyline>\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.polyLineMesh.points)),\n style: {\n lineColor: new THREE.Color(this.polyLineMesh.lineColor).getHex(),\n lineWidth: this.polyLineMesh.lineWidth,\n dashed: this.polyLineMesh.dashed,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: PolylineImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.polyLineMesh = new PolylineWithDotsMesh({ ...data.style, ...data })\n this.add(this.polyLineMesh)\n }\n }\n\n public setData(data: Partial<PolylineImportData>): void {\n if (data.points) this.polyLineMesh.setPoints(this.applyObjectReversalMatrixWorld(data.points.map(anyPositionToVector3)))\n this.polyLineMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.polyLineMesh?.highlight()\n }\n\n public unhighlight() {\n this.polyLineMesh?.unhighlight()\n }\n\n public canUndo() {\n return this.creatingObject?.canUndo() ?? false\n }\n\n public canRedo() {\n return this.creatingObject?.canRedo() ?? false\n }\n\n public undo() {\n this.creatingObject?.undo()\n }\n\n public redo() {\n this.creatingObject?.redo()\n }\n\n public async create(params?: Partial<PolylineStyle & CreateLimitConfig>) {\n this.removeChildren()\n\n const polyLineMesh = new PolylineWithDotsMesh(params)\n this.polyLineMesh = polyLineMesh\n this.add(this.polyLineMesh)\n\n this.creatingObject = createPolyline(polyLineMesh, this.pointSelector, params)\n\n await this.creatingObject.finished\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\n/**\n * @description 绘制折线\n * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`\n */\nexport function createPolyline(polyLineMesh: PolylineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>) {\n const container = polyLineMesh.parent\n if (!container) return\n\n const { promise, resolve, reject } = withResolvers<void>()\n\n const limit = config?.limit ?? 'none'\n\n const previewLine = new PolylineMesh(polyLineMesh.style)\n container.add(previewLine)\n\n // 垂直辅助线\n const verticalLine = new PolylineMesh({ ...polyLineMesh.style, dashed: true, lengthEnable: false })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n const points: THREE.Vector3[] = []\n // 实时的预览点\n let previewPoint: THREE.Vector3\n let planeHelper: THREE.Plane\n\n let lastIntersection: PointIntersection\n\n const undoStack: THREE.Vector3[] = []\n\n const canUndo = () => points.length > 0\n\n const canRedo = () => undoStack.length > 0\n\n const undo = () => {\n if (!canUndo()) return\n undoStack.push(points.pop())\n polyLineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n const redo = () => {\n if (!canRedo()) return\n points.push(undoStack.pop())\n polyLineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n undoStack.length = 0 // 一旦有了新的动作,就要清空撤销栈\n const point = points.length === 0 ? intersection.point : previewPoint.clone()\n points.push(point)\n polyLineMesh.setPoints(points)\n }\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n const clearProview = () => {\n previewLine.setPoints([])\n verticalLine.setPoints([])\n previewPoint = null\n }\n\n if (!intersection) return clearProview()\n lastIntersection = intersection\n if (!points?.length) return clearProview()\n\n const lastPoint = points.at(-1).clone()\n\n if (limit === 'none') {\n // 自由选点\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else if (limit === 'xoz') {\n // 水平面选点\n planeHelper = planeHelper ?? new THREE.Plane().setFromNormalAndCoplanarPoint(new THREE.Vector3(0, 1, 0), points[0])\n pointSelector.plane = planeHelper\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n } else if (limit === 'y') {\n // 垂直面选点\n if (points.length === 1) {\n // 一个点时无法确定垂直面\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else {\n // 2个点以上时,确定垂直面\n planeHelper =\n planeHelper ?? new THREE.Plane().setFromCoplanarPoints(points[0], points[1], new THREE.Vector3(0, 1, 0).add(points[0]))\n pointSelector.plane = planeHelper\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n }\n }\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.plane = null\n container.remove(previewLine)\n container.remove(verticalLine)\n if (points.length < 2) {\n container.remove(polyLineMesh)\n return reject(new Error('Cancelled'))\n } else resolve()\n })\n\n return {\n finished: promise,\n canUndo,\n canRedo,\n undo,\n redo,\n }\n}\n","import { BaseEditor } from '../Base/Editor'\nimport type { Point } from '.'\nimport type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents'\nimport { getIntersectByRaycaster } from '../../../shared-utils/five/getPosition'\n\nexport class PointEditor extends BaseEditor<Point> {\n public constructor(originObject: Point) {\n super(originObject)\n }\n\n public enable() {\n super.enable()\n this.originObject.draggable = true\n this.originObject.on('drag', this.onDrag)\n }\n\n public disable() {\n super.disable()\n this.originObject.draggable = false\n this.originObject.off('drag', this.onDrag)\n }\n\n private onDrag = (event: FiveDomEvent) => {\n const intersects = getIntersectByRaycaster(this.modules.five, event.raycaster)\n this.originObject.pointMesh?.position.copy(intersects.point)\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { PointMesh, type PointData, type PointStyle } from '../../Meshes/Point'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport { PointEditor } from './Editor'\nimport type { PointIntersection, PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface PointImportData extends BaseImportData, PointData {\n type: LiteralString<'Point'>\n style?: Partial<PointStyle>\n}\n\nexport class Point extends BaseObject<PointImportData> {\n public readonly type = 'Point'\n\n public pointMesh: PointMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PointEditor(this)\n }\n return this._editor\n }\n\n public _editor: PointEditor\n\n public get data() {\n return {\n ...this.baseData,\n point: vector3ToArray(this.applyObjectMatrixWorld(this.pointMesh.position)),\n style: {\n color: this.pointMesh.color.getHex(),\n size: this.pointMesh.size,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: PointImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.pointMesh = new PointMesh({ ...data.style, ...data })\n this.add(this.pointMesh)\n }\n }\n\n public setData(data: Partial<PointImportData>): void {\n if (data.point) this.pointMesh.position.copy(anyPositionToVector3(data.point))\n this.pointMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.pointMesh?.highlight()\n }\n\n public unhighlight() {\n this.pointMesh?.unhighlight()\n }\n\n /**\n * @description: 设置颜色\n * @param {Color} style.color\n * @param {number} style.size\n */\n public setStyle(style: Partial<PointStyle>) {\n this.pointMesh.setStyle(style)\n }\n\n /**\n * @description: 创建点\n */\n public async create(params?: Partial<PointStyle>) {\n if (this.pointMesh) {\n this.remove(this.pointMesh)\n }\n\n this.add((this.pointMesh = new PointMesh(params)))\n\n await createPoint(this.pointMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport function createPoint(pointMesh: PointMesh, pointSelector: PointSelector) {\n return new Promise<void>((resolve, reject) => {\n pointSelector.enable()\n\n pointMesh.visible = false\n\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection) return\n pointMesh.visible = true\n pointMesh.position.copy(intersection.point)\n }\n\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n pointMesh.visible = true\n pointMesh.position.copy(intersection.point)\n selectEnd()\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('disable', cancel)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.disable()\n resolve()\n }\n\n const cancel = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('disable', cancel)\n pointSelector.off('intersectionUpdate', onPreview)\n pointMesh.removeFromParent()\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n pointSelector.once('select', onSelect)\n })\n}\n","import { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\nimport type { Prism } from '../Objects/Prism'\nimport * as THREE from 'three/webgpu'\nimport type { PrismMesh } from '../Meshes/Prism'\n\nexport class PrismMeshEditor extends BaseEditorWithObjectHelper<PrismMesh> {\n public constructor(prismMesh: PrismMesh) {\n super(prismMesh, () => {\n return {\n positionFrom: () => prismMesh.worldCenter,\n yAxis: () => prismMesh.up,\n scaleHelper: {\n enable: true,\n positions: () => {\n const bottomPosition = prismMesh.bottomPositions\n const topPosition = prismMesh.topPosition\n const offset = new THREE.Vector3().subVectors(topPosition, bottomPosition[0])\n\n const center = prismMesh.geometryInfo.center\n\n const bottomCenter = center.clone().sub(offset.clone().divideScalar(2))\n const topCenter = center.clone().add(offset.clone().divideScalar(2))\n\n return [\n {\n id: 'top',\n handlePosition: topCenter,\n basePosition: bottomCenter,\n },\n {\n id: 'bottom',\n handlePosition: bottomCenter,\n basePosition: topCenter,\n },\n ]\n },\n scaleCallback: (params) => {\n const { intersectPoint, scalePosition } = params\n const { id, basePosition, handlePosition } = scalePosition\n\n if (id === 'top') {\n const offsetToBottom = intersectPoint.clone().sub(basePosition)\n prismMesh.setPoints({ heightPoint: prismMesh.bottomPositions[0].clone().add(offsetToBottom) })\n } else if (id === 'bottom') {\n const offsetToTop = intersectPoint.clone().sub(basePosition)\n\n prismMesh.setPoints({\n points: prismMesh.topPositions.map((v) => v.clone().add(offsetToTop)),\n })\n }\n },\n },\n }\n })\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { createPolygon } from '../Polygon'\nimport { PrismMesh, type PrismData, type PrismStyle } from '../../Meshes/Prism'\nimport { LineMesh } from '../../Meshes/Line'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport { PrismMeshEditor } from '../../Editors/PrismMeshEditor'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport getNormal from '../../../shared-utils/three/getNormal'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { AreaMesh } from '../../Meshes/Area'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\nimport type { CreateLimitConfig, PolygonDrawConfig } from '../../typings/style'\n\nexport interface PrismImportData extends BaseImportData, PrismData {\n type: LiteralString<'Prism'>\n style?: Partial<PrismStyle>\n}\n\nexport type PrismCreateConfig = Partial<PrismStyle & CreateLimitConfig & PolygonDrawConfig> & {\n onPointPlaced?: (points: THREE.Vector3[]) => void\n onUndo?: () => void\n onRedo?: () => void\n /**\n * @description 检测到自相交时的回调\n * @param point 尝试添加但被拒绝的点坐标\n */\n __onSelfIntersect?: (point: THREE.Vector3) => void\n /**\n * @description 将要添加的下一个点\n */\n __onWillAddPoint?: (point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description 检测是否自相交,如果自交,禁止添加下一个点\n * @default false\n */\n experimental_self_intersect_check?: boolean\n /**\n * 最多允许能添加的点数\n */\n experimental_max_point_count?: number\n}\n\nexport class Prism extends BaseObject<PrismImportData> {\n public readonly type = 'Prism'\n public prismMesh: PrismMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PrismMeshEditor(this.prismMesh)\n }\n return this._editor\n }\n\n public _editor: PrismMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.prismMesh.bottomPositions, this.prismMesh)),\n heightPoint: vector3ToArray(this.applyObjectMatrixWorld(this.prismMesh.topPosition, this.prismMesh)),\n style: {\n color: this.prismMesh.color.getHex(),\n lineWidth: this.prismMesh.lineWidth,\n lineColor: this.prismMesh.lineColor.getHex(),\n },\n } as const\n }\n\n public constructor(modules: SculptModules, data?: PrismImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.prismMesh = new PrismMesh({ ...data.style, ...data })\n this.add(this.prismMesh)\n }\n }\n\n public setData(data: Partial<PrismImportData>): void {\n this.prismMesh.setPoints({\n points: data.points ? this.applyObjectReversalMatrixWorld(data.points.map(anyPositionToVector3), this.prismMesh) : undefined,\n heightPoint: data.heightPoint\n ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.heightPoint), this.prismMesh)\n : undefined,\n })\n this.prismMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.prismMesh?.highlight()\n }\n\n public unhighlight() {\n this.prismMesh?.unhighlight()\n }\n\n public async create(params?: PrismCreateConfig) {\n this.prismMesh = new PrismMesh(params)\n this.add(this.prismMesh)\n\n await createPrism(this.prismMesh, this.pointSelector, params)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport async function createPrism(prismMesh: PrismMesh, pointSelector: PointSelector, config?: PrismCreateConfig) {\n const container = prismMesh.parent\n\n const bottomPolygon = new AreaMesh(prismMesh.style)\n container.add(bottomPolygon)\n await createPolygon(bottomPolygon, pointSelector, config).finished\n container.remove(bottomPolygon)\n\n prismMesh.setPoints({ points: bottomPolygon.points })\n\n const lineHelper = new LineMesh()\n lineHelper.name = 'LineHelper'\n container.add(lineHelper)\n\n const lastPoint = bottomPolygon.points.at(-1)\n const normal = getNormal(bottomPolygon.points)\n const startPoint = lastPoint.clone().add(normal.clone().multiplyScalar(100))\n const endPoint = lastPoint.clone().sub(normal.clone().multiplyScalar(100))\n lineHelper.setPoints([startPoint, endPoint])\n\n pointSelector.enable()\n\n return new Promise<void>((resolve, reject) => {\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n // 触发 onPointPlaced 回调\n config?.onPointPlaced?.(prismMesh.bottomPositions)\n selectEnd()\n resolve()\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection?.raycaster) return\n\n const pointOnLineHelper = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(startPoint, endPoint),\n })\n\n if (pointOnLineHelper) {\n prismMesh.setPoints({ heightPoint: pointOnLineHelper })\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n container.remove(lineHelper)\n pointSelector.disable()\n }\n\n const cancel = () => {\n selectEnd()\n container.remove(prismMesh)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","import { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\nimport type { CircleMesh } from '../Meshes/Circle'\n\nexport class CircleMeshEditor extends BaseEditorWithObjectHelper<CircleMesh> {\n public constructor(circleMesh: CircleMesh) {\n super(circleMesh, () => ({ yAxis: () => circleMesh.normal }))\n }\n}\n","export default function radiusToSegments(radius: number) {\n const segments = Math.max(32, Math.min(128, Math.floor(radius * 40)))\n return segments\n}\n","import * as THREE from 'three/webgpu'\nimport { type OcclusionStyle } from '../typings/style'\nimport radiusToSegments from '../utils/radiusToSegments'\nimport ColoredMesh, { type ColoredMeshStyle } from '../utils/three/ColoredMesh'\nimport { anyPositionToVector3, type AnyPosition } from '../../shared-utils/positionToVector3'\nimport { notNil } from '../../shared-utils'\n\nexport type CircleStyle = ColoredMeshStyle & OcclusionStyle\n\nexport type CircleData = {\n center: AnyPosition\n normal: AnyPosition\n radius: number\n}\n\ntype Params = Partial<CircleStyle & CircleData>\n\nexport class CircleMesh extends ColoredMesh {\n public get center() {\n return this.position.clone()\n }\n\n public get normal() {\n // TODO:改为实时计算\n return this._normal\n }\n\n private set normal(n: THREE.Vector3) {\n this._normal = n\n }\n\n public get radius() {\n return this.meshFont.geometry?.parameters?.radius\n }\n\n public declare meshFont: THREE.Mesh<THREE.CircleGeometry, THREE.MeshBasicMaterial>\n\n private _normal: THREE.Vector3\n private _center: THREE.Vector3\n private _radius: number\n\n public constructor(params?: Params) {\n super(params)\n\n if (params?.center && params?.normal && params?.radius) {\n this.setPoints(params as CircleData)\n }\n }\n\n public setPoints(params: Partial<CircleData>) {\n this._center = anyPositionToVector3(params.center) ?? this._center\n this._normal = (anyPositionToVector3(params.normal) ?? this._normal).normalize()\n this._radius = params.radius ?? this._radius\n\n if (notNil(this._radius) && this._radius !== this.radius) {\n const segments = radiusToSegments(this._radius)\n this.geometry = new THREE.CircleGeometry(this._radius, segments)\n }\n\n if (this._center) this.position.copy(this._center)\n\n if (this._normal) {\n // FIXME: 这个lookat是世界的lookat,不是本地lookat\n this.lookAt(this._normal.clone().add(this._center))\n this.normal = this._normal.clone()\n }\n\n this.needsRender = true\n }\n}\n","import * as THREE from 'three/webgpu'\nimport type { LineStyle } from '../typings/style'\nimport { CircleMesh, type CircleData, type CircleStyle } from './Circle'\nimport { LineMesh } from './Line'\n\nexport type CircleWithEdgeMeshStyle = CircleStyle & LineStyle\n\nexport class CircleWithEdgeMesh extends CircleMesh {\n private edgeLine: LineMesh\n\n public constructor(params?: Partial<CircleWithEdgeMeshStyle & CircleData>) {\n const { normal, radius, center, ...style } = params ?? {}\n super(style)\n\n this.edgeLine = new LineMesh(style)\n this.add(this.edgeLine)\n if (normal && radius && center) {\n this.setPoints({ normal, radius, center })\n }\n }\n\n public setPoints(...params: Parameters<InstanceType<typeof CircleMesh>['setPoints']>): void {\n super.setPoints(...params)\n // 边框所有点\n const position = this.meshFont.geometry.getAttribute('position')\n const edgePoints = Array.from({ length: Math.max(0, position.count - 1) }, (_, index) =>\n new THREE.Vector3().fromBufferAttribute(position, index + 1),\n )\n if (edgePoints.length > 0) this.edgeLine.setPoints([...edgePoints, edgePoints[0]])\n }\n\n public setStyle(style: Partial<CircleWithEdgeMeshStyle>) {\n super.setStyle(style)\n this.edgeLine.setStyle(style)\n }\n\n public highlight(): void {\n super.highlight()\n this.edgeLine.highlight()\n }\n\n public unhighlight(): void {\n super.unhighlight()\n this.edgeLine.unhighlight()\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { PolylineMesh } from '../../Meshes/Polyline'\n\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport { CircleMeshEditor } from '../../Editors/CircleMeshEditor'\nimport type { CircleData, CircleMesh } from '../../Meshes/Circle'\nimport { CircleWithEdgeMesh, type CircleWithEdgeMeshStyle } from '../../Meshes/CircleWithEdge'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface CircleImportData extends BaseImportData, CircleData {\n type: LiteralString<'Circle'>\n style?: Partial<CircleWithEdgeMeshStyle>\n}\n\nexport class Circle extends BaseObject<CircleImportData> {\n public readonly type = 'Circle'\n public circleMesh: CircleWithEdgeMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new CircleMeshEditor(this.circleMesh)\n }\n return this._editor\n }\n\n public _editor: CircleMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n center: vector3ToArray(this.applyObjectMatrixWorld(this.circleMesh.center, this.circleMesh)),\n normal: vector3ToArray(this.circleMesh.normal.clone().applyQuaternion(this.circleMesh.quaternion)),\n radius: this.circleMesh.radius,\n style: {\n color: this.circleMesh.color.getHex(),\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: CircleImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.circleMesh = new CircleWithEdgeMesh({ ...data.style, ...data })\n this.add(this.circleMesh)\n }\n }\n\n public setData(data: Partial<CircleImportData>): void {\n this.circleMesh.setPoints({\n center: data.center ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.center), this.circleMesh) : undefined,\n normal: data.normal ? anyPositionToVector3(data.normal) : undefined,\n radius: data.radius,\n })\n this.circleMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.circleMesh?.highlight()\n }\n\n public unhighlight() {\n this.circleMesh?.unhighlight()\n }\n\n public async create(params?: Partial<CircleWithEdgeMeshStyle>) {\n this.children.forEach((child) => {\n if (child.parent === this) {\n this.remove(child)\n }\n })\n this.children.length = 0\n\n const circleMesh = new CircleWithEdgeMesh(params)\n this.circleMesh = circleMesh\n this.add(this.circleMesh)\n\n await createCircle(this.circleMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport function createCircle(circleMesh: CircleMesh, pointSelector: PointSelector) {\n return new Promise<void>((resolve, reject) => {\n const container = circleMesh.parent\n if (!container) {\n reject(new Error('No container'))\n return\n }\n\n const verticalLine = new PolylineMesh({ dashed: true })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n let center: { point: THREE.Vector3; normal: THREE.Vector3 }\n let previewPoint: THREE.Vector3\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n // 第一次打点确认圆心\n if (!center) {\n center = {\n point: intersection.point,\n normal: intersection.face.normal,\n }\n return\n }\n if (center && previewPoint) {\n // 第二次打点即为绘制完成\n selectEnd()\n resolve()\n }\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection) return\n if (!center) return\n const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(center.normal, center.point)\n previewPoint = intersection.raycaster.ray.intersectPlane(plane, new THREE.Vector3())\n // previewPoint 可能为 null\n if (previewPoint) {\n const radius = center.point.distanceTo(previewPoint)\n circleMesh.setPoints({ center: center.point, normal: center.normal, radius })\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n pointSelector.disable()\n container?.remove(verticalLine)\n }\n\n const cancel = () => {\n selectEnd()\n container?.remove(circleMesh, verticalLine)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","import { IObject3D } from '../../shared-utils/three/IObject3D'\nimport * as THREE from 'three/webgpu'\nimport { notNil } from '../../shared-utils'\nimport { CircleWithEdgeMesh, type CircleWithEdgeMeshStyle } from './CircleWithEdge'\nimport radiusToSegments from '../utils/radiusToSegments'\nimport ColoredMesh from '../utils/three/ColoredMesh'\nimport { anyPositionToVector3, type AnyPosition } from '../../shared-utils/positionToVector3'\nimport { DEFAULT_HIGHLIGHT_OPACITY } from '../typings/style'\n\nexport type CylinderStyle = CircleWithEdgeMeshStyle\n\nexport interface CylinderData {\n bottomCenter: AnyPosition\n topCenter: AnyPosition\n radius: number\n}\n\ntype Params = Partial<CylinderStyle & CylinderData>\n\nexport class CylinderMesh extends IObject3D {\n public get bottomCenter() {\n return this.bottomCircle.center\n }\n\n public get topCenter() {\n return this.topCircle.center\n }\n\n public get normal() {\n return this.bottomCircle.normal\n }\n\n public get radius() {\n return this.bottomCircle.radius\n }\n\n public get color() {\n return this.bottomCircle.color\n }\n\n public bottomCircle: CircleWithEdgeMesh\n public topCircle: CircleWithEdgeMesh\n protected edgeMesh: ColoredMesh\n\n private highlighted = false\n\n private params: Params\n\n private _topCenter: THREE.Vector3\n private _bottomCenter: THREE.Vector3\n private _radius: number\n\n public constructor(params?: Params) {\n super()\n this.params = params\n this.bottomCircle = new CircleWithEdgeMesh(params)\n this.bottomCircle.name = 'bottomCircle'\n\n this.topCircle = new CircleWithEdgeMesh(params)\n this.topCircle.name = 'topCircle'\n\n this.edgeMesh = new ColoredMesh(params)\n\n if (params?.bottomCenter && params?.topCenter && params?.radius) {\n this.setPoints(params as CylinderData)\n }\n\n this.addIfNotExists(this.bottomCircle)\n }\n\n public setPoints(params: Partial<CylinderData>) {\n this._topCenter = anyPositionToVector3(params.topCenter) ?? this.topCenter\n this._bottomCenter = anyPositionToVector3(params.bottomCenter) ?? this.bottomCenter\n this._radius = notNil(params.radius) ? params.radius : this.radius\n\n if (this._topCenter && this._bottomCenter) {\n const normal = this._topCenter.clone().sub(this._bottomCenter).normalize()\n this.bottomCircle.setPoints({ center: this._bottomCenter, normal, radius: this._radius })\n this.setTopCenter(this._topCenter)\n }\n\n this.needsRender = true\n }\n\n public setTopCenter(center: THREE.Vector3) {\n this.addIfNotExists(this.topCircle)\n\n this.topCircle.setPoints({ center, normal: this.normal, radius: this.radius })\n\n this.setEdgeMesh()\n }\n\n public setBottomCenter(center: THREE.Vector3) {\n this.addIfNotExists(this.bottomCircle)\n\n this.bottomCircle.setPoints({ center, normal: this.normal, radius: this.radius })\n\n this.setEdgeMesh()\n }\n\n public setStyle(style: Partial<CylinderStyle>) {\n this.params = { ...this.params, ...style }\n this.bottomCircle.setStyle(this.params)\n this.topCircle.setStyle(this.params)\n }\n\n public highlight(): void {\n if (this.highlighted) return\n this.highlighted = true\n this.edgeMesh.highlight()\n this.bottomCircle.highlight()\n this.topCircle.highlight()\n this.needsRender = true\n }\n\n public unhighlight(): void {\n if (!this.highlighted) return\n this.highlighted = false\n this.edgeMesh.unhighlight()\n this.bottomCircle.unhighlight()\n this.topCircle.unhighlight()\n this.needsRender = true\n }\n\n private setEdgeMesh() {\n this.addIfNotExists(this.edgeMesh)\n\n const topCenter = this.topCircle.center\n const bottomCenter = this.bottomCircle.center\n\n this.edgeMesh.geometry.dispose()\n this.edgeMesh.geometry = new THREE.CylinderGeometry(\n this.radius,\n this.radius,\n topCenter.distanceTo(bottomCenter),\n radiusToSegments(this.radius),\n 1,\n true,\n )\n\n const quaternion = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 1, 0), this.normal.clone().normalize())\n this.edgeMesh.position.copy(new THREE.Vector3().lerpVectors(bottomCenter, topCenter, 0.5))\n this.edgeMesh.quaternion.copy(quaternion)\n }\n}\n","import * as THREE from 'three/webgpu'\nimport type { CylinderMesh } from '../Meshes/Cylinder'\nimport { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\n\nexport class CylinderMeshEditor extends BaseEditorWithObjectHelper<CylinderMesh> {\n public constructor(cylinderMesh: CylinderMesh) {\n super(cylinderMesh, () => {\n const getInfo = () => {\n const topCenter = cylinderMesh.topCenter\n const bottomCenter = cylinderMesh.bottomCenter\n const boxCenter = new THREE.Vector3().lerpVectors(topCenter, bottomCenter, 0.5)\n return { topCenter, bottomCenter, boxCenter }\n }\n\n return {\n positionFrom: 'boundingBox',\n yAxis: () => cylinderMesh.normal,\n scaleHelper: {\n enable: true,\n positions: () => {\n const info = getInfo()\n return [\n {\n id: 'top',\n handlePosition: info.topCenter,\n basePosition: info.bottomCenter,\n },\n {\n id: 'bottom',\n handlePosition: info.bottomCenter,\n basePosition: info.topCenter,\n },\n ]\n },\n scaleCallback: (params) => {\n const { intersectPoint, scalePosition } = params\n const { id } = scalePosition\n if (id === 'top') {\n cylinderMesh.setTopCenter(intersectPoint)\n } else if (id === 'bottom') {\n cylinderMesh.setBottomCenter(intersectPoint)\n }\n },\n },\n }\n })\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { Sculpt } from '../..'\nimport type { PointIntersection } from '../../../shared-utils'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { CircleStyle } from '../../Meshes/Circle'\nimport { CylinderMesh, type CylinderData } from '../../Meshes/Cylinder'\nimport { LineMesh } from '../../Meshes/Line'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport { createCircle } from '../Circle'\nimport * as THREE from 'three/webgpu'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { CylinderMeshEditor } from '../../Editors/CylinderMeshEditor'\nimport type { Simplify } from 'type-fest'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\ntype CylinderStyle = CircleStyle\n\nexport interface CylinderImportData extends BaseImportData, CylinderData {\n type: LiteralString<'Cylinder'>\n style?: Partial<CylinderStyle>\n}\n\nexport class Cylinder extends BaseObject<CylinderImportData> {\n public readonly type = 'Cylinder'\n public cylinderMesh: CylinderMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new CylinderMeshEditor(this.cylinderMesh)\n }\n return this._editor\n }\n\n public _editor: CylinderMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n bottomCenter: vector3ToArray(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter, this.cylinderMesh)),\n topCenter: vector3ToArray(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter, this.cylinderMesh)),\n radius: this.cylinderMesh.radius,\n style: {\n color: this.cylinderMesh.color.getHex(),\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: CylinderImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.cylinderMesh = new CylinderMesh({ ...data.style, ...data })\n this.add(this.cylinderMesh)\n }\n }\n\n public setData(data: Partial<CylinderImportData>): void {\n this.cylinderMesh.setPoints({\n bottomCenter: data.bottomCenter\n ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.bottomCenter), this.cylinderMesh)\n : undefined,\n topCenter: data.topCenter ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.topCenter), this.cylinderMesh) : undefined,\n })\n this.cylinderMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.cylinderMesh?.highlight()\n }\n\n public unhighlight() {\n this.cylinderMesh?.unhighlight()\n }\n\n public async create(params?: Partial<CylinderStyle>) {\n this.cylinderMesh = new CylinderMesh(params)\n this.add(this.cylinderMesh)\n await createCylinder(this.cylinderMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport async function createCylinder(cylinderMesh: CylinderMesh, pointSelector: PointSelector) {\n const container = cylinderMesh.parent\n\n await createCircle(cylinderMesh.bottomCircle, pointSelector)\n\n const lineHelper = new LineMesh()\n lineHelper.name = 'LineHelper'\n container.add(lineHelper)\n\n const lastPoint = pointSelector.position.point\n const normal = cylinderMesh.normal.clone().normalize()\n const startPoint = lastPoint.clone().add(normal.clone().multiplyScalar(100))\n const endPoint = lastPoint.clone().sub(normal.clone().multiplyScalar(100))\n lineHelper.setPoints([startPoint, endPoint])\n\n pointSelector.enable()\n\n return new Promise<void>((resolve, reject) => {\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n selectEnd()\n resolve()\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection?.raycaster) return\n\n const pointOnLineHelper = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(startPoint, endPoint),\n })\n\n const bottomPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(cylinderMesh.normal, cylinderMesh.bottomCenter)\n\n const pointOnPlane = bottomPlane.projectPoint(pointOnLineHelper, new THREE.Vector3())\n const vector = pointOnLineHelper.clone().sub(pointOnPlane)\n const topCenter = cylinderMesh.bottomCenter.clone().add(vector)\n\n if (pointOnLineHelper) {\n cylinderMesh.setTopCenter(topCenter)\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n container.remove(lineHelper)\n pointSelector.disable()\n }\n\n const cancel = () => {\n selectEnd()\n container.remove(cylinderMesh)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","export function forReverseEach<T extends unknown[]>(array: T, func: (v: T[number]) => any) {\n for (let i = array.length - 1; i >= 0; i--) {\n func(array[i])\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { LineMesh, type LineData, type LineMeshStyle } from '../../Meshes/Line'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { LineEditor } from './Editor'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport type { CreateLimitConfig } from '../../typings/style'\nimport { LineWithDotsMesh } from '../../Meshes/LineWithDots'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport { withResolvers } from '../../../shared-utils/promise/withResolvers'\n\nexport interface LineImportData extends BaseImportData, LineData {\n type: LiteralString<'Line'>\n style?: Partial<LineMeshStyle>\n}\n\nexport class Line extends BaseObject<LineImportData> {\n public readonly type = 'Line'\n public lineMesh: LineWithDotsMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new LineEditor(this)\n }\n return this._editor\n }\n\n public _editor: LineEditor\n\n private creatingObject?: ReturnType<typeof createLine>\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.lineMesh.points)),\n style: {\n lineColor: new THREE.Color(this.lineMesh.color).getHex(),\n lineWidth: this.lineMesh.lineWidth,\n dashed: this.lineMesh.dashed,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: LineImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.lineMesh = new LineWithDotsMesh({ ...data.style, ...data })\n this.add(this.lineMesh)\n }\n }\n\n public setData(data: Partial<LineImportData>): void {\n if (data.points) this.lineMesh.setPoints(data.points)\n this.lineMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.lineMesh?.highlight()\n }\n\n public unhighlight() {\n this.lineMesh?.unhighlight()\n }\n\n public canUndo() {\n return this.creatingObject?.canUndo() ?? false\n }\n\n public canRedo() {\n return this.creatingObject?.canRedo() ?? false\n }\n\n public undo() {\n this.creatingObject?.undo()\n }\n\n public redo() {\n this.creatingObject?.redo()\n }\n\n public async create(params?: Partial<LineMeshStyle & CreateLimitConfig>) {\n this.removeChildren()\n\n const lineMesh = new LineWithDotsMesh(params)\n this.lineMesh = lineMesh\n this.add(this.lineMesh)\n\n this.creatingObject = createLine(lineMesh, this.pointSelector, params)\n await this.creatingObject.finished\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\n/**\n * @description 绘制线段\n * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`\n */\nexport function createLine(lineMesh: LineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>) {\n const container = lineMesh.parent\n if (!container) return\n\n const { promise, resolve, reject } = withResolvers<void>()\n\n const limit = config?.limit ?? 'none'\n\n const previewLine = new LineMesh(lineMesh.style)\n container.add(previewLine)\n\n // 垂直辅助线\n const verticalLine = new LineMesh({ ...lineMesh.style, dashed: true, lengthEnable: false })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n const points: THREE.Vector3[] = []\n\n // 实时的预览点\n let previewPoint: THREE.Vector3\n let planeHelper: THREE.Plane\n\n let lastIntersection: PointIntersection\n\n const undoStack: THREE.Vector3[] = []\n\n const canUndo = () => points.length > 0\n\n const canRedo = () => undoStack.length > 0\n\n const undo = () => {\n if (!canUndo()) return\n undoStack.push(points.pop())\n lineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n const redo = () => {\n if (!canRedo()) return\n points.push(undoStack.pop())\n lineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n undoStack.length = 0 // 一旦有了新的动作,就要清空撤销栈\n const point = points.length === 0 ? intersection.point : previewPoint.clone()\n points.push(point)\n lineMesh.setPoints(points)\n if (points.length === 2) {\n selectEnd()\n resolve()\n }\n }\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n const clearPreview = () => {\n previewLine.setPoints([])\n verticalLine.setPoints([])\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n if (!points?.length) return clearPreview()\n if (!intersection) return clearPreview()\n\n lastIntersection = intersection\n\n const lastPoint = points.at(-1).clone()\n\n if (limit === 'none') {\n // 自由选点\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else if (limit === 'xoz') {\n // 水平面选点\n pointSelector.plane = planeHelper\n planeHelper = planeHelper ?? new THREE.Plane().setFromNormalAndCoplanarPoint(new THREE.Vector3(0, 1, 0), points[0])\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n } else if (limit === 'y') {\n if (!intersection.isVirtual) {\n // 真实点\n const line = new THREE.Line3(points[0].clone(), new THREE.Vector3(0, 1, 0).add(points[0]))\n previewPoint = line.closestPointToPoint(intersection.point, false, new THREE.Vector3())\n verticalLine.setPoints([previewPoint, intersection.point])\n } else {\n // 垂直面选点\n previewPoint = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(points[0].clone(), new THREE.Vector3(0, 1, 0).add(points[0])),\n clampToLine: false,\n })\n verticalLine.setPoints([])\n }\n previewLine.setPoints([lastPoint, previewPoint])\n // verticalLine.setPoints([previewPoint, intersection.point])\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n pointSelector.plane = null\n pointSelector.disable()\n container?.remove(previewLine, verticalLine)\n }\n\n const cancel = () => {\n selectEnd()\n if (points.length !== 2) {\n container?.remove(lineMesh)\n }\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n\n return {\n finished: promise,\n canUndo,\n canRedo,\n undo,\n redo,\n }\n}\n","import { bindFiveOwner } from '../shared-utils/five/getFiveFromParentChain'\nimport type * as THREE from 'three/webgpu'\nimport type { Five } from '@realsee/five-webgpu'\nimport { SculptModules, bindObjectModules } from './utils/Modules/Global'\nimport type { BaseObject, BaseObjectConfig } from './Objects/Base'\nimport { Subscribe } from '../shared-utils/Subscribe'\nimport { IObject3D } from '../shared-utils/three/IObject3D'\nimport { notNil } from '../shared-utils'\nimport { recurveFindObject } from '../shared-utils/three/recurveFindObject'\n\nimport { Polyline } from './Objects/Polyline'\nimport { Point } from './Objects/Point'\nimport { Polygon } from './Objects/Polygon'\nimport { Prism } from './Objects/Prism'\nimport { Rectangle } from './Objects/Rectangle'\nimport { Circle } from './Objects/Circle'\nimport { Cylinder } from './Objects/Cylinder'\nimport { Box } from './Objects/Box'\n\nimport type { BuiltInData, BuiltInItem, SculptType } from './typings'\nimport { forReverseEach } from '../shared-utils/forReverseEach'\nimport { Line } from './Objects/Line'\nimport type { MagnifierParameter } from '../shared-utils/three/Magnifier'\n\nexport type { SculptData } from './typings'\nexport type { SculptType } from './typings'\nexport { createPoint } from './Objects/Point'\nexport { createLine } from './Objects/Line'\nexport { createPolyline } from './Objects/Polyline'\nexport { createPolygon } from './Objects/Polygon'\nexport { createPrism } from './Objects/Prism'\nexport { createRectangle } from './Objects/Rectangle'\nexport { createCircle } from './Objects/Circle'\nexport { createCylinder } from './Objects/Cylinder'\nexport { createBox } from './Objects/Box'\n\n/**\n * Sculpt 配置选项\n */\nexport interface SculptConfig {\n /**\n * @description 放大镜配置\n * 设置为 null 或 false 可禁用放大镜功能\n * @default *{ width: 190, height: 190, scale: 2, dragEnabled: true }*\n */\n magnifier?: MagnifierParameter | null | false\n /**\n * @description 是否隐藏鼠标光标旁边的圆圈效果\n * 设置为 true 时会隐藏圆圈效果\n * @default false\n */\n hideCursorCircle?: boolean\n /**\n * @description 是否自定义拾取点过滤函数\n * @default false\n */\n hitFilter?: (intersect: THREE.Intersection) => boolean\n}\n\ninterface Data {\n items: Array<BuiltInData>\n}\n\ntype Event = {\n /**\n * @description: 点击事件\n * @param {MouseEvent} e 鼠标事件\n * @param {BuiltInItem} item 点击的物体\n * 返回 false 来禁用 Five 默认行为\n */\n click: (e: MouseEvent, item: BuiltInItem) => void | false\n /**\n * @description 当 Polygon 创建时检测到自相交时触发(需开启 experimental_self_intersect_check)\n * @param item Polygon 实例\n * @param point 尝试添加但被拒绝的点坐标\n */\n 'polygon.experimental_self_intersect': (item: Polygon, point: THREE.Vector3) => void\n /**\n * @description polygon 将要添加到下一个点\n * @param item Polygon 实例\n * @param point polygon 将要添加到下一个点到坐标\n * @param points 当前已经绘制的点坐标(不包括即将添加的点)\n */\n 'polygon.experimental_point_will_add': (item: Polygon, point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description prism 将要添加到下一个点\n * @param item Prism 实例\n * @param point prism 将要添加到下一个点到坐标\n * @param points 当前已经绘制的点坐标(不包括即将添加的点)\n */\n 'prism.experimental_point_will_add': (item: Prism, point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description prism 检测到自相交时的回调\n * @param item Prism 实例\n * @param point 尝试添加但被拒绝的点坐标\n */\n 'prism.experimental_self_intersect': (item: Prism, point: THREE.Vector3) => void\n}\n\nexport class Sculpt extends Subscribe<Event> {\n public readonly modules: SculptModules\n private disposed = false\n private initialTabIndex: number\n\n public get data() {\n return {\n items: this.items\n .map((item) => {\n try {\n return item.data\n } catch (e) {\n console.error(e)\n return null\n }\n })\n .filter(notNil),\n }\n }\n\n public group: IObject3D\n\n public theme: SculptType.Theme\n\n public config: SculptConfig\n\n public get items() {\n return this.group.children as BuiltInItem[]\n }\n\n private five: Five\n\n private creatingItem: BaseObject | null = null\n\n public constructor(five: Five, theme?: SculptType.Theme, config?: SculptConfig) {\n super()\n\n this.five = five\n this.theme = theme\n this.config = {\n magnifier: { width: 190, height: 190, scale: 2, dragEnabled: true },\n ...config,\n }\n this.group = new IObject3D()\n this.group.name = 'Sculpt'\n // 添加对 Sculpt 实例的引用,方便编辑器访问\n bindFiveOwner(this.group, this.five)\n five.scene.add(this.group)\n this.modules = new SculptModules(five, this.config)\n bindObjectModules(this.group, this.modules)\n const element = five.getElement()\n this.initialTabIndex = element.tabIndex\n if (element.tabIndex < 0) element.tabIndex = 0\n element.addEventListener('pointerdown', this.focusScene)\n element.addEventListener('keydown', this.onKeyDown)\n five.on('dispose', this.dispose)\n\n this.modules.fiveDomEvents.addEventListener(this.group, 'click', ({ intersects, origDomEvent }) => {\n const item = recurveFindObject(intersects?.[0]?.object, (o) => (o as any).isSculptObject) as BaseObject\n\n if (item && !item.editing) {\n const result = this.emit('click', origDomEvent as any, item as any) // true: 用户希望阻止five事件,false: 用户希望继续five事件,也是默认值\n return result // 这个 boolean 好复杂啊,别轻易动\n } else {\n // 没点到东西时,返回 false 会允许five的默认事件\n return false\n }\n })\n\n }\n\n /**\n * @description: 销毁实例:清空内容、解绑全局快捷键、把 group 从场景移除\n */\n public dispose = () => {\n if (this.disposed) return\n this.disposed = true\n this.clear()\n this.five.off('dispose', this.dispose)\n const element = this.five.getElement()\n element.removeEventListener('pointerdown', this.focusScene)\n element.removeEventListener('keydown', this.onKeyDown)\n element.tabIndex = this.initialTabIndex\n this.modules.dispose()\n this.group.removeFromParent()\n this.off()\n }\n\n private focusScene = (event: PointerEvent) => {\n if ((event.target as HTMLElement)?.closest('input, textarea, select, [contenteditable=\"true\"]')) return\n this.five.getElement().focus({ preventScroll: true })\n }\n\n private onKeyDown = (event: KeyboardEvent) => {\n if ((event.target as HTMLElement)?.closest('input, textarea, select, [contenteditable=\"true\"]')) return\n if (event.key.toLowerCase() !== 'z' || !(event.ctrlKey || event.metaKey)) return\n event.preventDefault()\n if (event.shiftKey) this.redo()\n else this.undo()\n }\n\n /**\n * @description: 加载数据 展示\n */\n public load(data: Data, config?: Partial<BaseObjectConfig>) {\n const types = new Set(['Point', 'Line', 'line', 'Polyline', 'Polygon', 'Prism', 'Rectangle', 'Circle', 'Cylinder', 'Box'])\n if (!Array.isArray(data?.items) || data.items.some(item => !types.has(item.type))) throw new TypeError('Sculpt 数据包含不支持的几何类型')\n this.clear()\n\n const items = data.items.map((d: any) => {\n const dataWithdefaultStyle = {\n ...d,\n style: { ...this.theme?.[d.type.toLowerCase()], ...d.style },\n }\n\n if (d.type === 'Point') {\n return new Point(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Line' || d.type === 'line') {\n return new Line(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Polyline') {\n return new Polyline(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Polygon') {\n return new Polygon(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Prism') {\n return new Prism(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Rectangle') {\n return new Rectangle(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Circle') {\n return new Circle(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Cylinder') {\n return new Cylinder(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Box') {\n return new Box(this.modules, dataWithdefaultStyle, config)\n } else {\n return null\n }\n })\n\n this.group.add(...items)\n\n this.five.needsRender = true\n }\n\n /**\n * @description: 获取物体实例\n */\n public getItemById(id: string) {\n return this.items.find((item) => item.uuid === id)\n }\n\n /**\n * @description: 放置物体\n */\n public putObject(object: THREE.Object3D) {\n this.group.add(object)\n const object3DHelper = this.modules.object3DHelper\n const controllers = object3DHelper.addObject3DHelper(object)\n controllers?.moveController?.moveByMouse()\n return object3DHelper\n }\n\n /**\n * @description: 开始绘制点\n */\n public async createPoint(...params: Parameters<Point['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.point, params[0])\n return this.createItem(Point, ...params)\n }\n\n /**\n * @description: 开始绘制线段\n */\n public async createLine(...params: Parameters<Line['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.line, params[0])\n return this.createItem(Line, ...params)\n }\n\n /**\n * @description: 开始绘制空间折线\n */\n public async createPolyline(...params: Parameters<Polyline['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.polyline, params[0])\n return this.createItem(Polyline, ...params)\n }\n\n /**\n * @description: 开始绘制平面多边形\n */\n public async createPolygon(...params: Parameters<Polygon['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.polygon, params[0])\n // 注入 polygon.experimental_self_intersect 回调\n const config = params[0] ?? {}\n config.__onSelfIntersect = (point: THREE.Vector3) => {\n const item = this.creatingItem as Polygon\n this.emit('polygon.experimental_self_intersect', item, point)\n }\n config.__onWillAddPoint = (point: THREE.Vector3, points: THREE.Vector3[]) => {\n const item = this.creatingItem as Polygon\n this.emit('polygon.experimental_point_will_add', item, point, points)\n }\n params[0] = config\n return this.createItem(Polygon, ...params)\n }\n\n /**\n * @description: 开始绘制多棱柱\n */\n public async createPrism(...params: Parameters<Prism['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.prism, params[0])\n const config = params[0] ?? {}\n config.__onSelfIntersect = (point: THREE.Vector3) => {\n const item = this.creatingItem as Prism\n this.emit('prism.experimental_self_intersect', item, point)\n }\n config.__onWillAddPoint = (point: THREE.Vector3, points: THREE.Vector3[]) => {\n const item = this.creatingItem as Prism\n this.emit('prism.experimental_point_will_add', item, point, points)\n }\n params[0] = config\n return this.createItem(Prism, ...params)\n }\n\n /**\n * @description: 开始绘制矩形\n */\n public async createRectangle(...params: Parameters<Rectangle['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.rectangle, params[0])\n return this.createItem(Rectangle, ...params)\n }\n\n /**\n * @description: 开始绘制圆形\n */\n public async createCircle(...params: Parameters<Circle['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.circle, params[0])\n return this.createItem(Circle, ...params)\n }\n\n /**\n * @description: 开始绘制圆柱\n */\n public async createCylinder(...params: Parameters<Cylinder['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.cylinder, params[0])\n return this.createItem(Cylinder, ...params)\n }\n\n /**\n * @description: 开始绘制 Box\n */\n public async createBox(...params: Parameters<Box['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.box, params[0])\n return this.createItem(Box, ...params)\n }\n\n public canUndo() {\n // 创建阶段:检查正在创建的对象\n if (this.creatingItem) {\n return this.creatingItem.canUndo()\n }\n\n // 编辑阶段:检查当前选中的物体\n const selectedItem = this.items.find(item => item.selected)\n if (selectedItem && typeof selectedItem.canUndo === 'function') {\n return selectedItem.canUndo()\n }\n\n return false\n }\n\n public canRedo() {\n // 创建阶段:检查正在创建的对象\n if (this.creatingItem) {\n return this.creatingItem.canRedo()\n }\n\n // 编辑阶段:检查当前选中的物体\n const selectedItem = this.items.find(item => item.selected)\n if (selectedItem && typeof selectedItem.canRedo === 'function') {\n return selectedItem.canRedo()\n }\n\n return false\n }\n\n /**\n * @description: 撤销\n */\n public undo = () => {\n // 创建阶段:撤销正在创建的对象\n if (this.creatingItem) {\n this.creatingItem.undo()\n this.five.needsRender = true\n return\n }\n\n // 编辑阶段:委托给当前选中的物体\n const selectedItem = this.items.find(item => item.selected && item.type === 'Polygon')\n if (selectedItem && typeof selectedItem.undo === 'function') {\n selectedItem.undo()\n this.five.needsRender = true\n }\n }\n\n /**\n * @description: 重做\n */\n public redo = () => {\n // 创建阶段:重做正在创建的对象\n if (this.creatingItem) {\n this.creatingItem.redo()\n this.five.needsRender = true\n return\n }\n\n // 编辑阶段:委托给当前选中的物体\n const selectedItem = this.items.find(item => item.selected && item.type === 'Polygon')\n if (selectedItem && typeof selectedItem.redo === 'function') {\n selectedItem.redo()\n this.five.needsRender = true\n }\n }\n\n\n\n /**\n * @description: 清空数据\n */\n public clear() {\n forReverseEach(this.items, (item) => item.delete())\n this.creatingItem = null\n this.five.needsRender = true\n }\n\n private async createItem<T extends BaseObject = any>(ItemClass: new (modules: SculptModules) => T, ...createParams: any) {\n if (this.creatingItem) {\n this.creatingItem.stopCreating()\n this.creatingItem = null\n }\n\n const item = new ItemClass(this.modules)\n this.creatingItem = item\n\n this.group.add(item)\n\n try {\n await item.create(...createParams)\n if (this.disposed || item.parent !== this.group) return undefined\n item.select({ only: true })\n return item\n } catch (error) {\n item.delete()\n throw error\n } finally {\n if (this.creatingItem === item) this.creatingItem = null\n }\n\n }\n}\n\n/**\n * @description: Sculpt 插件\n */\nexport const SculptPlugin = (five: Five, options?: { theme?: SculptType.Theme; config?: SculptConfig }) =>\n new Sculpt(five, options?.theme, options?.config)\n","export { SculptPlugin } from '../../Sculpt/index'\nexport type { SculptData, SculptType, SculptConfig } from '../../Sculpt/index'\nexport type { PrismStyle, PrismData } from '../../Sculpt/Meshes/Prism'\nexport type { LineMeshStyle, LineData } from '../../Sculpt/Meshes/Line'\nexport type { PointData, PointStyle } from '../../Sculpt/Meshes/Point'\nexport type { PointImportData, Line, LineImportData, Polyline, PolylineImportData, Polygon, PolygonImportData, Prism, PrismImportData, Rectangle, RectangleImportData, Circle, CircleImportData, Cylinder, CylinderImportData, Box, BoxImportData, PolylineStyle, RectangleStyle, CircleStyle, CylinderStyle, BoxStyle, AreaStyle, BuiltInData, BuiltInItem } from '../../Sculpt/typings'\n\nimport type { SculptPlugin as SculptPluginFactory } from '../../Sculpt/index'\nexport type SculptPluginInstance = ReturnType<typeof SculptPluginFactory>\n\nimport { PrismMesh } from '../../Sculpt/Meshes/Prism'\nimport type { Object3D } from 'three/webgpu'\n\n/** Identify plugin-created region meshes without exposing an internal constructor. */\nexport function isPrismMesh(object: Object3D): object is PrismMesh {\n return object instanceof PrismMesh\n}\n"],"mappings":";;;;;;;;;;;;;AAKA,IAAa4B,IAAb,cAAoCnB,EAA6B;CAC/D,IAAW,SAAS;EAClB,OAAO,KAAK,aAAa,aAAa;CACxC;CAEA,YAAmB,GAAwB;EACzC,MAAMoB,CAAY;CACpB;CAEA,UAAoB,MAAwB;EAC1C,IAAI,CAAC,KAAK,kBAAkB,KAAK,eAAe,WAAW,GAAG;EAC9D,IAAMC,IAAa7B,EAAwB,KAAK,QAAQ,MAAM8B,EAAM,SAAS;EAG7E,AADA,KAAK,eAAe,SAAS,MAAUC,EAAM,SAAS,KAAKF,EAAW,KAAK,CAAC,GAC5E,KAA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GAAO;GAEd,MADAf,EAAK,OAAO,GACNe;EACR,UAAU;GACR,AAAI,KAAK,iBAAiBf,MAAM,KAAK,eAAe;EACtD;CAEF;AACF,GAKagB,MAAgB,GAAY,MACvC,IAAIjB,EAAOE,GAAMgB,GAAS,OAAOA,GAAS,MAAM;;;AChclD,SAAgBC,GAAY,GAAuC;CACjE,OAAOR,aAAkBjH;AAC3B"}
|
|
1
|
+
{"version":3,"file":"sculpt-BCK4PMwL.js","names":["Subscribe","getIntersectByRaycaster","bindFiveOwner","LineMesh","IObject3D","getNormal","notNil","rayOnLine","AreaMesh","LineEditorAbstract","createPolygon","BaseEditor","Box","vector3ToArray","bindObjectModules","Polygon","LineEditor","Rectangle","BaseEditorWithObjectHelper","withResolvers","PointMesh","ColoredMesh","LineWithDotsMesh","PolylineWithDotsMesh","PolylineMesh","PrismMesh","recurveFindObject","THREE","PolylineEditor","originObject","intersects","event","point","Polyline","BaseObject","modules","data","config","anyPositionToVector3","polyLineMesh","params","createPolyline","container","limit","previewLine","verticalLine","pointSelector","points","previewPoint","planeHelper","lastIntersection","undoStack","canUndo","canRedo","undo","onPreview","redo","onSelect","intersection","clearProview","lastPoint","reject","promise","PointEditor","Point","style","createPoint","pointMesh","selectEnd","cancel","resolve","PrismMeshEditor","prismMesh","bottomPosition","topPosition","offset","center","bottomCenter","topCenter","scalePosition","id","offsetToBottom","intersectPoint","basePosition","offsetToTop","v","Prism","createPrism","bottomPolygon","lineHelper","normal","startPoint","endPoint","pointOnLineHelper","CircleMeshEditor","circleMesh","radiusToSegments","radius","CircleMesh","n","segments","CircleWithEdgeMesh","position","edgePoints","index","Circle","child","createCircle","plane","CylinderMesh","quaternion","CylinderMeshEditor","cylinderMesh","getInfo","info","Cylinder","createCylinder","pointOnPlane","vector","forReverseEach","i","array","Line","lineMesh","createLine","clearPreview","Sculpt","item","five","theme","SculptModules","element","o","origDomEvent","types","items","dataWithdefaultStyle","d","object","object3DHelper","selectedItem","createParams","ItemClass","error","SculptPlugin","options","isPrismMesh"],"sources":["../../src/Sculpt/Objects/Polyline/Editor.ts","../../src/Sculpt/Objects/Polyline/index.ts","../../src/Sculpt/Objects/Point/Editor.ts","../../src/Sculpt/Objects/Point/index.ts","../../src/Sculpt/Editors/PrismMeshEditor.ts","../../src/Sculpt/Objects/Prism/index.ts","../../src/Sculpt/Editors/CircleMeshEditor.ts","../../src/Sculpt/utils/radiusToSegments.ts","../../src/Sculpt/Meshes/Circle.ts","../../src/Sculpt/Meshes/CircleWithEdge.ts","../../src/Sculpt/Objects/Circle/index.ts","../../src/Sculpt/Meshes/Cylinder.ts","../../src/Sculpt/Editors/CylinderMeshEditor.ts","../../src/Sculpt/Objects/Cylinder/index.ts","../../src/shared-utils/forReverseEach.ts","../../src/Sculpt/Objects/Line/index.ts","../../src/Sculpt/index.ts","../../src/public/plugins/sculpt.ts"],"sourcesContent":["import type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents'\nimport type { Polyline } from '.'\nimport { getIntersectByRaycaster } from '../../../shared-utils/five/getPosition'\nimport { LineEditorAbstract } from '../Line/Editor'\n\nexport class PolylineEditor extends LineEditorAbstract<Polyline> {\n public get points() {\n return this.originObject.polyLineMesh.points\n }\n\n public constructor(originObject: Polyline) {\n super(originObject)\n }\n\n protected onDrag = (event: FiveDomEvent) => {\n if (!this.draggingPoints || this.draggingPoints.length === 0) return\n const intersects = getIntersectByRaycaster(this.modules.five, event.raycaster)\n\n this.draggingPoints.forEach((point) => point.position.copy(intersects.point))\n this.originObject.polyLineMesh.setPoints(this.pointMeshes.map((point) => point.position))\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport type { Color } from '../../../Object3DHelperPlugin'\nimport { PolylineMesh, PolylineWithDotsMesh, type PolylineData, type PolylineStyle } from '../../Meshes/Polyline'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { PolylineEditor } from './Editor'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport type { CreateLimitConfig } from '../../typings/style'\nimport { withResolvers } from '../../../shared-utils/promise/withResolvers'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface PolylineImportData extends BaseImportData, PolylineData {\n type: LiteralString<'Polyline'>\n style?: Partial<PolylineStyle>\n}\n\nexport class Polyline extends BaseObject<PolylineImportData> {\n public readonly type = 'Polyline'\n public polyLineMesh: PolylineWithDotsMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PolylineEditor(this)\n }\n return this._editor\n }\n\n public _editor: PolylineEditor\n\n private creatingObject?: ReturnType<typeof createPolyline>\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.polyLineMesh.points)),\n style: {\n lineColor: new THREE.Color(this.polyLineMesh.lineColor).getHex(),\n lineWidth: this.polyLineMesh.lineWidth,\n dashed: this.polyLineMesh.dashed,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: PolylineImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.polyLineMesh = new PolylineWithDotsMesh({ ...data.style, ...data })\n this.add(this.polyLineMesh)\n }\n }\n\n public setData(data: Partial<PolylineImportData>): void {\n if (data.points) this.polyLineMesh.setPoints(this.applyObjectReversalMatrixWorld(data.points.map(anyPositionToVector3)))\n this.polyLineMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.polyLineMesh?.highlight()\n }\n\n public unhighlight() {\n this.polyLineMesh?.unhighlight()\n }\n\n public canUndo() {\n return this.creatingObject?.canUndo() ?? false\n }\n\n public canRedo() {\n return this.creatingObject?.canRedo() ?? false\n }\n\n public undo() {\n this.creatingObject?.undo()\n }\n\n public redo() {\n this.creatingObject?.redo()\n }\n\n public async create(params?: Partial<PolylineStyle & CreateLimitConfig>) {\n this.removeChildren()\n\n const polyLineMesh = new PolylineWithDotsMesh(params)\n this.polyLineMesh = polyLineMesh\n this.add(this.polyLineMesh)\n\n this.creatingObject = createPolyline(polyLineMesh, this.pointSelector, params)\n\n await this.creatingObject.finished\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\n/**\n * @description 绘制折线\n * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`\n */\nexport function createPolyline(polyLineMesh: PolylineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>) {\n const container = polyLineMesh.parent\n if (!container) return\n\n const { promise, resolve, reject } = withResolvers<void>()\n\n const limit = config?.limit ?? 'none'\n\n const previewLine = new PolylineMesh(polyLineMesh.style)\n container.add(previewLine)\n\n // 垂直辅助线\n const verticalLine = new PolylineMesh({ ...polyLineMesh.style, dashed: true, lengthEnable: false })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n const points: THREE.Vector3[] = []\n // 实时的预览点\n let previewPoint: THREE.Vector3\n let planeHelper: THREE.Plane\n\n let lastIntersection: PointIntersection\n\n const undoStack: THREE.Vector3[] = []\n\n const canUndo = () => points.length > 0\n\n const canRedo = () => undoStack.length > 0\n\n const undo = () => {\n if (!canUndo()) return\n undoStack.push(points.pop())\n polyLineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n const redo = () => {\n if (!canRedo()) return\n points.push(undoStack.pop())\n polyLineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n undoStack.length = 0 // 一旦有了新的动作,就要清空撤销栈\n const point = points.length === 0 ? intersection.point : previewPoint.clone()\n points.push(point)\n polyLineMesh.setPoints(points)\n }\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n const clearProview = () => {\n previewLine.setPoints([])\n verticalLine.setPoints([])\n previewPoint = null\n }\n\n if (!intersection) return clearProview()\n lastIntersection = intersection\n if (!points?.length) return clearProview()\n\n const lastPoint = points.at(-1).clone()\n\n if (limit === 'none') {\n // 自由选点\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else if (limit === 'xoz') {\n // 水平面选点\n planeHelper = planeHelper ?? new THREE.Plane().setFromNormalAndCoplanarPoint(new THREE.Vector3(0, 1, 0), points[0])\n pointSelector.plane = planeHelper\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n } else if (limit === 'y') {\n // 垂直面选点\n if (points.length === 1) {\n // 一个点时无法确定垂直面\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else {\n // 2个点以上时,确定垂直面\n planeHelper =\n planeHelper ?? new THREE.Plane().setFromCoplanarPoints(points[0], points[1], new THREE.Vector3(0, 1, 0).add(points[0]))\n pointSelector.plane = planeHelper\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n }\n }\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.plane = null\n container.remove(previewLine)\n container.remove(verticalLine)\n if (points.length < 2) {\n container.remove(polyLineMesh)\n return reject(new Error('Cancelled'))\n } else resolve()\n })\n\n return {\n finished: promise,\n canUndo,\n canRedo,\n undo,\n redo,\n }\n}\n","import { BaseEditor } from '../Base/Editor'\nimport type { Point } from '.'\nimport type { FiveDomEvent } from '../../../shared-utils/five/FiveDomEvents'\nimport { getIntersectByRaycaster } from '../../../shared-utils/five/getPosition'\n\nexport class PointEditor extends BaseEditor<Point> {\n public constructor(originObject: Point) {\n super(originObject)\n }\n\n public enable() {\n super.enable()\n this.originObject.draggable = true\n this.originObject.on('drag', this.onDrag)\n }\n\n public disable() {\n super.disable()\n this.originObject.draggable = false\n this.originObject.off('drag', this.onDrag)\n }\n\n private onDrag = (event: FiveDomEvent) => {\n const intersects = getIntersectByRaycaster(this.modules.five, event.raycaster)\n this.originObject.pointMesh?.position.copy(intersects.point)\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { PointMesh, type PointData, type PointStyle } from '../../Meshes/Point'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport { PointEditor } from './Editor'\nimport type { PointIntersection, PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface PointImportData extends BaseImportData, PointData {\n type: LiteralString<'Point'>\n style?: Partial<PointStyle>\n}\n\nexport class Point extends BaseObject<PointImportData> {\n public readonly type = 'Point'\n\n public pointMesh: PointMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PointEditor(this)\n }\n return this._editor\n }\n\n public _editor: PointEditor\n\n public get data() {\n return {\n ...this.baseData,\n point: vector3ToArray(this.applyObjectMatrixWorld(this.pointMesh.position)),\n style: {\n color: this.pointMesh.color.getHex(),\n size: this.pointMesh.size,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: PointImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.pointMesh = new PointMesh({ ...data.style, ...data })\n this.add(this.pointMesh)\n }\n }\n\n public setData(data: Partial<PointImportData>): void {\n if (data.point) this.pointMesh.position.copy(anyPositionToVector3(data.point))\n this.pointMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.pointMesh?.highlight()\n }\n\n public unhighlight() {\n this.pointMesh?.unhighlight()\n }\n\n /**\n * @description: 设置颜色\n * @param {Color} style.color\n * @param {number} style.size\n */\n public setStyle(style: Partial<PointStyle>) {\n this.pointMesh.setStyle(style)\n }\n\n /**\n * @description: 创建点\n */\n public async create(params?: Partial<PointStyle>) {\n if (this.pointMesh) {\n this.remove(this.pointMesh)\n }\n\n this.add((this.pointMesh = new PointMesh(params)))\n\n await createPoint(this.pointMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport function createPoint(pointMesh: PointMesh, pointSelector: PointSelector) {\n return new Promise<void>((resolve, reject) => {\n pointSelector.enable()\n\n pointMesh.visible = false\n\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection) return\n pointMesh.visible = true\n pointMesh.position.copy(intersection.point)\n }\n\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n pointMesh.visible = true\n pointMesh.position.copy(intersection.point)\n selectEnd()\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('disable', cancel)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.disable()\n resolve()\n }\n\n const cancel = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('disable', cancel)\n pointSelector.off('intersectionUpdate', onPreview)\n pointMesh.removeFromParent()\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n pointSelector.once('select', onSelect)\n })\n}\n","import { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\nimport type { Prism } from '../Objects/Prism'\nimport * as THREE from 'three/webgpu'\nimport type { PrismMesh } from '../Meshes/Prism'\n\nexport class PrismMeshEditor extends BaseEditorWithObjectHelper<PrismMesh> {\n public constructor(prismMesh: PrismMesh) {\n super(prismMesh, () => {\n return {\n positionFrom: () => prismMesh.worldCenter,\n yAxis: () => prismMesh.up,\n scaleHelper: {\n enable: true,\n positions: () => {\n const bottomPosition = prismMesh.bottomPositions\n const topPosition = prismMesh.topPosition\n const offset = new THREE.Vector3().subVectors(topPosition, bottomPosition[0])\n\n const center = prismMesh.geometryInfo.center\n\n const bottomCenter = center.clone().sub(offset.clone().divideScalar(2))\n const topCenter = center.clone().add(offset.clone().divideScalar(2))\n\n return [\n {\n id: 'top',\n handlePosition: topCenter,\n basePosition: bottomCenter,\n },\n {\n id: 'bottom',\n handlePosition: bottomCenter,\n basePosition: topCenter,\n },\n ]\n },\n scaleCallback: (params) => {\n const { intersectPoint, scalePosition } = params\n const { id, basePosition, handlePosition } = scalePosition\n\n if (id === 'top') {\n const offsetToBottom = intersectPoint.clone().sub(basePosition)\n prismMesh.setPoints({ heightPoint: prismMesh.bottomPositions[0].clone().add(offsetToBottom) })\n } else if (id === 'bottom') {\n const offsetToTop = intersectPoint.clone().sub(basePosition)\n\n prismMesh.setPoints({\n points: prismMesh.topPositions.map((v) => v.clone().add(offsetToTop)),\n })\n }\n },\n },\n }\n })\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { createPolygon } from '../Polygon'\nimport { PrismMesh, type PrismData, type PrismStyle } from '../../Meshes/Prism'\nimport { LineMesh } from '../../Meshes/Line'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport { PrismMeshEditor } from '../../Editors/PrismMeshEditor'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport getNormal from '../../../shared-utils/three/getNormal'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { AreaMesh } from '../../Meshes/Area'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\nimport type { CreateLimitConfig, PolygonDrawConfig } from '../../typings/style'\n\nexport interface PrismImportData extends BaseImportData, PrismData {\n type: LiteralString<'Prism'>\n style?: Partial<PrismStyle>\n}\n\nexport type PrismCreateConfig = Partial<PrismStyle & CreateLimitConfig & PolygonDrawConfig> & {\n onPointPlaced?: (points: THREE.Vector3[]) => void\n onUndo?: () => void\n onRedo?: () => void\n /**\n * @description 检测到自相交时的回调\n * @param point 尝试添加但被拒绝的点坐标\n */\n __onSelfIntersect?: (point: THREE.Vector3) => void\n /**\n * @description 将要添加的下一个点\n */\n __onWillAddPoint?: (point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description 检测是否自相交,如果自交,禁止添加下一个点\n * @default false\n */\n experimental_self_intersect_check?: boolean\n /**\n * 最多允许能添加的点数\n */\n experimental_max_point_count?: number\n}\n\nexport class Prism extends BaseObject<PrismImportData> {\n public readonly type = 'Prism'\n public prismMesh: PrismMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new PrismMeshEditor(this.prismMesh)\n }\n return this._editor\n }\n\n public _editor: PrismMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.prismMesh.bottomPositions, this.prismMesh)),\n heightPoint: vector3ToArray(this.applyObjectMatrixWorld(this.prismMesh.topPosition, this.prismMesh)),\n style: {\n color: this.prismMesh.color.getHex(),\n lineWidth: this.prismMesh.lineWidth,\n lineColor: this.prismMesh.lineColor.getHex(),\n },\n } as const\n }\n\n public constructor(modules: SculptModules, data?: PrismImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.prismMesh = new PrismMesh({ ...data.style, ...data })\n this.add(this.prismMesh)\n }\n }\n\n public setData(data: Partial<PrismImportData>): void {\n this.prismMesh.setPoints({\n points: data.points ? this.applyObjectReversalMatrixWorld(data.points.map(anyPositionToVector3), this.prismMesh) : undefined,\n heightPoint: data.heightPoint\n ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.heightPoint), this.prismMesh)\n : undefined,\n })\n this.prismMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.prismMesh?.highlight()\n }\n\n public unhighlight() {\n this.prismMesh?.unhighlight()\n }\n\n public async create(params?: PrismCreateConfig) {\n this.prismMesh = new PrismMesh(params)\n this.add(this.prismMesh)\n\n await createPrism(this.prismMesh, this.pointSelector, params)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport async function createPrism(prismMesh: PrismMesh, pointSelector: PointSelector, config?: PrismCreateConfig) {\n const container = prismMesh.parent\n\n const bottomPolygon = new AreaMesh(prismMesh.style)\n container.add(bottomPolygon)\n await createPolygon(bottomPolygon, pointSelector, config).finished\n container.remove(bottomPolygon)\n\n prismMesh.setPoints({ points: bottomPolygon.points })\n\n const lineHelper = new LineMesh()\n lineHelper.name = 'LineHelper'\n container.add(lineHelper)\n\n const lastPoint = bottomPolygon.points.at(-1)\n const normal = getNormal(bottomPolygon.points)\n const startPoint = lastPoint.clone().add(normal.clone().multiplyScalar(100))\n const endPoint = lastPoint.clone().sub(normal.clone().multiplyScalar(100))\n lineHelper.setPoints([startPoint, endPoint])\n\n pointSelector.enable()\n\n return new Promise<void>((resolve, reject) => {\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n // 触发 onPointPlaced 回调\n config?.onPointPlaced?.(prismMesh.bottomPositions)\n selectEnd()\n resolve()\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection?.raycaster) return\n\n const pointOnLineHelper = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(startPoint, endPoint),\n })\n\n if (pointOnLineHelper) {\n prismMesh.setPoints({ heightPoint: pointOnLineHelper })\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n container.remove(lineHelper)\n pointSelector.disable()\n }\n\n const cancel = () => {\n selectEnd()\n container.remove(prismMesh)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","import { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\nimport type { CircleMesh } from '../Meshes/Circle'\n\nexport class CircleMeshEditor extends BaseEditorWithObjectHelper<CircleMesh> {\n public constructor(circleMesh: CircleMesh) {\n super(circleMesh, () => ({ yAxis: () => circleMesh.normal }))\n }\n}\n","export default function radiusToSegments(radius: number) {\n const segments = Math.max(32, Math.min(128, Math.floor(radius * 40)))\n return segments\n}\n","import * as THREE from 'three/webgpu'\nimport { type OcclusionStyle } from '../typings/style'\nimport radiusToSegments from '../utils/radiusToSegments'\nimport ColoredMesh, { type ColoredMeshStyle } from '../utils/three/ColoredMesh'\nimport { anyPositionToVector3, type AnyPosition } from '../../shared-utils/positionToVector3'\nimport { notNil } from '../../shared-utils'\n\nexport type CircleStyle = ColoredMeshStyle & OcclusionStyle\n\nexport type CircleData = {\n center: AnyPosition\n normal: AnyPosition\n radius: number\n}\n\ntype Params = Partial<CircleStyle & CircleData>\n\nexport class CircleMesh extends ColoredMesh {\n public get center() {\n return this.position.clone()\n }\n\n public get normal() {\n // TODO:改为实时计算\n return this._normal\n }\n\n private set normal(n: THREE.Vector3) {\n this._normal = n\n }\n\n public get radius() {\n return this.meshFont.geometry?.parameters?.radius\n }\n\n public declare meshFont: THREE.Mesh<THREE.CircleGeometry, THREE.MeshBasicMaterial>\n\n private _normal: THREE.Vector3\n private _center: THREE.Vector3\n private _radius: number\n\n public constructor(params?: Params) {\n super(params)\n\n if (params?.center && params?.normal && params?.radius) {\n this.setPoints(params as CircleData)\n }\n }\n\n public setPoints(params: Partial<CircleData>) {\n this._center = anyPositionToVector3(params.center) ?? this._center\n this._normal = (anyPositionToVector3(params.normal) ?? this._normal).normalize()\n this._radius = params.radius ?? this._radius\n\n if (notNil(this._radius) && this._radius !== this.radius) {\n const segments = radiusToSegments(this._radius)\n this.geometry = new THREE.CircleGeometry(this._radius, segments)\n }\n\n if (this._center) this.position.copy(this._center)\n\n if (this._normal) {\n // FIXME: 这个lookat是世界的lookat,不是本地lookat\n this.lookAt(this._normal.clone().add(this._center))\n this.normal = this._normal.clone()\n }\n\n this.needsRender = true\n }\n}\n","import * as THREE from 'three/webgpu'\nimport type { LineStyle } from '../typings/style'\nimport { CircleMesh, type CircleData, type CircleStyle } from './Circle'\nimport { LineMesh } from './Line'\n\nexport type CircleWithEdgeMeshStyle = CircleStyle & LineStyle\n\nexport class CircleWithEdgeMesh extends CircleMesh {\n private edgeLine: LineMesh\n\n public constructor(params?: Partial<CircleWithEdgeMeshStyle & CircleData>) {\n const { normal, radius, center, ...style } = params ?? {}\n super(style)\n\n this.edgeLine = new LineMesh(style)\n this.add(this.edgeLine)\n if (normal && radius && center) {\n this.setPoints({ normal, radius, center })\n }\n }\n\n public setPoints(...params: Parameters<InstanceType<typeof CircleMesh>['setPoints']>): void {\n super.setPoints(...params)\n // 边框所有点\n const position = this.meshFont.geometry.getAttribute('position')\n const edgePoints = Array.from({ length: Math.max(0, position.count - 1) }, (_, index) =>\n new THREE.Vector3().fromBufferAttribute(position, index + 1),\n )\n if (edgePoints.length > 0) this.edgeLine.setPoints([...edgePoints, edgePoints[0]])\n }\n\n public setStyle(style: Partial<CircleWithEdgeMeshStyle>) {\n super.setStyle(style)\n this.edgeLine.setStyle(style)\n }\n\n public highlight(): void {\n super.highlight()\n this.edgeLine.highlight()\n }\n\n public unhighlight(): void {\n super.unhighlight()\n this.edgeLine.unhighlight()\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { PolylineMesh } from '../../Meshes/Polyline'\n\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport { CircleMeshEditor } from '../../Editors/CircleMeshEditor'\nimport type { CircleData, CircleMesh } from '../../Meshes/Circle'\nimport { CircleWithEdgeMesh, type CircleWithEdgeMeshStyle } from '../../Meshes/CircleWithEdge'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\nexport interface CircleImportData extends BaseImportData, CircleData {\n type: LiteralString<'Circle'>\n style?: Partial<CircleWithEdgeMeshStyle>\n}\n\nexport class Circle extends BaseObject<CircleImportData> {\n public readonly type = 'Circle'\n public circleMesh: CircleWithEdgeMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new CircleMeshEditor(this.circleMesh)\n }\n return this._editor\n }\n\n public _editor: CircleMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n center: vector3ToArray(this.applyObjectMatrixWorld(this.circleMesh.center, this.circleMesh)),\n normal: vector3ToArray(this.circleMesh.normal.clone().applyQuaternion(this.circleMesh.quaternion)),\n radius: this.circleMesh.radius,\n style: {\n color: this.circleMesh.color.getHex(),\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: CircleImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.circleMesh = new CircleWithEdgeMesh({ ...data.style, ...data })\n this.add(this.circleMesh)\n }\n }\n\n public setData(data: Partial<CircleImportData>): void {\n this.circleMesh.setPoints({\n center: data.center ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.center), this.circleMesh) : undefined,\n normal: data.normal ? anyPositionToVector3(data.normal) : undefined,\n radius: data.radius,\n })\n this.circleMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.circleMesh?.highlight()\n }\n\n public unhighlight() {\n this.circleMesh?.unhighlight()\n }\n\n public async create(params?: Partial<CircleWithEdgeMeshStyle>) {\n this.children.forEach((child) => {\n if (child.parent === this) {\n this.remove(child)\n }\n })\n this.children.length = 0\n\n const circleMesh = new CircleWithEdgeMesh(params)\n this.circleMesh = circleMesh\n this.add(this.circleMesh)\n\n await createCircle(this.circleMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport function createCircle(circleMesh: CircleMesh, pointSelector: PointSelector) {\n return new Promise<void>((resolve, reject) => {\n const container = circleMesh.parent\n if (!container) {\n reject(new Error('No container'))\n return\n }\n\n const verticalLine = new PolylineMesh({ dashed: true })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n let center: { point: THREE.Vector3; normal: THREE.Vector3 }\n let previewPoint: THREE.Vector3\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n // 第一次打点确认圆心\n if (!center) {\n center = {\n point: intersection.point,\n normal: intersection.face.normal,\n }\n return\n }\n if (center && previewPoint) {\n // 第二次打点即为绘制完成\n selectEnd()\n resolve()\n }\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection) return\n if (!center) return\n const plane = new THREE.Plane().setFromNormalAndCoplanarPoint(center.normal, center.point)\n previewPoint = intersection.raycaster.ray.intersectPlane(plane, new THREE.Vector3())\n // previewPoint 可能为 null\n if (previewPoint) {\n const radius = center.point.distanceTo(previewPoint)\n circleMesh.setPoints({ center: center.point, normal: center.normal, radius })\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n pointSelector.disable()\n container?.remove(verticalLine)\n }\n\n const cancel = () => {\n selectEnd()\n container?.remove(circleMesh, verticalLine)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","import { IObject3D } from '../../shared-utils/three/IObject3D'\nimport * as THREE from 'three/webgpu'\nimport { notNil } from '../../shared-utils'\nimport { CircleWithEdgeMesh, type CircleWithEdgeMeshStyle } from './CircleWithEdge'\nimport radiusToSegments from '../utils/radiusToSegments'\nimport ColoredMesh from '../utils/three/ColoredMesh'\nimport { anyPositionToVector3, type AnyPosition } from '../../shared-utils/positionToVector3'\nimport { DEFAULT_HIGHLIGHT_OPACITY } from '../typings/style'\n\nexport type CylinderStyle = CircleWithEdgeMeshStyle\n\nexport interface CylinderData {\n bottomCenter: AnyPosition\n topCenter: AnyPosition\n radius: number\n}\n\ntype Params = Partial<CylinderStyle & CylinderData>\n\nexport class CylinderMesh extends IObject3D {\n public get bottomCenter() {\n return this.bottomCircle.center\n }\n\n public get topCenter() {\n return this.topCircle.center\n }\n\n public get normal() {\n return this.bottomCircle.normal\n }\n\n public get radius() {\n return this.bottomCircle.radius\n }\n\n public get color() {\n return this.bottomCircle.color\n }\n\n public bottomCircle: CircleWithEdgeMesh\n public topCircle: CircleWithEdgeMesh\n protected edgeMesh: ColoredMesh\n\n private highlighted = false\n\n private params: Params\n\n private _topCenter: THREE.Vector3\n private _bottomCenter: THREE.Vector3\n private _radius: number\n\n public constructor(params?: Params) {\n super()\n this.params = params\n this.bottomCircle = new CircleWithEdgeMesh(params)\n this.bottomCircle.name = 'bottomCircle'\n\n this.topCircle = new CircleWithEdgeMesh(params)\n this.topCircle.name = 'topCircle'\n\n this.edgeMesh = new ColoredMesh(params)\n\n if (params?.bottomCenter && params?.topCenter && params?.radius) {\n this.setPoints(params as CylinderData)\n }\n\n this.addIfNotExists(this.bottomCircle)\n }\n\n public setPoints(params: Partial<CylinderData>) {\n this._topCenter = anyPositionToVector3(params.topCenter) ?? this.topCenter\n this._bottomCenter = anyPositionToVector3(params.bottomCenter) ?? this.bottomCenter\n this._radius = notNil(params.radius) ? params.radius : this.radius\n\n if (this._topCenter && this._bottomCenter) {\n const normal = this._topCenter.clone().sub(this._bottomCenter).normalize()\n this.bottomCircle.setPoints({ center: this._bottomCenter, normal, radius: this._radius })\n this.setTopCenter(this._topCenter)\n }\n\n this.needsRender = true\n }\n\n public setTopCenter(center: THREE.Vector3) {\n this.addIfNotExists(this.topCircle)\n\n this.topCircle.setPoints({ center, normal: this.normal, radius: this.radius })\n\n this.setEdgeMesh()\n }\n\n public setBottomCenter(center: THREE.Vector3) {\n this.addIfNotExists(this.bottomCircle)\n\n this.bottomCircle.setPoints({ center, normal: this.normal, radius: this.radius })\n\n this.setEdgeMesh()\n }\n\n public setStyle(style: Partial<CylinderStyle>) {\n this.params = { ...this.params, ...style }\n this.bottomCircle.setStyle(this.params)\n this.topCircle.setStyle(this.params)\n }\n\n public highlight(): void {\n if (this.highlighted) return\n this.highlighted = true\n this.edgeMesh.highlight()\n this.bottomCircle.highlight()\n this.topCircle.highlight()\n this.needsRender = true\n }\n\n public unhighlight(): void {\n if (!this.highlighted) return\n this.highlighted = false\n this.edgeMesh.unhighlight()\n this.bottomCircle.unhighlight()\n this.topCircle.unhighlight()\n this.needsRender = true\n }\n\n private setEdgeMesh() {\n this.addIfNotExists(this.edgeMesh)\n\n const topCenter = this.topCircle.center\n const bottomCenter = this.bottomCircle.center\n\n this.edgeMesh.geometry.dispose()\n this.edgeMesh.geometry = new THREE.CylinderGeometry(\n this.radius,\n this.radius,\n topCenter.distanceTo(bottomCenter),\n radiusToSegments(this.radius),\n 1,\n true,\n )\n\n const quaternion = new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 1, 0), this.normal.clone().normalize())\n this.edgeMesh.position.copy(new THREE.Vector3().lerpVectors(bottomCenter, topCenter, 0.5))\n this.edgeMesh.quaternion.copy(quaternion)\n }\n}\n","import * as THREE from 'three/webgpu'\nimport type { CylinderMesh } from '../Meshes/Cylinder'\nimport { BaseEditorWithObjectHelper } from '../Objects/Base/Editor'\n\nexport class CylinderMeshEditor extends BaseEditorWithObjectHelper<CylinderMesh> {\n public constructor(cylinderMesh: CylinderMesh) {\n super(cylinderMesh, () => {\n const getInfo = () => {\n const topCenter = cylinderMesh.topCenter\n const bottomCenter = cylinderMesh.bottomCenter\n const boxCenter = new THREE.Vector3().lerpVectors(topCenter, bottomCenter, 0.5)\n return { topCenter, bottomCenter, boxCenter }\n }\n\n return {\n positionFrom: 'boundingBox',\n yAxis: () => cylinderMesh.normal,\n scaleHelper: {\n enable: true,\n positions: () => {\n const info = getInfo()\n return [\n {\n id: 'top',\n handlePosition: info.topCenter,\n basePosition: info.bottomCenter,\n },\n {\n id: 'bottom',\n handlePosition: info.bottomCenter,\n basePosition: info.topCenter,\n },\n ]\n },\n scaleCallback: (params) => {\n const { intersectPoint, scalePosition } = params\n const { id } = scalePosition\n if (id === 'top') {\n cylinderMesh.setTopCenter(intersectPoint)\n } else if (id === 'bottom') {\n cylinderMesh.setBottomCenter(intersectPoint)\n }\n },\n },\n }\n })\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { Sculpt } from '../..'\nimport type { PointIntersection } from '../../../shared-utils'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { CircleStyle } from '../../Meshes/Circle'\nimport { CylinderMesh, type CylinderData } from '../../Meshes/Cylinder'\nimport { LineMesh } from '../../Meshes/Line'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport { createCircle } from '../Circle'\nimport * as THREE from 'three/webgpu'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport { CylinderMeshEditor } from '../../Editors/CylinderMeshEditor'\nimport type { Simplify } from 'type-fest'\nimport { anyPositionToVector3 } from '../../../shared-utils/positionToVector3'\n\ntype CylinderStyle = CircleStyle\n\nexport interface CylinderImportData extends BaseImportData, CylinderData {\n type: LiteralString<'Cylinder'>\n style?: Partial<CylinderStyle>\n}\n\nexport class Cylinder extends BaseObject<CylinderImportData> {\n public readonly type = 'Cylinder'\n public cylinderMesh: CylinderMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new CylinderMeshEditor(this.cylinderMesh)\n }\n return this._editor\n }\n\n public _editor: CylinderMeshEditor\n\n public get data() {\n return {\n ...this.baseData,\n bottomCenter: vector3ToArray(this.applyObjectMatrixWorld(this.cylinderMesh.bottomCenter, this.cylinderMesh)),\n topCenter: vector3ToArray(this.applyObjectMatrixWorld(this.cylinderMesh.topCenter, this.cylinderMesh)),\n radius: this.cylinderMesh.radius,\n style: {\n color: this.cylinderMesh.color.getHex(),\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: CylinderImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.cylinderMesh = new CylinderMesh({ ...data.style, ...data })\n this.add(this.cylinderMesh)\n }\n }\n\n public setData(data: Partial<CylinderImportData>): void {\n this.cylinderMesh.setPoints({\n bottomCenter: data.bottomCenter\n ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.bottomCenter), this.cylinderMesh)\n : undefined,\n topCenter: data.topCenter ? this.applyObjectReversalMatrixWorld(anyPositionToVector3(data.topCenter), this.cylinderMesh) : undefined,\n })\n this.cylinderMesh.setStyle(data.style)\n if (this._editor) this._editor.initialHelperMatrix()\n }\n\n public highlight() {\n this.cylinderMesh?.highlight()\n }\n\n public unhighlight() {\n this.cylinderMesh?.unhighlight()\n }\n\n public async create(params?: Partial<CylinderStyle>) {\n this.cylinderMesh = new CylinderMesh(params)\n this.add(this.cylinderMesh)\n await createCylinder(this.cylinderMesh, this.pointSelector)\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\nexport async function createCylinder(cylinderMesh: CylinderMesh, pointSelector: PointSelector) {\n const container = cylinderMesh.parent\n\n await createCircle(cylinderMesh.bottomCircle, pointSelector)\n\n const lineHelper = new LineMesh()\n lineHelper.name = 'LineHelper'\n container.add(lineHelper)\n\n const lastPoint = pointSelector.position.point\n const normal = cylinderMesh.normal.clone().normalize()\n const startPoint = lastPoint.clone().add(normal.clone().multiplyScalar(100))\n const endPoint = lastPoint.clone().sub(normal.clone().multiplyScalar(100))\n lineHelper.setPoints([startPoint, endPoint])\n\n pointSelector.enable()\n\n return new Promise<void>((resolve, reject) => {\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n selectEnd()\n resolve()\n }\n\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n if (!intersection?.raycaster) return\n\n const pointOnLineHelper = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(startPoint, endPoint),\n })\n\n const bottomPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(cylinderMesh.normal, cylinderMesh.bottomCenter)\n\n const pointOnPlane = bottomPlane.projectPoint(pointOnLineHelper, new THREE.Vector3())\n const vector = pointOnLineHelper.clone().sub(pointOnPlane)\n const topCenter = cylinderMesh.bottomCenter.clone().add(vector)\n\n if (pointOnLineHelper) {\n cylinderMesh.setTopCenter(topCenter)\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n container.remove(lineHelper)\n pointSelector.disable()\n }\n\n const cancel = () => {\n selectEnd()\n container.remove(cylinderMesh)\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n })\n}\n","export function forReverseEach<T extends unknown[]>(array: T, func: (v: T[number]) => any) {\n for (let i = array.length - 1; i >= 0; i--) {\n func(array[i])\n }\n}\n","import type { SculptModules } from '../../utils/Modules/Global'\nimport { LineMesh, type LineData, type LineMeshStyle } from '../../Meshes/Line'\nimport { BaseObject, type BaseImportData, type BaseObjectConfig } from '../Base'\nimport * as THREE from 'three/webgpu'\nimport type { PointIntersection } from '../../../shared-utils'\nimport { LineEditor } from './Editor'\nimport type { PointSelector } from '../../../shared-utils/three/PointSelector'\nimport type { LiteralString } from '../../../typings/utils.type'\nimport vector3ToArray from '../../../shared-utils/three/vector3ToArray'\nimport type { CreateLimitConfig } from '../../typings/style'\nimport { LineWithDotsMesh } from '../../Meshes/LineWithDots'\nimport { rayOnLine } from '../../utils/three/rayOnLine'\nimport { withResolvers } from '../../../shared-utils/promise/withResolvers'\n\nexport interface LineImportData extends BaseImportData, LineData {\n type: LiteralString<'Line'>\n style?: Partial<LineMeshStyle>\n}\n\nexport class Line extends BaseObject<LineImportData> {\n public readonly type = 'Line'\n public lineMesh: LineWithDotsMesh\n\n public get editor() {\n if (!this._editor) {\n this._editor = new LineEditor(this)\n }\n return this._editor\n }\n\n public _editor: LineEditor\n\n private creatingObject?: ReturnType<typeof createLine>\n\n public get data() {\n return {\n ...this.baseData,\n points: vector3ToArray(this.applyObjectMatrixWorld(this.lineMesh.points)),\n style: {\n lineColor: new THREE.Color(this.lineMesh.color).getHex(),\n lineWidth: this.lineMesh.lineWidth,\n dashed: this.lineMesh.dashed,\n },\n }\n }\n\n public constructor(modules: SculptModules, data?: LineImportData, config?: Partial<BaseObjectConfig>) {\n super(modules, data, config)\n\n if (data) {\n this.lineMesh = new LineWithDotsMesh({ ...data.style, ...data })\n this.add(this.lineMesh)\n }\n }\n\n public setData(data: Partial<LineImportData>): void {\n if (data.points) this.lineMesh.setPoints(data.points)\n this.lineMesh.setStyle(data.style)\n }\n\n public highlight() {\n this.lineMesh?.highlight()\n }\n\n public unhighlight() {\n this.lineMesh?.unhighlight()\n }\n\n public canUndo() {\n return this.creatingObject?.canUndo() ?? false\n }\n\n public canRedo() {\n return this.creatingObject?.canRedo() ?? false\n }\n\n public undo() {\n this.creatingObject?.undo()\n }\n\n public redo() {\n this.creatingObject?.redo()\n }\n\n public async create(params?: Partial<LineMeshStyle & CreateLimitConfig>) {\n this.removeChildren()\n\n const lineMesh = new LineWithDotsMesh(params)\n this.lineMesh = lineMesh\n this.add(this.lineMesh)\n\n this.creatingObject = createLine(lineMesh, this.pointSelector, params)\n await this.creatingObject.finished\n\n if (this.config.defaultAction) this.editor.enable()\n }\n}\n\n/**\n * @description 绘制线段\n * @param config.limit 限制折线绘制的平面; `xoz` 限制在水平面; `y` 限制垂直面; `none` 不限制;默认 `none`\n */\nexport function createLine(lineMesh: LineMesh, pointSelector: PointSelector, config?: Partial<CreateLimitConfig>) {\n const container = lineMesh.parent\n if (!container) return\n\n const { promise, resolve, reject } = withResolvers<void>()\n\n const limit = config?.limit ?? 'none'\n\n const previewLine = new LineMesh(lineMesh.style)\n container.add(previewLine)\n\n // 垂直辅助线\n const verticalLine = new LineMesh({ ...lineMesh.style, dashed: true, lengthEnable: false })\n container.add(verticalLine)\n\n pointSelector.enable()\n\n const points: THREE.Vector3[] = []\n\n // 实时的预览点\n let previewPoint: THREE.Vector3\n let planeHelper: THREE.Plane\n\n let lastIntersection: PointIntersection\n\n const undoStack: THREE.Vector3[] = []\n\n const canUndo = () => points.length > 0\n\n const canRedo = () => undoStack.length > 0\n\n const undo = () => {\n if (!canUndo()) return\n undoStack.push(points.pop())\n lineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n const redo = () => {\n if (!canRedo()) return\n points.push(undoStack.pop())\n lineMesh.setPoints(points)\n onPreview(lastIntersection)\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n // 选点处理函数\n const onSelect = (intersection: PointIntersection) => {\n if (!intersection) return\n undoStack.length = 0 // 一旦有了新的动作,就要清空撤销栈\n const point = points.length === 0 ? intersection.point : previewPoint.clone()\n points.push(point)\n lineMesh.setPoints(points)\n if (points.length === 2) {\n selectEnd()\n resolve()\n }\n }\n // 预览\n const onPreview = (intersection: PointIntersection) => {\n const clearPreview = () => {\n previewLine.setPoints([])\n verticalLine.setPoints([])\n pointSelector.pointSelectorHelper.magnifier.render()\n }\n\n if (!points?.length) return clearPreview()\n if (!intersection) return clearPreview()\n\n lastIntersection = intersection\n\n const lastPoint = points.at(-1).clone()\n\n if (limit === 'none') {\n // 自由选点\n previewPoint = intersection.point\n previewLine.setPoints([lastPoint, previewPoint])\n } else if (limit === 'xoz') {\n // 水平面选点\n pointSelector.plane = planeHelper\n planeHelper = planeHelper ?? new THREE.Plane().setFromNormalAndCoplanarPoint(new THREE.Vector3(0, 1, 0), points[0])\n previewPoint = planeHelper.projectPoint(intersection.point, new THREE.Vector3())\n previewLine.setPoints([lastPoint, previewPoint])\n verticalLine.setPoints([previewPoint, intersection.point])\n } else if (limit === 'y') {\n if (!intersection.isVirtual) {\n // 真实点\n const line = new THREE.Line3(points[0].clone(), new THREE.Vector3(0, 1, 0).add(points[0]))\n previewPoint = line.closestPointToPoint(intersection.point, false, new THREE.Vector3())\n verticalLine.setPoints([previewPoint, intersection.point])\n } else {\n // 垂直面选点\n previewPoint = rayOnLine({\n raycaster: intersection.raycaster,\n line: new THREE.Line3(points[0].clone(), new THREE.Vector3(0, 1, 0).add(points[0])),\n clampToLine: false,\n })\n verticalLine.setPoints([])\n }\n previewLine.setPoints([lastPoint, previewPoint])\n // verticalLine.setPoints([previewPoint, intersection.point])\n }\n }\n\n const selectEnd = () => {\n pointSelector.off('select', onSelect)\n pointSelector.off('intersectionUpdate', onPreview)\n pointSelector.off('disable', cancel)\n pointSelector.plane = null\n pointSelector.disable()\n container?.remove(previewLine, verticalLine)\n }\n\n const cancel = () => {\n selectEnd()\n if (points.length !== 2) {\n container?.remove(lineMesh)\n }\n reject(new Error('Cancelled'))\n }\n\n pointSelector.on('select', onSelect)\n pointSelector.on('intersectionUpdate', onPreview)\n pointSelector.on('disable', cancel)\n\n return {\n finished: promise,\n canUndo,\n canRedo,\n undo,\n redo,\n }\n}\n","import { bindFiveOwner } from '../shared-utils/five/getFiveFromParentChain'\nimport type * as THREE from 'three/webgpu'\nimport type { Five } from '@realsee/five-webgpu'\nimport { SculptModules, bindObjectModules } from './utils/Modules/Global'\nimport type { BaseObject, BaseObjectConfig } from './Objects/Base'\nimport { Subscribe } from '../shared-utils/Subscribe'\nimport { IObject3D } from '../shared-utils/three/IObject3D'\nimport { notNil } from '../shared-utils'\nimport { recurveFindObject } from '../shared-utils/three/recurveFindObject'\n\nimport { Polyline } from './Objects/Polyline'\nimport { Point } from './Objects/Point'\nimport { Polygon } from './Objects/Polygon'\nimport { Prism } from './Objects/Prism'\nimport { Rectangle } from './Objects/Rectangle'\nimport { Circle } from './Objects/Circle'\nimport { Cylinder } from './Objects/Cylinder'\nimport { Box } from './Objects/Box'\n\nimport type { BuiltInData, BuiltInItem, SculptType } from './typings'\nimport { forReverseEach } from '../shared-utils/forReverseEach'\nimport { Line } from './Objects/Line'\nimport type { MagnifierParameter } from '../shared-utils/three/Magnifier'\n\nexport type { SculptData } from './typings'\nexport type { SculptType } from './typings'\nexport { createPoint } from './Objects/Point'\nexport { createLine } from './Objects/Line'\nexport { createPolyline } from './Objects/Polyline'\nexport { createPolygon } from './Objects/Polygon'\nexport { createPrism } from './Objects/Prism'\nexport { createRectangle } from './Objects/Rectangle'\nexport { createCircle } from './Objects/Circle'\nexport { createCylinder } from './Objects/Cylinder'\nexport { createBox } from './Objects/Box'\n\n/**\n * Sculpt 配置选项\n */\nexport interface SculptConfig {\n /**\n * @description 放大镜配置\n * 设置为 null 或 false 可禁用放大镜功能\n * @default *{ width: 190, height: 190, scale: 2, dragEnabled: true }*\n */\n magnifier?: MagnifierParameter | null | false\n /**\n * @description 是否隐藏鼠标光标旁边的圆圈效果\n * 设置为 true 时会隐藏圆圈效果\n * @default false\n */\n hideCursorCircle?: boolean\n /**\n * @description 是否自定义拾取点过滤函数\n * @default false\n */\n hitFilter?: (intersect: THREE.Intersection) => boolean\n}\n\ninterface Data {\n items: Array<BuiltInData>\n}\n\ntype Event = {\n /**\n * @description: 点击事件\n * @param {MouseEvent} e 鼠标事件\n * @param {BuiltInItem} item 点击的物体\n * 返回 false 来禁用 Five 默认行为\n */\n click: (e: MouseEvent, item: BuiltInItem) => void | false\n /**\n * @description 当 Polygon 创建时检测到自相交时触发(需开启 experimental_self_intersect_check)\n * @param item Polygon 实例\n * @param point 尝试添加但被拒绝的点坐标\n */\n 'polygon.experimental_self_intersect': (item: Polygon, point: THREE.Vector3) => void\n /**\n * @description polygon 将要添加到下一个点\n * @param item Polygon 实例\n * @param point polygon 将要添加到下一个点到坐标\n * @param points 当前已经绘制的点坐标(不包括即将添加的点)\n */\n 'polygon.experimental_point_will_add': (item: Polygon, point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description prism 将要添加到下一个点\n * @param item Prism 实例\n * @param point prism 将要添加到下一个点到坐标\n * @param points 当前已经绘制的点坐标(不包括即将添加的点)\n */\n 'prism.experimental_point_will_add': (item: Prism, point: THREE.Vector3, points: THREE.Vector3[]) => void\n /**\n * @description prism 检测到自相交时的回调\n * @param item Prism 实例\n * @param point 尝试添加但被拒绝的点坐标\n */\n 'prism.experimental_self_intersect': (item: Prism, point: THREE.Vector3) => void\n}\n\nexport class Sculpt extends Subscribe<Event> {\n public readonly modules: SculptModules\n private disposed = false\n private initialTabIndex: number\n\n public get data() {\n return {\n items: this.items\n .map((item) => {\n try {\n return item.data\n } catch (e) {\n console.error(e)\n return null\n }\n })\n .filter(notNil),\n }\n }\n\n public group: IObject3D\n\n public theme: SculptType.Theme\n\n public config: SculptConfig\n\n public get items() {\n return this.group.children as BuiltInItem[]\n }\n\n private five: Five\n\n private creatingItem: BaseObject | null = null\n\n public constructor(five: Five, theme?: SculptType.Theme, config?: SculptConfig) {\n super()\n\n this.five = five\n this.theme = theme\n this.config = {\n magnifier: { width: 190, height: 190, scale: 2, dragEnabled: true },\n ...config,\n }\n this.group = new IObject3D()\n this.group.name = 'Sculpt'\n // 添加对 Sculpt 实例的引用,方便编辑器访问\n bindFiveOwner(this.group, this.five)\n five.scene.add(this.group)\n this.modules = new SculptModules(five, this.config)\n bindObjectModules(this.group, this.modules)\n const element = five.getElement()\n this.initialTabIndex = element.tabIndex\n if (element.tabIndex < 0) element.tabIndex = 0\n element.addEventListener('pointerdown', this.focusScene)\n element.addEventListener('keydown', this.onKeyDown)\n five.on('dispose', this.dispose)\n\n this.modules.fiveDomEvents.addEventListener(this.group, 'click', ({ intersects, origDomEvent }) => {\n const item = recurveFindObject(intersects?.[0]?.object, (o) => (o as any).isSculptObject) as BaseObject\n\n if (item && !item.editing) {\n const result = this.emit('click', origDomEvent as any, item as any) // true: 用户希望阻止five事件,false: 用户希望继续five事件,也是默认值\n return result // 这个 boolean 好复杂啊,别轻易动\n } else {\n // 没点到东西时,返回 false 会允许five的默认事件\n return false\n }\n })\n\n }\n\n /**\n * @description: 销毁实例:清空内容、解绑全局快捷键、把 group 从场景移除\n */\n public dispose = () => {\n if (this.disposed) return\n this.disposed = true\n this.clear()\n this.five.off('dispose', this.dispose)\n const element = this.five.getElement()\n element.removeEventListener('pointerdown', this.focusScene)\n element.removeEventListener('keydown', this.onKeyDown)\n element.tabIndex = this.initialTabIndex\n this.modules.dispose()\n this.group.removeFromParent()\n this.off()\n }\n\n private focusScene = (event: PointerEvent) => {\n if ((event.target as HTMLElement)?.closest('input, textarea, select, [contenteditable=\"true\"]')) return\n this.five.getElement().focus({ preventScroll: true })\n }\n\n private onKeyDown = (event: KeyboardEvent) => {\n if ((event.target as HTMLElement)?.closest('input, textarea, select, [contenteditable=\"true\"]')) return\n if (event.key.toLowerCase() !== 'z' || !(event.ctrlKey || event.metaKey)) return\n event.preventDefault()\n if (event.shiftKey) this.redo()\n else this.undo()\n }\n\n /**\n * @description: 加载数据 展示\n */\n public load(data: Data, config?: Partial<BaseObjectConfig>) {\n const types = new Set(['Point', 'Line', 'line', 'Polyline', 'Polygon', 'Prism', 'Rectangle', 'Circle', 'Cylinder', 'Box'])\n if (!Array.isArray(data?.items) || data.items.some(item => !types.has(item.type))) throw new TypeError('Sculpt 数据包含不支持的几何类型')\n this.clear()\n\n const items = data.items.map((d: any) => {\n const dataWithdefaultStyle = {\n ...d,\n style: { ...this.theme?.[d.type.toLowerCase()], ...d.style },\n }\n\n if (d.type === 'Point') {\n return new Point(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Line' || d.type === 'line') {\n return new Line(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Polyline') {\n return new Polyline(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Polygon') {\n return new Polygon(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Prism') {\n return new Prism(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Rectangle') {\n return new Rectangle(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Circle') {\n return new Circle(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Cylinder') {\n return new Cylinder(this.modules, dataWithdefaultStyle, config)\n } else if (d.type === 'Box') {\n return new Box(this.modules, dataWithdefaultStyle, config)\n } else {\n return null\n }\n })\n\n this.group.add(...items)\n\n this.five.needsRender = true\n }\n\n /**\n * @description: 获取物体实例\n */\n public getItemById(id: string) {\n return this.items.find((item) => item.uuid === id)\n }\n\n /**\n * @description: 放置物体\n */\n public putObject(object: THREE.Object3D) {\n this.group.add(object)\n const object3DHelper = this.modules.object3DHelper\n const controllers = object3DHelper.addObject3DHelper(object)\n controllers?.moveController?.moveByMouse()\n return object3DHelper\n }\n\n /**\n * @description: 开始绘制点\n */\n public async createPoint(...params: Parameters<Point['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.point, params[0])\n return this.createItem(Point, ...params)\n }\n\n /**\n * @description: 开始绘制线段\n */\n public async createLine(...params: Parameters<Line['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.line, params[0])\n return this.createItem(Line, ...params)\n }\n\n /**\n * @description: 开始绘制空间折线\n */\n public async createPolyline(...params: Parameters<Polyline['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.polyline, params[0])\n return this.createItem(Polyline, ...params)\n }\n\n /**\n * @description: 开始绘制平面多边形\n */\n public async createPolygon(...params: Parameters<Polygon['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.polygon, params[0])\n // 注入 polygon.experimental_self_intersect 回调\n const config = params[0] ?? {}\n config.__onSelfIntersect = (point: THREE.Vector3) => {\n const item = this.creatingItem as Polygon\n this.emit('polygon.experimental_self_intersect', item, point)\n }\n config.__onWillAddPoint = (point: THREE.Vector3, points: THREE.Vector3[]) => {\n const item = this.creatingItem as Polygon\n this.emit('polygon.experimental_point_will_add', item, point, points)\n }\n params[0] = config\n return this.createItem(Polygon, ...params)\n }\n\n /**\n * @description: 开始绘制多棱柱\n */\n public async createPrism(...params: Parameters<Prism['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.prism, params[0])\n const config = params[0] ?? {}\n config.__onSelfIntersect = (point: THREE.Vector3) => {\n const item = this.creatingItem as Prism\n this.emit('prism.experimental_self_intersect', item, point)\n }\n config.__onWillAddPoint = (point: THREE.Vector3, points: THREE.Vector3[]) => {\n const item = this.creatingItem as Prism\n this.emit('prism.experimental_point_will_add', item, point, points)\n }\n params[0] = config\n return this.createItem(Prism, ...params)\n }\n\n /**\n * @description: 开始绘制矩形\n */\n public async createRectangle(...params: Parameters<Rectangle['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.rectangle, params[0])\n return this.createItem(Rectangle, ...params)\n }\n\n /**\n * @description: 开始绘制圆形\n */\n public async createCircle(...params: Parameters<Circle['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.circle, params[0])\n return this.createItem(Circle, ...params)\n }\n\n /**\n * @description: 开始绘制圆柱\n */\n public async createCylinder(...params: Parameters<Cylinder['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.cylinder, params[0])\n return this.createItem(Cylinder, ...params)\n }\n\n /**\n * @description: 开始绘制 Box\n */\n public async createBox(...params: Parameters<Box['create']>) {\n Object.assign(params[0] ?? {}, this.theme?.box, params[0])\n return this.createItem(Box, ...params)\n }\n\n public canUndo() {\n // 创建阶段:检查正在创建的对象\n if (this.creatingItem) {\n return this.creatingItem.canUndo()\n }\n\n // 编辑阶段:检查当前选中的物体\n const selectedItem = this.items.find(item => item.selected)\n if (selectedItem && typeof selectedItem.canUndo === 'function') {\n return selectedItem.canUndo()\n }\n\n return false\n }\n\n public canRedo() {\n // 创建阶段:检查正在创建的对象\n if (this.creatingItem) {\n return this.creatingItem.canRedo()\n }\n\n // 编辑阶段:检查当前选中的物体\n const selectedItem = this.items.find(item => item.selected)\n if (selectedItem && typeof selectedItem.canRedo === 'function') {\n return selectedItem.canRedo()\n }\n\n return false\n }\n\n /**\n * @description: 撤销\n */\n public undo = () => {\n // 创建阶段:撤销正在创建的对象\n if (this.creatingItem) {\n this.creatingItem.undo()\n this.five.needsRender = true\n return\n }\n\n // 编辑阶段:委托给当前选中的物体\n const selectedItem = this.items.find(item => item.selected && item.type === 'Polygon')\n if (selectedItem && typeof selectedItem.undo === 'function') {\n selectedItem.undo()\n this.five.needsRender = true\n }\n }\n\n /**\n * @description: 重做\n */\n public redo = () => {\n // 创建阶段:重做正在创建的对象\n if (this.creatingItem) {\n this.creatingItem.redo()\n this.five.needsRender = true\n return\n }\n\n // 编辑阶段:委托给当前选中的物体\n const selectedItem = this.items.find(item => item.selected && item.type === 'Polygon')\n if (selectedItem && typeof selectedItem.redo === 'function') {\n selectedItem.redo()\n this.five.needsRender = true\n }\n }\n\n\n\n /**\n * @description: 清空数据\n */\n public clear() {\n forReverseEach(this.items, (item) => item.delete())\n this.creatingItem = null\n this.five.needsRender = true\n }\n\n private async createItem<T extends BaseObject = any>(ItemClass: new (modules: SculptModules) => T, ...createParams: any) {\n if (this.creatingItem) {\n this.creatingItem.stopCreating()\n this.creatingItem = null\n }\n\n const item = new ItemClass(this.modules)\n this.creatingItem = item\n\n this.group.add(item)\n\n try {\n await item.create(...createParams)\n if (this.disposed || item.parent !== this.group) return undefined\n item.select({ only: true })\n return item\n } catch (error) {\n item.delete()\n throw error\n } finally {\n if (this.creatingItem === item) this.creatingItem = null\n }\n\n }\n}\n\n/**\n * @description: Sculpt 插件\n */\nexport const SculptPlugin = (five: Five, options?: { theme?: SculptType.Theme; config?: SculptConfig }) =>\n new Sculpt(five, options?.theme, options?.config)\n","export { SculptPlugin } from '../../Sculpt/index'\nexport type { SculptData, SculptType, SculptConfig } from '../../Sculpt/index'\nexport type { PrismStyle, PrismData } from '../../Sculpt/Meshes/Prism'\nexport type { LineMeshStyle, LineData } from '../../Sculpt/Meshes/Line'\nexport type { PointData, PointStyle } from '../../Sculpt/Meshes/Point'\nexport type { PointImportData, Line, LineImportData, Polyline, PolylineImportData, Polygon, PolygonImportData, Prism, PrismImportData, Rectangle, RectangleImportData, Circle, CircleImportData, Cylinder, CylinderImportData, Box, BoxImportData, PolylineStyle, RectangleStyle, CircleStyle, CylinderStyle, BoxStyle, AreaStyle, BuiltInData, BuiltInItem } from '../../Sculpt/typings'\n\nimport type { SculptPlugin as SculptPluginFactory } from '../../Sculpt/index'\nexport type SculptPluginInstance = ReturnType<typeof SculptPluginFactory>\n\nimport { PrismMesh } from '../../Sculpt/Meshes/Prism'\nimport type { Object3D } from 'three/webgpu'\n\n/** Identify plugin-created region meshes without exposing an internal constructor. */\nexport function isPrismMesh(object: Object3D): object is PrismMesh {\n return object instanceof PrismMesh\n}\n\nexport { Sculpt, createPoint, createLine } from '../../Sculpt/index'\nexport { LineMesh } from '../../Sculpt/Meshes/Line'\nexport { PointMesh } from '../../Sculpt/Meshes/Point'\nexport { LineWithDotsMesh } from '../../Sculpt/Meshes/LineWithDots'\nexport { PrismMesh } from '../../Sculpt/Meshes/Prism'\nexport { Cursor } from '../../Sculpt/utils/Modules/Cursor'\nexport { bindObjectModules } from '../../Sculpt/utils/Modules/Global'\nexport { getLengthHTML } from '../../Sculpt/utils/Meshes/getLengthHTML'\n"],"mappings":";;;;;;;;;;;;;;AAKA,IAAa4B,IAAb,cAAoCnB,EAA6B;CAC/D,IAAW,SAAS;EAClB,OAAO,KAAK,aAAa,aAAa;CACxC;CAEA,YAAmB,GAAwB;EACzC,MAAMoB,CAAY;CACpB;CAEA,UAAoB,MAAwB;EAC1C,IAAI,CAAC,KAAK,kBAAkB,KAAK,eAAe,WAAW,GAAG;EAC9D,IAAMC,IAAa7B,EAAwB,KAAK,QAAQ,MAAM8B,EAAM,SAAS;EAG7E,AADA,KAAK,eAAe,SAAS,MAAUC,EAAM,SAAS,KAAKF,EAAW,KAAK,CAAC,GAC5E,KAAK,aAAa,aAAa,UAAU,KAAK,YAAY,KAAK,MAAUE,EAAM,QAAQ,CAAC;CAC1F;AACF,GCFaC,IAAb,cAA8BC,EAA+B;CAC3D,OAAuB;CACvB;CAEA,IAAW,SAAS;EAIlB,OAHA,AACE,KAAK,YAAU,IAAIN,EAAe,IAAI,GAEjC,KAAK;CACd;CAEA;CAEA;CAEA,IAAW,OAAO;EAChB,OAAO;GACL,GAAG,KAAK;GACR,QAAQf,EAAe,KAAK,uBAAuB,KAAK,aAAa,MAAM,CAAC;GAC5E,OAAO;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