@@ -18,11 +18,17 @@ const Control = (props: any) => {
1818 const hideAddNode = globalConfig ?. controls ?. hideAddNode ?? false ;
1919 const hideAnnotate = globalConfig ?. controls ?. hideAnnotate ?? false ;
2020
21+ const { setIsAddingNode, panOnDrag } = useStore ( s => ( {
22+ setIsAddingNode : s . setIsAddingNode ,
23+ panOnDrag : s . panOnDrag ,
24+ } ) ) ;
25+
2126 const addNote = ( e : MouseEvent < HTMLDivElement > ) => {
2227 e . stopPropagation ( ) ;
28+ setIsAddingNode ( true ) ;
29+ addNode ( { _nodeType : 'Note' } ) ;
2330 } ;
2431 const storeApi = useStoreApi ( ) ;
25- const panOnDrag = useStore ( s => s . panOnDrag ) ;
2632
2733 const { eventEmitter } = useEventEmitterContextContext ( ) ;
2834
@@ -31,7 +37,7 @@ const Control = (props: any) => {
3137 } ;
3238
3339 return (
34- < div className = ' fai-reactflow-control' >
40+ < div className = " fai-reactflow-control" >
3541 { ! hideAddNode && (
3642 < NodeSelectPopover addNode = { addNode } >
3743 < Tooltip
@@ -63,14 +69,19 @@ const Control = (props: any) => {
6369 />
6470 </ Tooltip >
6571 ) }
66- { ! ( hideAddNode && hideAnnotate ) && < div className = 'separator' > </ div > }
67- < Tooltip title = '指针模式' getPopupContainer = { ( ) => document . getElementById ( 'xflow-container' ) as HTMLElement } >
72+ { ! ( hideAddNode && hideAnnotate ) && < div className = "separator" > </ div > }
73+ < Tooltip
74+ title = "指针模式"
75+ getPopupContainer = { ( ) =>
76+ document . getElementById ( 'xflow-container' ) as HTMLElement
77+ }
78+ >
6879 < Button
69- type = ' text'
80+ type = " text"
7081 icon = {
7182 < IconView
72- type = ' icon-zhizhen'
73- className = ' icon'
83+ type = " icon-zhizhen"
84+ className = " icon"
7485 style = { {
7586 color : ! panOnDrag ? 'rgb(21,94,239)' : '#666F83' ,
7687 fontSize : '14px' ,
@@ -81,13 +92,18 @@ const Control = (props: any) => {
8192 style = { { backgroundColor : ! panOnDrag ? 'rgb(239,244,255)' : '' } }
8293 />
8394 </ Tooltip >
84- < Tooltip title = '手模式' getPopupContainer = { ( ) => document . getElementById ( 'xflow-container' ) as HTMLElement } >
95+ < Tooltip
96+ title = "手模式"
97+ getPopupContainer = { ( ) =>
98+ document . getElementById ( 'xflow-container' ) as HTMLElement
99+ }
100+ >
85101 < Button
86- type = ' text'
102+ type = " text"
87103 icon = {
88104 < IconView
89- type = ' icon-xianxingshouzhangtubiao'
90- className = ' icon'
105+ type = " icon-xianxingshouzhangtubiao"
106+ className = " icon"
91107 style = { {
92108 color : panOnDrag ? 'rgb(21,94,239)' : '#666F83' ,
93109 } }
@@ -100,20 +116,36 @@ const Control = (props: any) => {
100116 } }
101117 />
102118 </ Tooltip >
103- < div className = 'separator' > </ div >
104- < Tooltip title = '整理画布' getPopupContainer = { ( ) => document . getElementById ( 'xflow-container' ) as HTMLElement } >
119+ < div className = "separator" > </ div >
120+ < Tooltip
121+ title = "整理画布"
122+ getPopupContainer = { ( ) =>
123+ document . getElementById ( 'xflow-container' ) as HTMLElement
124+ }
125+ >
105126 < Button
106- type = ' text'
107- icon = { < IconView type = ' icon-function-add-line1' className = ' icon' /> }
127+ type = " text"
128+ icon = { < IconView type = " icon-function-add-line1" className = " icon" /> }
108129 onClick = { ( ) => {
109130 eventEmitter ?. emit ( { type : 'auto-layout-nodes' } as any ) ;
110131 } }
111132 />
112133 </ Tooltip >
113- < Tooltip title = '画布全屏' getPopupContainer = { ( ) => document . getElementById ( 'xflow-container' ) as HTMLElement } >
134+ < Tooltip
135+ title = "画布全屏"
136+ getPopupContainer = { ( ) =>
137+ document . getElementById ( 'xflow-container' ) as HTMLElement
138+ }
139+ >
114140 < Button
115- type = 'text'
116- icon = { < IconView type = { isFullscreen ? 'icon-fullscreen-exit' : 'icon-fullscreen' } className = 'icon' style = { { fontSize :'14px' } } /> }
141+ type = "text"
142+ icon = {
143+ < IconView
144+ type = { isFullscreen ? 'icon-fullscreen-exit' : 'icon-fullscreen' }
145+ className = "icon"
146+ style = { { fontSize : '14px' } }
147+ />
148+ }
117149 onClick = { toggleFullscreen }
118150 />
119151 </ Tooltip >
0 commit comments