@@ -93,11 +93,13 @@ const interactDrawer = (graph, page, div) => {
9393 * @param {string } options.icon SVG 图标。
9494 * @param {string } options.className CSS 类名。
9595 * @param {Function } [options.onClick] 点击事件回调。
96+ * @param {string } [options.tooltip] 工具说明。
9697 * @returns {{ getComponent: Function, update: Function } }
9798 */
98- const createBaseTool = ( { icon, className, onClick} ) => {
99+ const createBaseTool = ( { icon, className, onClick, tooltip } ) => {
99100 const button = graph . createDom ( 'div' , 'div' , className , page . id ) ;
100101 button . innerHTML = icon ;
102+ button . title = tooltip ;
101103 Object . assign ( button . style , {
102104 display : 'flex' ,
103105 width : '22px' ,
@@ -134,6 +136,7 @@ const interactDrawer = (graph, page, div) => {
134136 page . fitScreen ( PAGE_FIT_SCREEN_SCALE_MIN , PAGE_FIT_SCREEN_SCALE_MAX ) ;
135137 e . stopPropagation ( ) ;
136138 } ,
139+ tooltip : graph . i18n . t ( 'displayAllNodes' ) ,
137140 } ) ;
138141 } ;
139142
@@ -151,6 +154,7 @@ const interactDrawer = (graph, page, div) => {
151154 tool . update ( ) ; // 触发更新
152155 e . stopPropagation ( ) ;
153156 } ,
157+ tooltip : graph . i18n . t ( 'handMode' ) ,
154158 } ) ;
155159
156160 /**
@@ -178,6 +182,7 @@ const interactDrawer = (graph, page, div) => {
178182 page . reorganizeNodes ( PAGE_REORGANIZE_SCREEN_SCALE ) ;
179183 e . stopPropagation ( ) // 阻止事件冒泡
180184 } ,
185+ tooltip : graph . i18n . t ( 'reorganizeNodes' ) ,
181186 } ) ;
182187 } ;
183188
@@ -189,7 +194,7 @@ const interactDrawer = (graph, page, div) => {
189194 const zoomTool = ( ) => {
190195 const me = { } ;
191196
192- const createZoomIn = ( ) => {
197+ const createZoomOut = ( ) => {
193198 const button = graph . createDom ( div , 'div' , 'barToolsZoomIn' , page . id ) ;
194199 button . innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16"><path fill="#1D1C23" fill-opacity="0.8" d="M1.333 8c0-.368.299-.666.667-.666h12a.667.667 0 1 1 0 1.333H2a.667.667 0 0 1-.667-.666Z"></path></svg>` ;
195200 button . style . display = 'flex' ;
@@ -201,6 +206,7 @@ const interactDrawer = (graph, page, div) => {
201206 button . onclick = ( ) => {
202207 me . zoomTo ( page . scaleX - 0.1 ) ;
203208 } ;
209+ button . title = graph . i18n . t ( 'zoomOut' ) ;
204210 return button ;
205211 } ;
206212
@@ -234,7 +240,7 @@ const interactDrawer = (graph, page, div) => {
234240 return button ;
235241 } ;
236242
237- const createZoomOut = ( ) => {
243+ const createZoomIn = ( ) => {
238244 const button = graph . createDom ( div , 'div' , 'barToolsZoomOut' , page . id ) ;
239245 button . innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16" style="align-items: center;"><path fill="#1D1C23" fill-opacity="0.8" d="M8 1.334a.667.667 0 0 0-.667.667v5.333H2a.667.667 0 0 0 0 1.333h5.333v5.334a.667.667 0 0 0 1.334 0V8.667H14a.667.667 0 1 0 0-1.333H8.667V2.001A.667.667 0 0 0 8 1.334Z"></path></svg>` ;
240246 button . style . display = 'flex' ;
@@ -246,6 +252,7 @@ const interactDrawer = (graph, page, div) => {
246252 button . onclick = ( ) => {
247253 me . zoomTo ( page . scaleX + 0.1 ) ;
248254 } ;
255+ button . title = graph . i18n . t ( 'zoomIn' ) ;
249256 return button ;
250257 } ;
251258
@@ -255,15 +262,15 @@ const interactDrawer = (graph, page, div) => {
255262 zoomWrapper . style . width = 'fit-content' ;
256263 zoomWrapper . style . height = 'fit-content' ;
257264
258- const zoomIn = createZoomIn ( ) ;
265+ const zoomOut = createZoomOut ( ) ;
259266 const zoomSlider = createZoomSlider ( ) ;
260267 const zoomText = createZoomText ( ) ;
261- const zoomOut = createZoomOut ( ) ;
268+ const zoomIn = createZoomIn ( ) ;
262269
263- zoomWrapper . appendChild ( zoomIn ) ;
270+ zoomWrapper . appendChild ( zoomOut ) ;
264271 zoomWrapper . appendChild ( zoomSlider ) ;
265272 zoomWrapper . appendChild ( zoomText ) ;
266- zoomWrapper . appendChild ( zoomOut ) ;
273+ zoomWrapper . appendChild ( zoomIn ) ;
267274
268275 /**
269276 * 获取缩放工具组件
0 commit comments