@mx-sose-front/mx-sose-graph 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +343 -0
- package/dist/index.d.ts +3937 -0
- package/dist/index.esm.js +74367 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +38 -0
- package/dist/index.umd.js.map +1 -0
- package/dist/style.css +1 -0
- package/package.json +70 -0
- package/src/components/ContextMenu.vue +475 -0
- package/src/components/Diagram/StrategicTaxonomyDiagram.vue +141 -0
- package/src/components/Edge/Edge.vue +366 -0
- package/src/components/InteractionLayer.vue +2033 -0
- package/src/components/Label.vue +0 -0
- package/src/components/LineStyle/ConnectionLine.vue +126 -0
- package/src/components/LineStyle/LineStyleMarker.vue +87 -0
- package/src/components/Pin/Pin.vue +220 -0
- package/src/components/Pin/Port.vue +172 -0
- package/src/components/Shape/Action.vue +121 -0
- package/src/components/Shape/ActivityAction.vue +155 -0
- package/src/components/Shape/Block.vue +306 -0
- package/src/components/Shape/ConceptualRole.vue +266 -0
- package/src/components/Shape/Diagram.vue +220 -0
- package/src/components/Shape/DividingLine.vue +594 -0
- package/src/components/Shape/DogEar.vue +224 -0
- package/src/components/Shape/Package.vue +340 -0
- package/src/constants/edgeShapeKeys.ts +81 -0
- package/src/constants/index.ts +440 -0
- package/src/index.ts +28 -0
- package/src/render/shape-registry.ts +17 -0
- package/src/render/shape-renderer.ts +103 -0
- package/src/statics/icons/childIcons/relations@3x.png +0 -0
- package/src/statics/icons/childIcons/role@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/345/217/267@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/346/201/257@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/344/277/241/346/201/257/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/217/202/346/225/260@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/217/202/346/225/260/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/345/257/271/350/261/241/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/211/247/350/241/214/350/200/205@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/216/245/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/216/247/345/210/266/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/264/273/345/212/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/212/266/346/200/201/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/253/257/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/272/246/346/235/237/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/347/273/223/346/236/204@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/350/207/252/347/224/261/345/210/206/347/261/273/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/350/277/236/351/200/232/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/270/232/345/212/241/351/253/230/347/272/247/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/345/217/202/346/225/260/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/347/212/266/346/200/201/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/347/272/246/346/235/237/345/233/276@3x-2.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/347/272/246/346/235/237/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//344/272/272/345/221/230/350/277/236/351/200/232/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/273/267/345/200/274/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//344/273/273/346/204/217/345/205/263/347/263/273@3x.png +0 -0
- package/src/statics/icons/childIcons//344/273/273/346/204/217/350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//344/274/201/344/270/232/344/275/277/345/221/275@3x.png +0 -0
- package/src/statics/icons/childIcons//344/274/201/344/270/232/345/205/250/347/224/237/345/221/275/345/221/250/346/234/237@3x.png +0 -0
- package/src/statics/icons/childIcons//344/274/201/344/270/232/346/204/277/346/231/257@3x.png +0 -0
- package/src/statics/icons/childIcons//344/274/201/344/270/232/347/233/256/346/240/207@3x.png +0 -0
- package/src/statics/icons/childIcons//344/275/215/347/275/256@3x.png +0 -0
- package/src/statics/icons/childIcons//344/275/223/347/263/273/346/236/266/346/236/204@3x.png +0 -0
- package/src/statics/icons/childIcons//344/276/235/350/265/226@3x.png +0 -0
- package/src/statics/icons/childIcons//344/277/235/346/212/244@3x.png +0 -0
- package/src/statics/icons/childIcons//344/277/241/346/201/257/346/250/241/345/236/213@3x.png +0 -0
- package/src/statics/icons/childIcons//345/210/233/351/200/240@3x.png +0 -0
- package/src/statics/icons/childIcons//345/212/237/350/203/275@3x.png +0 -0
- package/src/statics/icons/childIcons//345/212/237/350/203/275/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//345/212/237/350/203/275/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//345/212/237/350/203/275/345/257/271/350/261/241/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//345/212/237/350/203/275/346/216/247/345/210/266/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//345/217/214/345/220/221/345/205/263/350/201/224@3x.png +0 -0
- package/src/statics/icons/childIcons//345/217/227/345/210/260/345/275/261/345/223/215@3x.png +0 -0
- package/src/statics/icons/childIcons//345/234/260/347/220/206/346/224/277/346/262/273/350/214/203/345/233/264/347/261/273/345/236/213@3x.png +0 -0
- package/src/statics/icons/childIcons//345/241/253/345/206/231/350/201/214/344/275/215/347/224/263/350/257/267@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/216/247/345/210/266@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/350/277/236/351/200/232/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/351/232/224/347/246/273@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/211/345/205/250/351/243/216/351/231/251@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/232/345/220/221/345/205/263/347/263/273@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/232/345/220/221/345/205/263/350/201/224@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/232/345/220/221/347/273/204/346/210/220@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/232/345/220/221/350/201/232/345/220/210@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/344/272/272/345/221/230@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/344/274/201/344/270/232/351/230/266/346/256/265@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/344/275/215/347/275/256@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/345/261/236/346/200/247/350/256/276/347/275/256@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/346/210/230/347/225/245/351/230/266/346/256/265/347/224/230/347/211/271/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/346/214/201/347/273/255/344/273/273/345/212/241@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/346/234/215/345/212/241@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/346/235/241/344/273/266@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/347/216/257/345/242/203@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/347/273/204/347/273/207@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/201/214/344/275/215@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/201/214/350/264/243@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/264/243/344/273/273@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/344/270/216/345/256/236/351/231/205/351/241/271/347/233/256/345/257/271/345/272/224/345/205/263/347/263/273/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/346/246/202/345/277/265/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/350/265/204/346/272/220/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/344/270/216/350/203/275/345/212/233/347/232/204/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/351/207/214/347/250/213/347/242/221@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/351/241/271/347/233/256/351/207/214/347/250/213/347/242/221/346/261/207/346/200/273/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//345/256/236/351/231/205/351/243/216/351/231/251@3x.png +0 -0
- package/src/statics/icons/childIcons//345/261/225/347/244/272@3x.png +0 -0
- package/src/statics/icons/childIcons//345/267/262/347/237/245/350/265/204/346/272/220@3x.png +0 -0
- package/src/statics/icons/childIcons//345/274/200/345/261/225/345/267/245/344/275/234/350/203/275/345/212/233@3x.png +0 -0
- package/src/statics/icons/childIcons//345/274/225/347/224/250/345/261/236/346/200/247@3x.png +0 -0
- package/src/statics/icons/childIcons//345/275/261/345/223/215@3x-2.png +0 -0
- package/src/statics/icons/childIcons//345/275/261/345/223/215@3x.png +0 -0
- package/src/statics/icons/childIcons//346/204/277/346/231/257/345/256/243/350/250/200@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257/345/233/276@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/344/277/241/346/201/257/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/345/217/202/346/225/260/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/345/256/236/351/231/205/346/210/230/347/225/245/351/230/266/346/256/265/345/210/206/347/261/273/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/345/256/236/351/231/205/351/203/250/347/275/262/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/346/265/201/347/250/213/345/233/276@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/347/212/266/346/200/201/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/345/233/276@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/347/237/251/351/230/265@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/350/277/236/351/200/232/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//346/210/230/347/225/245/351/230/266/346/256/265@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/347/273/223/346/236/204/345/233/276@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/247/350/241/214/350/200/205/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/211/277/346/213/205/351/243/216/351/231/251@3x.png +0 -0
- package/src/statics/icons/childIcons//346/212/200/346/234/257@3x.png +0 -0
- package/src/statics/icons/childIcons//346/213/245/346/234/211/346/265/201/347/250/213@3x.png +0 -0
- package/src/statics/icons/childIcons//346/217/220/344/276/233/346/235/203/351/231/220@3x.png +0 -0
- package/src/statics/icons/childIcons//346/227/266/346/234/272@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/346/234/215/345/212/241/345/220/210/345/220/214/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/344/277/241/345/217/267@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/237/350/203/275@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/237/350/203/275/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/217/202/346/225/260@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/217/202/346/225/260/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/345/257/271/350/261/241/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/346/216/245/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/346/216/247/345/210/266/346/265/201@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/212/266/346/200/201/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/253/257/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/272/246/346/235/237/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/272/246/346/235/237/345/256/232/344/271/211/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/273/223/346/236/204@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/267/257/347/272/277/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/350/241/250@3x-2.png +0 -0
- package/src/statics/icons/childIcons//346/234/215/345/212/241/350/277/236/351/200/232/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/235/203/351/231/220@3x.png +0 -0
- package/src/statics/icons/childIcons//346/235/241/344/273/266@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/344/270/232/345/212/241/346/264/273/345/212/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/350/267/257/347/272/277/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/240/207/345/207/206/350/277/275/346/272/257/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//346/246/202/345/277/265/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//346/263/233/345/214/226@3x.png +0 -0
- package/src/statics/icons/childIcons//347/212/266/345/206/265@3x.png +0 -0
- package/src/statics/icons/childIcons//347/216/257/345/242/203@3x.png +0 -0
- package/src/statics/icons/childIcons//347/233/270/346/257/224@3x (1).png +0 -0
- package/src/statics/icons/childIcons//347/263/273/347/273/237@3x.png +0 -0
- package/src/statics/icons/childIcons//347/273/204/346/210/220@3x.png +0 -0
- package/src/statics/icons/childIcons//347/273/204/347/273/207@3x.png +0 -0
- package/src/statics/icons/childIcons//347/273/204/347/273/207/351/230/266/346/256/265@3x.png +0 -0
- package/src/statics/icons/childIcons//347/273/221/345/256/232/350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//347/274/223/350/247/243@3x.png +0 -0
- package/src/statics/icons/childIcons//350/201/214/344/275/215@3x.png +0 -0
- package/src/statics/icons/childIcons//350/201/232/345/220/210@3x.png +0 -0
- package/src/statics/icons/childIcons//350/203/275/345/212/233@3x.png +0 -0
- package/src/statics/icons/childIcons//350/203/275/345/212/233/350/201/214/350/264/243@3x.png +0 -0
- package/src/statics/icons/childIcons//350/203/275/345/212/233/351/205/215/347/275/256@3x.png +0 -0
- package/src/statics/icons/childIcons//350/203/275/345/244/237/350/203/234/344/273/273@3x.png +0 -0
- package/src/statics/icons/childIcons//350/207/252/347/204/266/350/265/204/346/272/220@3x.png +0 -0
- package/src/statics/icons/childIcons//350/246/201/346/261/202@3x.png +0 -0
- package/src/statics/icons/childIcons//350/256/276/347/275/256/347/261/273/345/236/213.png +0 -0
- package/src/statics/icons/childIcons//350/264/237/350/264/243@3x.png +0 -0
- package/src/statics/icons/childIcons//350/264/243/344/273/273@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/344/272/247/351/243/216/351/231/251/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/344/270/216/344/270/232/345/212/241/346/264/273/345/212/250/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/344/270/216/350/203/275/345/212/233/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/345/217/267@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/346/201/257@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/344/277/241/346/201/257/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/206/205/351/203/250/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/217/202/346/225/260@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/217/202/346/225/260/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/345/267/245/344/273/266@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/216/245/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/234/215/345/212/241@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/236/266/346/236/204@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/264/273/345/212/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/264/273/345/212/250/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/212/266/346/200/201/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/253/257/345/217/243@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/272/246/346/235/237@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/273/223/346/236/204@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/347/274/223/350/247/243/346/216/252/346/226/275@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//350/265/204/346/272/220/350/277/236/351/200/232/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//350/275/257/344/273/266@3x.png +0 -0
- package/src/statics/icons/childIcons//350/276/223/345/205/245/346/240/223@3x.png +0 -0
- package/src/statics/icons/childIcons//350/276/223/345/207/272/346/240/223@3x.png +0 -0
- package/src/statics/icons/childIcons//350/276/276/345/210/260@3x.png +0 -0
- package/src/statics/icons/childIcons//350/277/236/346/216/245/345/231/250@3x.png +0 -0
- package/src/statics/icons/childIcons//350/277/236/347/272/277@3x.png +0 -0
- package/src/statics/icons/childIcons//351/207/214/347/250/213/347/242/221/344/276/235/350/265/226@3x.png +0 -0
- package/src/statics/icons/childIcons//351/230/266/346/256/265@3x.png +0 -0
- package/src/statics/icons/childIcons//351/234/200/346/261/202/346/235/203/351/231/220@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/266/347/272/247/344/270/232/345/212/241/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/344/270/273/351/242/230@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/345/206/205/351/203/250/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/246/202/345/277/265/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/246/202/345/277/265/350/241/250@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250/344/270/216/350/203/275/345/212/233/347/232/204/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/264/273/345/212/250/345/212/250/344/275/234@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/346/265/201/347/250/213/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/347/273/223/346/236/204/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/350/267/257/347/272/277/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/350/277/236/351/200/232/345/233/276@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/351/207/214/347/250/213/347/242/221@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/271/347/233/256/351/207/214/347/250/213/347/242/221/350/247/222/350/211/262@3x.png +0 -0
- package/src/statics/icons/childIcons//351/241/272/345/272/217@3x-2.png +0 -0
- package/src/statics/icons/childIcons//351/241/272/345/272/217@3x.png +0 -0
- package/src/statics/icons/childIcons//351/243/216/351/231/251@3x.png +0 -0
- package/src/statics/icons/childIcons//351/243/216/351/231/251/344/270/216/345/256/211/345/205/250/346/216/247/345/210/266/346/230/240/345/260/204/347/237/251/351/230/265@3x.png +0 -0
- package/src/statics/icons/childIcons//351/253/230/347/272/247/344/270/232/345/212/241/346/246/202/345/277/265@3x.png +0 -0
- package/src/statics/icons/createMenu/config.png +0 -0
- package/src/statics/icons/createMenu/contact.png +0 -0
- package/src/statics/icons/createMenu/copy.png +0 -0
- package/src/statics/icons/createMenu/delete.png +0 -0
- package/src/statics/icons/createMenu/diagram.png +0 -0
- package/src/statics/icons/createMenu/element.png +0 -0
- package/src/statics/icons/createMenu/locateChart.png +0 -0
- package/src/statics/icons/createMenu/paste.png +0 -0
- package/src/statics/icons/createMenu/rename.png +0 -0
- package/src/statics/icons/createMenu/scissors.png +0 -0
- package/src/store/eventBus.ts +38 -0
- package/src/store/graphStore.ts +782 -0
- package/src/store/index.ts +8 -0
- package/src/style/index.css +1 -0
- package/src/style/tailwind.css +33 -0
- package/src/types/index.ts +200 -0
- package/src/utils/autoExpandParent.ts +94 -0
- package/src/utils/colorUtils.ts +137 -0
- package/src/utils/compartment.ts +534 -0
- package/src/utils/containers.ts +910 -0
- package/src/utils/diagram.ts +403 -0
- package/src/utils/dom.ts +21 -0
- package/src/utils/drag.ts +224 -0
- package/src/utils/edgeUtils.ts +787 -0
- package/src/utils/geom.ts +177 -0
- package/src/utils/graphDragService.ts +329 -0
- package/src/utils/highlightUtils.ts +162 -0
- package/src/utils/hittest.ts +135 -0
- package/src/utils/iconLoader.ts +105 -0
- package/src/utils/index.ts +20 -0
- package/src/utils/packgeMap.ts +1 -0
- package/src/utils/pinUtils.ts +484 -0
- package/src/utils/policy.ts +212 -0
- package/src/utils/zorder.ts +39 -0
- package/src/view/graph.vue +419 -0
- package/src/vite-env.d.ts +33 -0
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
// 坐标与数值工具
|
|
2
|
+
import type { Shape } from '@/types'
|
|
3
|
+
import { useGraphStore } from '../store/graphStore'
|
|
4
|
+
// 夹取:把 v 限制在 [min, max] 区间
|
|
5
|
+
export const clamp = (v: number, min: number, max: number) =>
|
|
6
|
+
Math.min(max, Math.max(min, v))
|
|
7
|
+
|
|
8
|
+
// client 坐标转换到某容器元素 el 的本地坐标
|
|
9
|
+
export const toLocalPoint = (evt: MouseEvent, el: HTMLElement | null) => {
|
|
10
|
+
if (!el) return { x: evt.clientX, y: evt.clientY }
|
|
11
|
+
const rect = el.getBoundingClientRect()
|
|
12
|
+
// 获取当前缩放比例
|
|
13
|
+
const graphStore = useGraphStore()
|
|
14
|
+
const scale = graphStore.getScale() || 1
|
|
15
|
+
// 计算本地坐标并除以缩放比例
|
|
16
|
+
return {
|
|
17
|
+
x: (evt.clientX - rect.left) / scale,
|
|
18
|
+
y: (evt.clientY - rect.top) / scale
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// 点是否位于矩形边界内
|
|
23
|
+
export const inBounds = (
|
|
24
|
+
pt: { x: number; y: number },
|
|
25
|
+
b?: { x?: number; y?: number; width?: number; height?: number }
|
|
26
|
+
) => {
|
|
27
|
+
if (!b) return false
|
|
28
|
+
const x = b.x ?? 0, y = b.y ?? 0, w = b.width ?? 0, h = b.height ?? 0
|
|
29
|
+
return pt.x >= x && pt.x <= x + w && pt.y >= y && pt.y <= y + h
|
|
30
|
+
}
|
|
31
|
+
export type Point = { x: number; y: number }
|
|
32
|
+
export type Rect = { x: number; y: number; width: number; height: number }
|
|
33
|
+
export type Bounds = { x: number; y: number; width: number; height: number }
|
|
34
|
+
export type ContainerRect = { left: number; top: number; right: number; bottom: number }
|
|
35
|
+
/**
|
|
36
|
+
* 从 Shape(或包含 bounds 的对象)中取出完整的矩形,缺省值补 0
|
|
37
|
+
*/
|
|
38
|
+
export const getBounds = (s?: { bounds?: Partial<Rect> } | null): Rect => {
|
|
39
|
+
const b = s?.bounds ?? {}
|
|
40
|
+
return {
|
|
41
|
+
x: b.x ?? 0,
|
|
42
|
+
y: b.y ?? 0,
|
|
43
|
+
width: b.width ?? 0,
|
|
44
|
+
height: b.height ?? 0,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 从全量 shapes 中找出画布(diagram)的包围框;没有画布则返回无限大容器(表示不限制)
|
|
49
|
+
export function getDiagramRect(shapes: any[]): ContainerRect {
|
|
50
|
+
const d = shapes.find(
|
|
51
|
+
(s: any) => String(s?.shapeType ?? '').trim().toLowerCase() === 'diagram'
|
|
52
|
+
)
|
|
53
|
+
if (!d) return { left: -Infinity, top: -Infinity, right: Infinity, bottom: Infinity }
|
|
54
|
+
const b = getBounds(d)
|
|
55
|
+
return { left: b.x, top: b.y, right: b.x + b.width, bottom: b.y + b.height }
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 哪些边需要限制(左/上/右/下 任意组合)
|
|
59
|
+
export type EdgeFlags = { left?: boolean; top?: boolean; right?: boolean; bottom?: boolean }
|
|
60
|
+
export function clampPointToRect(
|
|
61
|
+
pt: { x: number; y: number },
|
|
62
|
+
elem: Bounds,
|
|
63
|
+
container: ContainerRect,
|
|
64
|
+
edges: EdgeFlags
|
|
65
|
+
) {
|
|
66
|
+
let { x, y } = pt
|
|
67
|
+
if (edges.left) x = Math.max(container.left, x)
|
|
68
|
+
if (edges.top) y = Math.max(container.top, y)
|
|
69
|
+
if (edges.right) x = Math.min(x, container.right - elem.width)
|
|
70
|
+
if (edges.bottom) y = Math.min(y, container.bottom - elem.height)
|
|
71
|
+
return { x, y }
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** 缩放手柄方向 */
|
|
75
|
+
export type Handle = "nw" | "ne" | "sw" | "se"
|
|
76
|
+
// 将矩形 按最小尺寸约束后,按需限制在容器内(按 edges 控制四边)。
|
|
77
|
+
export function clampRectToContainer(
|
|
78
|
+
r: Rect,
|
|
79
|
+
container: ContainerRect,
|
|
80
|
+
edges: EdgeFlags,
|
|
81
|
+
minW: number,
|
|
82
|
+
minH: number
|
|
83
|
+
): Rect {
|
|
84
|
+
let { x, y, width, height } = r
|
|
85
|
+
|
|
86
|
+
// 最小尺寸约束
|
|
87
|
+
width = Math.max(minW, width)
|
|
88
|
+
height = Math.max(minH, height)
|
|
89
|
+
|
|
90
|
+
// 位置约束(基于最终尺寸)
|
|
91
|
+
if (edges.left) x = Math.max(x, container.left)
|
|
92
|
+
if (edges.top) y = Math.max(y, container.top)
|
|
93
|
+
if (edges.right) x = Math.min(x, container.right - width)
|
|
94
|
+
if (edges.bottom) y = Math.min(y, container.bottom - height)
|
|
95
|
+
|
|
96
|
+
return { x, y, width, height }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 计算拖动预览:基于按下点与当前点的位移,得到下一帧矩形,
|
|
101
|
+
* 仅改变位置(x/y),并按容器与 edges 做位置约束。
|
|
102
|
+
*/
|
|
103
|
+
export function ghostDragStep(
|
|
104
|
+
base: Rect, // 按下时的元素矩形
|
|
105
|
+
anchor: Point, // 按下时指针(本地坐标)
|
|
106
|
+
curr: Point, // 当前指针(本地坐标)
|
|
107
|
+
container: ContainerRect, // 画布容器(left/top/right/bottom)
|
|
108
|
+
edges: EdgeFlags // 限制哪几条边
|
|
109
|
+
): Rect {
|
|
110
|
+
const dx = curr.x - anchor.x
|
|
111
|
+
const dy = curr.y - anchor.y
|
|
112
|
+
let nx = base.x + dx
|
|
113
|
+
let ny = base.y + dy
|
|
114
|
+
|
|
115
|
+
// 仅对位置做夹取(尺寸用 base 参与计算,以防越界)
|
|
116
|
+
;({ x: nx, y: ny } = clampPointToRect(
|
|
117
|
+
{ x: nx, y: ny },
|
|
118
|
+
base, // 用 base 的 width/height 作为“被约束元素”
|
|
119
|
+
container,
|
|
120
|
+
edges
|
|
121
|
+
))
|
|
122
|
+
|
|
123
|
+
return { x: nx, y: ny, width: base.width, height: base.height }
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* 计算缩放预览:基于手柄方向与指针位移得到下一帧矩形,
|
|
128
|
+
* 保持对角锚点不动,应用最小尺寸与容器约束。
|
|
129
|
+
*/
|
|
130
|
+
export function ghostResizeStep(
|
|
131
|
+
base: Rect, // 按下时的元素矩形
|
|
132
|
+
handle: Handle, // 手柄方向:"nw" | "ne" | "sw" | "se"
|
|
133
|
+
anchor: Point, // 按下时指针(本地坐标)
|
|
134
|
+
curr: Point, // 当前指针(本地坐标)
|
|
135
|
+
container: ContainerRect, // 画布容器
|
|
136
|
+
edges: EdgeFlags, // 限制哪几条边
|
|
137
|
+
minW: number, // 最小宽
|
|
138
|
+
minH: number // 最小高
|
|
139
|
+
): Rect {
|
|
140
|
+
const dx = curr.x - anchor.x
|
|
141
|
+
const dy = curr.y - anchor.y
|
|
142
|
+
|
|
143
|
+
// 依据手柄方向决定宽高增量(右/下为正,左/上为负)
|
|
144
|
+
let w = base.width + (handle.includes("e") ? dx : -dx)
|
|
145
|
+
let h = base.height + (handle.includes("s") ? dy : -dy)
|
|
146
|
+
|
|
147
|
+
// 先做最小尺寸约束,避免回算位置时出现错位
|
|
148
|
+
w = Math.max(minW, w)
|
|
149
|
+
h = Math.max(minH, h)
|
|
150
|
+
|
|
151
|
+
// 对角点保持不动,回算 x/y
|
|
152
|
+
const right = base.x + base.width
|
|
153
|
+
const bottom = base.y + base.height
|
|
154
|
+
let x = handle.includes("w") ? right - w : base.x
|
|
155
|
+
let y = handle.includes("n") ? bottom - h : base.y
|
|
156
|
+
|
|
157
|
+
// 最终做容器约束(会再次考虑尺寸变化)
|
|
158
|
+
return clampRectToContainer({ x, y, width: w, height: h }, container, edges, minW, minH)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// 由两点生成包围矩形(支持反向拖拽)
|
|
162
|
+
export function rectFromPoints(a: {x:number;y:number}, b:{x:number;y:number}) {
|
|
163
|
+
const x = Math.min(a.x, b.x)
|
|
164
|
+
const y = Math.min(a.y, b.y)
|
|
165
|
+
const w = Math.abs(a.x - b.x)
|
|
166
|
+
const h = Math.abs(a.y - b.y)
|
|
167
|
+
return { x, y, width: w, height: h }
|
|
168
|
+
}
|
|
169
|
+
//完全包含
|
|
170
|
+
export function rectContainsRect(outer: Rect, inner: Rect) {
|
|
171
|
+
return (
|
|
172
|
+
inner.x >= outer.x &&
|
|
173
|
+
inner.y >= outer.y &&
|
|
174
|
+
inner.x + inner.width <= outer.x + outer.width &&
|
|
175
|
+
inner.y + inner.height <= outer.y + outer.height
|
|
176
|
+
);
|
|
177
|
+
}
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import type { OwnerPayload, Shape, ShapeSizeUpdatePayload } from "@/types"
|
|
2
|
+
import { collectDescendantIds, expandParentToFitChildBounds, type Rect } from "./containers"
|
|
3
|
+
import { useGraphStore } from '../store/graphStore'
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
import { eventBus } from '../store/eventBus'
|
|
6
|
+
import { getUuid } from "../utils/index";
|
|
7
|
+
import { addChildShapeToCompartment, isCompartment, isShapeTypeNotInPackageTypes, removeChildShapeFromCompartment } from "./compartment";
|
|
8
|
+
import { autoExpandCompartmentAfterMoved } from "./autoExpandParent";
|
|
9
|
+
|
|
10
|
+
// 父 id 快照
|
|
11
|
+
type PrevParentMap = Record<string, string | null>
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* 根据 changedIds 记录“拖动前”的父 id 映射
|
|
15
|
+
*/
|
|
16
|
+
export const buildPrevParentMap = (shapes: Shape[], changedIds: string[]): PrevParentMap => {
|
|
17
|
+
const map: PrevParentMap = {}
|
|
18
|
+
for (const id of changedIds) {
|
|
19
|
+
const before = shapes.find(s => s.id === id)
|
|
20
|
+
map[id] = before?.parenShapeId ?? null
|
|
21
|
+
}
|
|
22
|
+
return map
|
|
23
|
+
}
|
|
24
|
+
// 判断某个类型是否在 classMetaTypes 中
|
|
25
|
+
const isClassMetaType = (type?: string | null) => {
|
|
26
|
+
const graphStore = useGraphStore()
|
|
27
|
+
if (!type) return false
|
|
28
|
+
// 统一转成小写,避免大小写问题
|
|
29
|
+
const lower = String(type).toLowerCase()
|
|
30
|
+
return graphStore.classMetaTypes
|
|
31
|
+
.map(t => String(t).toLowerCase())
|
|
32
|
+
.includes(lower)
|
|
33
|
+
}
|
|
34
|
+
// 根据业务规则,决定“拖到父元素里时,是移动自己,还是在父元素里生成一个新副本”
|
|
35
|
+
const shouldCloneOnNest = (child: Shape, parent: Shape): boolean => {
|
|
36
|
+
const childKey = (child as any).shapeKey || ''
|
|
37
|
+
const parentKey = (parent as any).shapeKey || ''
|
|
38
|
+
|
|
39
|
+
// 只有“父 + 子 都在 classMetaTypes” 且 “都有 modelId(已经在画布上)” 才克隆
|
|
40
|
+
return (
|
|
41
|
+
isClassMetaType(childKey) &&
|
|
42
|
+
isClassMetaType(parentKey)
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 处理“换父 + 克隆 + comparents”的业务
|
|
47
|
+
* - 负责 finalCheckCanNest
|
|
48
|
+
* - 负责克隆 & emit('addShape')
|
|
49
|
+
* - 负责 comparents add/remove
|
|
50
|
+
* - 产生 ownerPayload / clonedIds
|
|
51
|
+
* - 若嵌套不通过,会返回 { cancelled: true }
|
|
52
|
+
*/
|
|
53
|
+
export async function applyReparentAndClone(options: {
|
|
54
|
+
shapes: Shape[]
|
|
55
|
+
changedIds: string[]
|
|
56
|
+
prevParentById: PrevParentMap
|
|
57
|
+
source?: string
|
|
58
|
+
dragBase: Record<string, Rect>
|
|
59
|
+
updateShape: (id: string, updates: Partial<Shape>) => void
|
|
60
|
+
pendingNestedIds: { value: string[] }
|
|
61
|
+
addShape: (s: Shape) => void
|
|
62
|
+
}): Promise<{
|
|
63
|
+
ownerPayload: OwnerPayload | null
|
|
64
|
+
clonedIds: string[]
|
|
65
|
+
cancelled: boolean
|
|
66
|
+
}> {
|
|
67
|
+
const {
|
|
68
|
+
shapes,
|
|
69
|
+
changedIds,
|
|
70
|
+
prevParentById,
|
|
71
|
+
source,
|
|
72
|
+
dragBase,
|
|
73
|
+
updateShape,
|
|
74
|
+
pendingNestedIds,
|
|
75
|
+
addShape,
|
|
76
|
+
} = options
|
|
77
|
+
const graphStore = useGraphStore()
|
|
78
|
+
let ownerPayload: OwnerPayload | null = null
|
|
79
|
+
const clonedIds: string[] = []
|
|
80
|
+
|
|
81
|
+
for (const id of changedIds) {
|
|
82
|
+
const after = shapes.find(s => s.id === id)
|
|
83
|
+
if (!after) continue
|
|
84
|
+
|
|
85
|
+
const beforePid = prevParentById[id]
|
|
86
|
+
const afterPid = after.parenShapeId ?? null
|
|
87
|
+
|
|
88
|
+
if (beforePid !== afterPid) {
|
|
89
|
+
// === 1) 嵌套权限最终校验 ===
|
|
90
|
+
if (source === 'addEntity') {
|
|
91
|
+
pendingNestedIds.value.push(after.id)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const pass = await graphStore.finalCheckCanNest(id, afterPid)
|
|
95
|
+
if (!pass) {
|
|
96
|
+
// 撤销 reparent(恢复父 + 位置)
|
|
97
|
+
updateShape(id, { parenShapeId: beforePid || '' })
|
|
98
|
+
const base = dragBase[id]
|
|
99
|
+
if (base) {
|
|
100
|
+
updateShape(id, { bounds: { ...base } })
|
|
101
|
+
}
|
|
102
|
+
return { ownerPayload: null, clonedIds, cancelled: true }
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
const parent = shapes.find(s => s.id === afterPid)
|
|
106
|
+
if (!parent) continue
|
|
107
|
+
|
|
108
|
+
// === 2) 克隆 + 嵌套 逻辑 ===
|
|
109
|
+
if (shouldCloneOnNest(after, parent) && !source) {
|
|
110
|
+
// 维护 pendingNestedIds
|
|
111
|
+
if (!Array.isArray(pendingNestedIds.value)) {
|
|
112
|
+
pendingNestedIds.value = []
|
|
113
|
+
} else {
|
|
114
|
+
const idx = pendingNestedIds.value.indexOf(after.id)
|
|
115
|
+
if (idx !== -1) pendingNestedIds.value.splice(idx, 1)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const dropBounds = { ...after.bounds }
|
|
119
|
+
const newId = getUuid()
|
|
120
|
+
const clonedShape: Shape = _.cloneDeep(after) as Shape
|
|
121
|
+
clonedShape.id = newId
|
|
122
|
+
; (clonedShape as any).parenShapeId = parent.id
|
|
123
|
+
|
|
124
|
+
// 还原原图元
|
|
125
|
+
const baseBounds = dragBase[id]
|
|
126
|
+
updateShape(id, {
|
|
127
|
+
parenShapeId: prevParentById[id] || '',
|
|
128
|
+
bounds: baseBounds ? { ...baseBounds } : dropBounds,
|
|
129
|
+
})
|
|
130
|
+
|
|
131
|
+
// 放进画布
|
|
132
|
+
addShape(clonedShape)
|
|
133
|
+
pendingNestedIds.value.push(newId)
|
|
134
|
+
|
|
135
|
+
// 设置克隆图元的最终父 + 位置
|
|
136
|
+
updateShape(newId, {
|
|
137
|
+
parenShapeId: parent.id || '',
|
|
138
|
+
bounds: dropBounds,
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
const cloneInStore = shapes.find(s => s.id === newId) || clonedShape
|
|
142
|
+
const shapeDataForAdd: any = _.cloneDeep(cloneInStore)
|
|
143
|
+
const payloadData: any = {
|
|
144
|
+
coordinate: {
|
|
145
|
+
clientX: dropBounds.x,
|
|
146
|
+
clientY: dropBounds.y,
|
|
147
|
+
},
|
|
148
|
+
shapeData: shapeDataForAdd,
|
|
149
|
+
type: 'treeNode',
|
|
150
|
+
nodeType: cloneInStore.shapeKey,
|
|
151
|
+
icon: cloneInStore.icon,
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
await new Promise<void>((resolve, reject) => {
|
|
155
|
+
eventBus.emit('addShape', {
|
|
156
|
+
...payloadData,
|
|
157
|
+
resolve,
|
|
158
|
+
reject,
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
clonedIds.push(newId)
|
|
163
|
+
|
|
164
|
+
// ownerPayload:克隆场景
|
|
165
|
+
const latestClone = shapes.find(s => s.id === newId) || cloneInStore
|
|
166
|
+
const childModelId = String((latestClone as any).modelId || '')
|
|
167
|
+
const ownerId = String((parent as any).modelId || '')
|
|
168
|
+
const ownerType = String((parent as any).shapeKey || '')
|
|
169
|
+
|
|
170
|
+
if (childModelId && ownerId && ownerType) {
|
|
171
|
+
ownerPayload = {
|
|
172
|
+
id: childModelId,
|
|
173
|
+
ownerId,
|
|
174
|
+
ownerType,
|
|
175
|
+
shapeId: newId,
|
|
176
|
+
} as any
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// 克隆场景走完,下面“非克隆 ownerPayload 逻辑”不再参与
|
|
180
|
+
continue
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// === 3) 非克隆场景的 ownerPayload ===
|
|
184
|
+
const childModelId = String((after as any).modelId || '')
|
|
185
|
+
const ownerId = String((parent as any).modelId || '')
|
|
186
|
+
const ownerType = String((parent as any).shapeKey || '')
|
|
187
|
+
|
|
188
|
+
if (childModelId && ownerId && ownerType) {
|
|
189
|
+
ownerPayload = {
|
|
190
|
+
id: childModelId,
|
|
191
|
+
ownerId,
|
|
192
|
+
ownerType,
|
|
193
|
+
shapeId: after.id,
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// === 4) comparents:老父移除,新父添加 ===
|
|
198
|
+
if (beforePid) {
|
|
199
|
+
const oldP = shapes.find(s => s.id === beforePid)
|
|
200
|
+
if (oldP && isShapeTypeNotInPackageTypes(oldP)) {
|
|
201
|
+
removeChildShapeFromCompartment(oldP, after, updateShape)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (afterPid) {
|
|
205
|
+
const newP = shapes.find(s => s.id === afterPid)
|
|
206
|
+
if (newP && isShapeTypeNotInPackageTypes(newP)) {
|
|
207
|
+
addChildShapeToCompartment(newP, after, updateShape)
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
} else {
|
|
211
|
+
// 父未变化:若父是隔间,确保 comparents 中有它(幂等)
|
|
212
|
+
if (afterPid) {
|
|
213
|
+
const p = shapes.find(s => s.id === afterPid)
|
|
214
|
+
if (p && isShapeTypeNotInPackageTypes(p)) {
|
|
215
|
+
addChildShapeToCompartment(p, after, updateShape)
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return { ownerPayload, clonedIds, cancelled: false }
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* 对“本次被拖动的隔间组件”做一次自动扩容检查
|
|
226
|
+
* - 用于你现在说的:父已经贴到画布顶部了,之后拖下来有空间,要再扩一次把子从头部/内容区顶出来
|
|
227
|
+
*/
|
|
228
|
+
export const autoExpandMovedCompartmentsAfterDrag = (
|
|
229
|
+
shapes: Shape[],
|
|
230
|
+
changedIds: string[],
|
|
231
|
+
updateShape: (id: string, updates: Partial<Shape>) => void,
|
|
232
|
+
) => {
|
|
233
|
+
const movedCompartmentIds = changedIds.filter(id => {
|
|
234
|
+
const shape = shapes.find(s => s.id === id)
|
|
235
|
+
return shape && isCompartment(shape)
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
for (const cid of movedCompartmentIds) {
|
|
239
|
+
autoExpandCompartmentAfterMoved(shapes, cid, updateShape)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 收集拖动影响到的所有 shape id
|
|
245
|
+
* - changedIds / clonedIds 本身
|
|
246
|
+
* - 这些节点的父节点 + 子树
|
|
247
|
+
* - 所有这些节点的祖先链
|
|
248
|
+
*/
|
|
249
|
+
export const collectAffectedShapeIds = (shapes: Shape[], changedIds: string[], clonedIds: string[]): Set<string> => {
|
|
250
|
+
const affected = new Set<string>()
|
|
251
|
+
const allChanged = [...changedIds, ...clonedIds]
|
|
252
|
+
|
|
253
|
+
for (const id of allChanged) {
|
|
254
|
+
affected.add(id)
|
|
255
|
+
const parentId = shapes.find(s => s.id === id)?.parenShapeId ?? null
|
|
256
|
+
if (parentId) {
|
|
257
|
+
affected.add(parentId)
|
|
258
|
+
collectDescendantIds(shapes, parentId).forEach(cid => affected.add(cid))
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
for (const id of Array.from(affected)) {
|
|
263
|
+
let cur: string | null = id
|
|
264
|
+
let guard = 0
|
|
265
|
+
while (cur && guard++ < 1000) {
|
|
266
|
+
const s = shapes.find(x => x.id === cur)
|
|
267
|
+
const p = s ? (s as any).parenShapeId ?? null : null
|
|
268
|
+
if (!p) break
|
|
269
|
+
affected.add(p)
|
|
270
|
+
cur = p
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return affected
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* 根据 affectedIds 生成 deep 拷贝后的 payloads
|
|
279
|
+
* (发给 shape-drag-end 用)
|
|
280
|
+
*/
|
|
281
|
+
export const buildDragEndPayloads = (affectedIds: Set<string>, shapes: Shape[]): Shape[] => {
|
|
282
|
+
return Array.from(affectedIds)
|
|
283
|
+
.map(id => shapes.find(s => s.id === id))
|
|
284
|
+
.filter((s): s is Shape => !!s)
|
|
285
|
+
.map(s => _.cloneDeep(s))
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 创建 onNestDone 回调
|
|
290
|
+
* - 只在嵌套接口成功时,再进行“按子扩父 + shape-size-update”
|
|
291
|
+
*/
|
|
292
|
+
export const createOnNestDoneCallback = (options: {
|
|
293
|
+
shapesRef: { value: Shape[] }
|
|
294
|
+
ownerPayload: OwnerPayload | null
|
|
295
|
+
updateShape: (id: string, updates: Partial<Shape>) => void
|
|
296
|
+
}): (ok: boolean) => void => {
|
|
297
|
+
const { shapesRef, ownerPayload, updateShape } = options
|
|
298
|
+
return (ok: boolean) => {
|
|
299
|
+
if (!ok || !ownerPayload?.shapeId) return
|
|
300
|
+
|
|
301
|
+
const shapes = shapesRef.value
|
|
302
|
+
const childId = ownerPayload.shapeId
|
|
303
|
+
const childShape = shapes.find(s => (s as any).id === childId)
|
|
304
|
+
if (!childShape || !childShape.parenShapeId || !childShape.bounds) return
|
|
305
|
+
|
|
306
|
+
const parent = shapes.find(s => s.id === childShape.parenShapeId)
|
|
307
|
+
if (!parent) return
|
|
308
|
+
const { expanded, affectedIds } = expandParentToFitChildBounds(
|
|
309
|
+
shapes,
|
|
310
|
+
parent,
|
|
311
|
+
childShape.id,
|
|
312
|
+
childShape.bounds as Rect,
|
|
313
|
+
updateShape,
|
|
314
|
+
)
|
|
315
|
+
if (!expanded) return
|
|
316
|
+
|
|
317
|
+
const sizePayload: ShapeSizeUpdatePayload[] = affectedIds
|
|
318
|
+
.map(id => shapes.find(s => s.id === id))
|
|
319
|
+
.filter((s): s is Shape => !!s)
|
|
320
|
+
.filter(s => s.id !== childId) // 不用更新子,子已经是最新的 bounds
|
|
321
|
+
.map(s => ({
|
|
322
|
+
id: s.id,
|
|
323
|
+
bounds: JSON.stringify(s.bounds ?? {}),
|
|
324
|
+
}))
|
|
325
|
+
|
|
326
|
+
// 交给外面单独的监听去调 updateShapeSize 接口
|
|
327
|
+
eventBus.emit('shape-size-update', sizePayload)
|
|
328
|
+
}
|
|
329
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { Shape } from '../types';
|
|
2
|
+
|
|
3
|
+
// GraphStore接口定义,包含highlightUtils所需的方法和属性
|
|
4
|
+
interface GraphStore {
|
|
5
|
+
shapes: Shape[];
|
|
6
|
+
updateShape: (shapeId: string, updates: Partial<Shape>, id?: 'id' | 'modelId') => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 图元高亮工具类
|
|
11
|
+
* 用于处理图元高亮状态管理和样式转换
|
|
12
|
+
*/
|
|
13
|
+
export class HighlightUtils {
|
|
14
|
+
private highlightedShapeId: string | null = null;
|
|
15
|
+
private originalShapeStyles = new Map<string, { borderColor?: string; borderWidth?: number }>();
|
|
16
|
+
private graphStore: GraphStore;
|
|
17
|
+
private highlightTimeout: ReturnType<typeof setTimeout> | null = null;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 构造函数
|
|
21
|
+
* @param graphStore 图元存储实例
|
|
22
|
+
*/
|
|
23
|
+
constructor(graphStore: GraphStore) {
|
|
24
|
+
this.graphStore = graphStore;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 高亮或取消高亮图元
|
|
29
|
+
* @param shape 要高亮的图元,null表示取消所有高亮
|
|
30
|
+
* @param isHighlight 是否高亮
|
|
31
|
+
* @param isValidSource 是否是有效的连接源(影响高亮颜色)
|
|
32
|
+
* @returns 高亮后的图元(如果有)
|
|
33
|
+
*/
|
|
34
|
+
public highlightShape(
|
|
35
|
+
shape: Shape | null,
|
|
36
|
+
isHighlight: boolean,
|
|
37
|
+
isValidSource: boolean = true
|
|
38
|
+
): Shape | null {
|
|
39
|
+
// 取消高亮处理
|
|
40
|
+
if (!shape && !isHighlight) {
|
|
41
|
+
this.cancelAllHighlights();
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 无效图元或边类型图元不处理
|
|
46
|
+
if (!shape || shape.shapeType === 'edge') return null;
|
|
47
|
+
|
|
48
|
+
// 高亮操作
|
|
49
|
+
if (isHighlight && shape) {
|
|
50
|
+
// 先取消之前可能存在的高亮
|
|
51
|
+
if (this.highlightedShapeId && this.highlightedShapeId !== shape.id) {
|
|
52
|
+
this.cancelAllHighlights();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 保存原始样式
|
|
56
|
+
if (!this.originalShapeStyles.has(shape.id)) {
|
|
57
|
+
// 确保borderWidth是number类型
|
|
58
|
+
let borderWidth: number | undefined;
|
|
59
|
+
if (shape.style?.borderWidth !== undefined) {
|
|
60
|
+
borderWidth = typeof shape.style.borderWidth === 'string'
|
|
61
|
+
? parseFloat(shape.style.borderWidth)
|
|
62
|
+
: shape.style.borderWidth;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.originalShapeStyles.set(shape.id, {
|
|
66
|
+
borderColor: shape.style?.borderColor,
|
|
67
|
+
borderWidth: borderWidth
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// 设置高亮样式(蓝色表示可以连接,红色表示不可以)
|
|
72
|
+
const highlightStyle = {
|
|
73
|
+
...shape.style,
|
|
74
|
+
borderColor: isValidSource ? '#1890ff' : '#f56c6c', // 蓝色或红色
|
|
75
|
+
borderWidth: 3,
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
// 更新图元样式
|
|
79
|
+
this.graphStore.updateShape(shape.id, { style: highlightStyle });
|
|
80
|
+
this.highlightedShapeId = shape.id;
|
|
81
|
+
|
|
82
|
+
return shape;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 取消所有图元的高亮状态
|
|
90
|
+
*/
|
|
91
|
+
public cancelAllHighlights(): void {
|
|
92
|
+
if (this.highlightedShapeId) {
|
|
93
|
+
// 找到当前高亮的图元
|
|
94
|
+
const currentHighlighted = this.graphStore.shapes.find(s => s.id === this.highlightedShapeId);
|
|
95
|
+
if (currentHighlighted) {
|
|
96
|
+
// 恢复原始样式
|
|
97
|
+
const originalStyle = this.originalShapeStyles.get(this.highlightedShapeId);
|
|
98
|
+
if (originalStyle) {
|
|
99
|
+
const restoreStyle = {
|
|
100
|
+
...currentHighlighted.style,
|
|
101
|
+
borderColor: originalStyle.borderColor !== undefined ? originalStyle.borderColor : undefined,
|
|
102
|
+
borderWidth: originalStyle.borderWidth !== undefined ? Number(originalStyle.borderWidth) : undefined
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// 更新图元恢复原始样式
|
|
106
|
+
this.graphStore.updateShape(this.highlightedShapeId, { style: restoreStyle });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
this.originalShapeStyles.delete(this.highlightedShapeId);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// 重置状态
|
|
114
|
+
this.highlightedShapeId = null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 获取当前高亮的图元ID
|
|
119
|
+
*/
|
|
120
|
+
public getHighlightedShapeId(): string | null {
|
|
121
|
+
return this.highlightedShapeId;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 获取当前高亮的图元
|
|
126
|
+
*/
|
|
127
|
+
public getHighlightedShape(): Shape | null {
|
|
128
|
+
if (!this.highlightedShapeId) return null;
|
|
129
|
+
return this.graphStore.shapes.find(s => s.id === this.highlightedShapeId) || null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* 设置高亮定时器
|
|
134
|
+
* @param callback 回调函数
|
|
135
|
+
* @param delay 延迟时间(毫秒)
|
|
136
|
+
*/
|
|
137
|
+
public setHighlightTimeout(callback: () => void, delay: number): void {
|
|
138
|
+
// 先清除已存在的定时器
|
|
139
|
+
this.clearHighlightTimeout();
|
|
140
|
+
// 设置新的定时器
|
|
141
|
+
this.highlightTimeout = setTimeout(callback, delay);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* 清除高亮定时器
|
|
146
|
+
*/
|
|
147
|
+
public clearHighlightTimeout(): void {
|
|
148
|
+
if (this.highlightTimeout) {
|
|
149
|
+
clearTimeout(this.highlightTimeout);
|
|
150
|
+
this.highlightTimeout = null;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* 清理所有高亮状态和数据
|
|
156
|
+
*/
|
|
157
|
+
public dispose(): void {
|
|
158
|
+
this.cancelAllHighlights();
|
|
159
|
+
this.clearHighlightTimeout();
|
|
160
|
+
this.originalShapeStyles.clear();
|
|
161
|
+
}
|
|
162
|
+
}
|