1
1
import { Angry , MousePointerClick , RefreshCcw , Smile , Tags , Telescope } from "lucide-react" ;
2
2
import React from "react" ;
3
+ import { Dialog } from "../components/dialog" ;
3
4
import IconButton from "../components/IconButton" ;
4
5
import { StageManager } from "../core/stage/stageManager/StageManager" ;
5
6
import { cn } from "../utils/cn" ;
@@ -26,22 +27,28 @@ export default function TagPanel({ open = false, className = "" }: { open: boole
26
27
const handleMoveCameraToTag = ( tagUUID : string ) => {
27
28
return ( ) => {
28
29
// 跳转到对应位置
29
- StageManager . moveToTag ( tagUUID ) ;
30
+ StageManager . moveCameraToTag ( tagUUID ) ;
30
31
} ;
31
32
} ;
32
33
33
34
const handleMouseEnterTag = ( tagUUID : string ) => {
34
35
return ( ) => {
35
36
if ( isMouseEnterMoveCameraAble ) {
36
- StageManager . moveToTag ( tagUUID ) ;
37
+ StageManager . moveCameraToTag ( tagUUID ) ;
37
38
} else {
38
39
console . log ( "禁止滑动" ) ;
39
40
}
40
41
} ;
41
42
} ;
42
43
43
44
const handleClickAddTag = ( ) => {
44
- // TODO: 这里可能缺少一个是否有选中的实体的检测
45
+ // 检查是否有选中的entity或连线
46
+ if ( StageManager . getSelectedEntities ( ) . length === 0 && StageManager . getSelectedAssociations ( ) . length === 0 ) {
47
+ Dialog . show ( {
48
+ title : "请先选中舞台上的物体" ,
49
+ content : "选中后再点此按钮,即可添标签" ,
50
+ } ) ;
51
+ }
45
52
StageManager . addTagBySelected ( ) ;
46
53
refreshTagNameList ( ) ;
47
54
} ;
@@ -67,22 +74,26 @@ export default function TagPanel({ open = false, className = "" }: { open: boole
67
74
< IconButton onClick = { refreshTagNameList } tooltip = "如果舞台上的标签发生变更但此处未更新,可以手动刷新" >
68
75
< RefreshCcw />
69
76
</ IconButton >
70
- < IconButton
71
- onClick = { ( ) => {
72
- setIsMouseEnterMoveCameraAble ( ! isMouseEnterMoveCameraAble ) ;
73
- } }
74
- tooltip = { isMouseEnterMoveCameraAble ? "快速瞭望模式" : "点击跳转模式" }
75
- >
76
- { isMouseEnterMoveCameraAble ? < Telescope /> : < MousePointerClick /> }
77
- </ IconButton >
78
- < IconButton
79
- onClick = { ( ) => {
80
- setIsPerspective ( ! isPerspective ) ;
81
- } }
82
- tooltip = { isPerspective ? "透视已开启" : "开启透视眼" }
83
- >
84
- { isPerspective ? < Angry /> : < Smile /> }
85
- </ IconButton >
77
+ { tagNameList . length >= 3 && (
78
+ < IconButton
79
+ onClick = { ( ) => {
80
+ setIsMouseEnterMoveCameraAble ( ! isMouseEnterMoveCameraAble ) ;
81
+ } }
82
+ tooltip = { isMouseEnterMoveCameraAble ? "快速瞭望模式" : "点击跳转模式" }
83
+ >
84
+ { isMouseEnterMoveCameraAble ? < Telescope /> : < MousePointerClick /> }
85
+ </ IconButton >
86
+ ) }
87
+ { tagNameList . length > 0 && (
88
+ < IconButton
89
+ onClick = { ( ) => {
90
+ setIsPerspective ( ! isPerspective ) ;
91
+ } }
92
+ tooltip = { isPerspective ? "透视已开启" : "开启透视眼" }
93
+ >
94
+ { isPerspective ? < Angry /> : < Smile /> }
95
+ </ IconButton >
96
+ ) }
86
97
</ div >
87
98
88
99
{ /* 标签列表 */ }
0 commit comments