diff --git a/simple-mind-map/src/plugins/AssociativeLine.js b/simple-mind-map/src/plugins/AssociativeLine.js index dcf499c4..07cefdf6 100644 --- a/simple-mind-map/src/plugins/AssociativeLine.js +++ b/simple-mind-map/src/plugins/AssociativeLine.js @@ -758,6 +758,47 @@ class AssociativeLine { this.mindMap.deleteEditNodeClass(ASSOCIATIVE_LINE_TEXT_EDIT_WRAP) this.unBindEvent() } + + // Toggle visibility of all associative lines + // Returns the new visibility state (true = visible, false = hidden) + toggleAllLinesVisibility() { + if (this._linesHidden) { + this.showAllLines() + return true + } else { + this.hideAllLines() + return false + } + } + + // Hide all associative lines and their labels + hideAllLines() { + this._linesHidden = true + this.lineList.forEach(line => { + line[0].hide() // path + line[1].hide() // clickPath + line[2].hide() // text + }) + this.hideControls() + this.mindMap.emit('associative_line_visibility_change', false) + } + + // Show all associative lines and their labels + showAllLines() { + this._linesHidden = false + this.lineList.forEach(line => { + line[0].show() // path + line[1].show() // clickPath + line[2].show() // text + }) + this.showControls() + this.mindMap.emit('associative_line_visibility_change', true) + } + + // Get current visibility state + getLinesVisibility() { + return !this._linesHidden + } } AssociativeLine.instanceName = 'associativeLine' diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index bcbc994c..22811db3 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -216,7 +216,9 @@ export default { downloadClient: 'Download client', site: 'Official website', current: 'Current:', - downloadDesc: 'You can download it from the following address:' + downloadDesc: 'You can download it from the following address:', + showAssociativeLines: 'Show associative lines', + hideAssociativeLines: 'Hide associative lines' }, nodeHyperlink: { title: 'Link', diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 3de67001..98cc0840 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -210,7 +210,9 @@ export default { downloadClient: '下载客户端', site: '官方网站', current: '当前:', - downloadDesc: '可从如下地址下载:' + downloadDesc: '可从如下地址下载:', + showAssociativeLines: '显示关联线', + hideAssociativeLines: '隐藏关联线' }, nodeHyperlink: { title: '超链接', diff --git a/web/src/pages/Edit/components/NavigatorToolbar.vue b/web/src/pages/Edit/components/NavigatorToolbar.vue index f6d1991d..bac798de 100644 --- a/web/src/pages/Edit/components/NavigatorToolbar.vue +++ b/web/src/pages/Edit/components/NavigatorToolbar.vue @@ -43,6 +43,23 @@
+