Skip to content

Commit c1c7a2a

Browse files
authored
Merge pull request #228 from Geode-solutions/fix_objecttree
Fix_objecttree
2 parents dbac0d1 + 76b6c97 commit c1c7a2a

File tree

1 file changed

+6
-22
lines changed

1 file changed

+6
-22
lines changed

components/Viewer/Tree/ObjectTree.vue

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,25 +47,25 @@
4747
const cardContainer = useTemplateRef("cardContainer")
4848
const containerWidth = ref(window.innerWidth)
4949
const containerHeight = ref(window.innerHeight)
50-
5150
const menuX = ref(0)
5251
const menuY = ref(0)
5352
const id = ref(null)
5453
55-
const emit = defineEmits(["show-menu", "position-menu"])
54+
const handleResize = () => {
55+
containerWidth.value = window.innerWidth
56+
containerHeight.value = window.innerHeight
57+
}
5658
5759
function handleTreeMenu({ event, itemId }) {
5860
menuX.value = event.clientX
5961
menuY.value = event.clientY
6062
id.value = itemId
61-
6263
menuStore.openMenu(itemId, event.clientX, event.clientY)
6364
}
6465
6566
function onResizeStart(event) {
6667
const startWidth = treeviewStore.panelWidth
6768
const startX = event.clientX
68-
6969
const resize = (e) => {
7070
const deltaX = e.clientX - startX
7171
const newWidth = Math.max(
@@ -75,29 +75,23 @@
7575
treeviewStore.setPanelWidth(newWidth)
7676
document.body.style.userSelect = "none"
7777
}
78-
7978
const stopResize = () => {
8079
document.removeEventListener("mousemove", resize)
8180
document.removeEventListener("mouseup", stopResize)
8281
document.body.style.userSelect = ""
8382
}
84-
8583
document.addEventListener("mousemove", resize)
8684
document.addEventListener("mouseup", stopResize)
8785
}
8886
8987
onMounted(() => {
9088
containerWidth.value = window.innerWidth
9189
containerHeight.value = window.innerHeight
92-
93-
window.addEventListener("resize", () => {
94-
containerWidth.value = window.innerWidth
95-
containerHeight.value = window.innerHeight
96-
})
90+
window.addEventListener("resize", handleResize)
9791
})
9892
9993
onUnmounted(() => {
100-
window.removeEventListener("resize")
94+
window.removeEventListener("resize", handleResize)
10195
})
10296
</script>
10397

@@ -113,20 +107,17 @@
113107
display: flex;
114108
box-sizing: border-box;
115109
}
116-
117110
.resizable-panel {
118111
display: flex;
119112
height: 100%;
120113
position: relative;
121114
box-sizing: border-box;
122115
}
123-
124116
.scrollable-wrapper {
125117
overflow-y: auto;
126118
padding-right: 6px;
127119
flex: 1;
128120
}
129-
130121
.resizer {
131122
position: absolute;
132123
top: 0;
@@ -137,32 +128,25 @@
137128
background-color: transparent;
138129
z-index: 15;
139130
}
140-
141131
.resizer:hover {
142132
background-color: #999;
143133
}
144-
145134
.resizer:active {
146135
background-color: #666;
147136
}
148-
149137
.transparent-treeview {
150138
background-color: transparent;
151139
margin: 4px 0;
152140
}
153-
154141
.scrollbar-hover {
155142
overflow-x: hidden;
156143
}
157-
158144
.scrollbar-hover::-webkit-scrollbar {
159145
width: 5px;
160146
}
161-
162147
.scrollbar-hover::-webkit-scrollbar-thumb {
163148
background-color: transparent;
164149
}
165-
166150
.scrollbar-hover:hover::-webkit-scrollbar-thumb {
167151
background-color: rgba(0, 0, 0, 0.3);
168152
border-radius: 10px;

0 commit comments

Comments
 (0)