Demo:修复激活节点,移动画布就关闭侧边栏的问题

This commit is contained in:
wanglin2
2025-04-08 21:57:01 +08:00
parent b543cfde38
commit 2b25e28cb8
10 changed files with 82 additions and 75 deletions

View File

@@ -298,7 +298,9 @@ export default {
}, },
associativeLineDeactivate() { associativeLineDeactivate() {
this.setActiveSidebar('') if (this.activeSidebar === 'associativeLineStyle') {
this.setActiveSidebar(null)
}
this.activeLineNode = null this.activeLineNode = null
this.activeLineToNode = null this.activeLineToNode = null
this.style = { this.style = {

View File

@@ -172,3 +172,6 @@ export default {
overflow: auto; overflow: auto;
} }
</style> </style>
<style lang="less" scoped>
@import url('../../../style/outlineTree.less');
</style>

View File

@@ -76,7 +76,7 @@ export default {
this.updatePos() this.updatePos()
this.showNodeIconToolbar = true this.showNodeIconToolbar = true
if (this.activeSidebar === 'nodeIconSidebar') { if (this.activeSidebar === 'nodeIconSidebar') {
this.setActiveSidebar('') this.setActiveSidebar(null)
} }
}, },

View File

@@ -55,6 +55,9 @@ export default {
...mapMutations(['setActiveSidebar']), ...mapMutations(['setActiveSidebar']),
onNodeActive(...args) { onNodeActive(...args) {
if (this.activeSidebar !== 'noteSidebar') {
return
}
const nodes = [...args[1]] const nodes = [...args[1]]
if (nodes.length > 0) { if (nodes.length > 0) {
if (nodes[0] !== this.node) { if (nodes[0] !== this.node) {

View File

@@ -435,19 +435,11 @@ export default {
}, },
created() { created() {
this.mindMap.on('outer_frame_active', this.onOuterFrameActive) this.mindMap.on('outer_frame_active', this.onOuterFrameActive)
this.mindMap.on('scale', this.hide)
this.mindMap.on('translate', this.hide)
this.mindMap.on('svg_mousedown', this.hide)
this.mindMap.on('expand_btn_click', this.hide)
this.mindMap.on('outer_frame_delete', this.hide) this.mindMap.on('outer_frame_delete', this.hide)
this.mindMap.on('outer_frame_deactivate', this.hide) this.mindMap.on('outer_frame_deactivate', this.hide)
}, },
beforeDestroy() { beforeDestroy() {
this.mindMap.off('outer_frame_active', this.onOuterFrameActive) this.mindMap.off('outer_frame_active', this.onOuterFrameActive)
this.mindMap.off('scale', this.hide)
this.mindMap.off('translate', this.hide)
this.mindMap.off('svg_mousedown', this.hide)
this.mindMap.off('expand_btn_click', this.hide)
this.mindMap.off('outer_frame_delete', this.hide) this.mindMap.off('outer_frame_delete', this.hide)
this.mindMap.off('outer_frame_deactivate', this.hide) this.mindMap.off('outer_frame_deactivate', this.hide)
}, },
@@ -510,6 +502,9 @@ export default {
}, },
hide() { hide() {
if (this.activeSidebar !== 'nodeOuterFrameStyle') {
return
}
this.setActiveSidebar(null) this.setActiveSidebar(null)
} }
} }

View File

@@ -351,67 +351,6 @@ export default {
} }
} }
</style> </style>
<style lang="less"> <style lang="less" scoped>
.outlineTree { @import url('../../../style/outlineTree.less');
&.isDark {
background-color: #262a2e;
.customNode {
color: #fff;
}
&.el-tree--highlight-current {
/deep/ .el-tree-node.is-current > .el-tree-node__content {
background-color: hsla(0, 0%, 100%, 0.05) !important;
}
}
/deep/ .el-tree-node__content:hover,
.el-upload-list__item:hover {
background-color: hsla(0, 0%, 100%, 0.02) !important;
}
/deep/ .el-tree-node__content {
.el-tree-node__expand-icon {
color: #fff;
&.is-leaf {
&::after {
background-color: #fff;
}
}
}
}
}
/deep/ .el-tree-node > .el-tree-node__children {
overflow: inherit;
}
/deep/ .el-tree-node__content {
height: auto;
margin: 5px 0;
.el-tree-node__expand-icon {
color: #262a2e;
&.is-leaf {
color: transparent;
position: relative;
&::after {
background-color: #262a2e;
position: absolute;
content: '';
width: 5px;
height: 5px;
border-radius: 50%;
left: 10px;
top: 50%;
transform: translateY(-50%);
}
}
}
}
}
</style> </style>

View File

@@ -363,3 +363,6 @@ export default {
} }
} }
</style> </style>
<style lang="less" scoped>
@import url('../../../style/outlineTree.less');
</style>

View File

@@ -71,7 +71,7 @@ export default {
...mapMutations(['setIsOutlineEdit', 'setActiveSidebar']), ...mapMutations(['setIsOutlineEdit', 'setActiveSidebar']),
onChangeToOutlineEdit() { onChangeToOutlineEdit() {
this.setActiveSidebar('') this.setActiveSidebar(null)
this.setIsOutlineEdit(true) this.setIsOutlineEdit(true)
}, },

View File

@@ -60,7 +60,7 @@ export default {
close() { close() {
this.show = false this.show = false
this.setActiveSidebar('') this.setActiveSidebar(null)
}, },
getEl() { getEl() {

View File

@@ -0,0 +1,62 @@
.outlineTree {
&.isDark {
background-color: #262a2e;
.customNode {
color: #fff;
}
&.el-tree--highlight-current {
/deep/ .el-tree-node.is-current > .el-tree-node__content {
background-color: hsla(0, 0%, 100%, 0.05) !important;
}
}
/deep/ .el-tree-node__content:hover,
.el-upload-list__item:hover {
background-color: hsla(0, 0%, 100%, 0.02) !important;
}
/deep/ .el-tree-node__content {
.el-tree-node__expand-icon {
color: #fff;
&.is-leaf {
&::after {
background-color: #fff;
}
}
}
}
}
/deep/ .el-tree-node > .el-tree-node__children {
overflow: inherit;
}
/deep/ .el-tree-node__content {
height: auto;
margin: 5px 0;
.el-tree-node__expand-icon {
color: #262a2e;
&.is-leaf {
color: transparent;
position: relative;
&::after {
background-color: #262a2e;
position: absolute;
content: '';
width: 5px;
height: 5px;
border-radius: 50%;
left: 10px;
top: 50%;
transform: translateY(-50%);
}
}
}
}
}