|
47 | 47 | const cardContainer = useTemplateRef("cardContainer") |
48 | 48 | const containerWidth = ref(window.innerWidth) |
49 | 49 | const containerHeight = ref(window.innerHeight) |
50 | | -
|
51 | 50 | const menuX = ref(0) |
52 | 51 | const menuY = ref(0) |
53 | 52 | const id = ref(null) |
54 | 53 |
|
55 | | - const emit = defineEmits(["show-menu", "position-menu"]) |
| 54 | + const handleResize = () => { |
| 55 | + containerWidth.value = window.innerWidth |
| 56 | + containerHeight.value = window.innerHeight |
| 57 | + } |
56 | 58 |
|
57 | 59 | function handleTreeMenu({ event, itemId }) { |
58 | 60 | menuX.value = event.clientX |
59 | 61 | menuY.value = event.clientY |
60 | 62 | id.value = itemId |
61 | | -
|
62 | 63 | menuStore.openMenu(itemId, event.clientX, event.clientY) |
63 | 64 | } |
64 | 65 |
|
65 | 66 | function onResizeStart(event) { |
66 | 67 | const startWidth = treeviewStore.panelWidth |
67 | 68 | const startX = event.clientX |
68 | | -
|
69 | 69 | const resize = (e) => { |
70 | 70 | const deltaX = e.clientX - startX |
71 | 71 | const newWidth = Math.max( |
|
75 | 75 | treeviewStore.setPanelWidth(newWidth) |
76 | 76 | document.body.style.userSelect = "none" |
77 | 77 | } |
78 | | -
|
79 | 78 | const stopResize = () => { |
80 | 79 | document.removeEventListener("mousemove", resize) |
81 | 80 | document.removeEventListener("mouseup", stopResize) |
82 | 81 | document.body.style.userSelect = "" |
83 | 82 | } |
84 | | -
|
85 | 83 | document.addEventListener("mousemove", resize) |
86 | 84 | document.addEventListener("mouseup", stopResize) |
87 | 85 | } |
88 | 86 |
|
89 | 87 | onMounted(() => { |
90 | 88 | containerWidth.value = window.innerWidth |
91 | 89 | 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) |
97 | 91 | }) |
98 | 92 |
|
99 | 93 | onUnmounted(() => { |
100 | | - window.removeEventListener("resize") |
| 94 | + window.removeEventListener("resize", handleResize) |
101 | 95 | }) |
102 | 96 | </script> |
103 | 97 |
|
|
113 | 107 | display: flex; |
114 | 108 | box-sizing: border-box; |
115 | 109 | } |
116 | | -
|
117 | 110 | .resizable-panel { |
118 | 111 | display: flex; |
119 | 112 | height: 100%; |
120 | 113 | position: relative; |
121 | 114 | box-sizing: border-box; |
122 | 115 | } |
123 | | -
|
124 | 116 | .scrollable-wrapper { |
125 | 117 | overflow-y: auto; |
126 | 118 | padding-right: 6px; |
127 | 119 | flex: 1; |
128 | 120 | } |
129 | | -
|
130 | 121 | .resizer { |
131 | 122 | position: absolute; |
132 | 123 | top: 0; |
|
137 | 128 | background-color: transparent; |
138 | 129 | z-index: 15; |
139 | 130 | } |
140 | | -
|
141 | 131 | .resizer:hover { |
142 | 132 | background-color: #999; |
143 | 133 | } |
144 | | -
|
145 | 134 | .resizer:active { |
146 | 135 | background-color: #666; |
147 | 136 | } |
148 | | -
|
149 | 137 | .transparent-treeview { |
150 | 138 | background-color: transparent; |
151 | 139 | margin: 4px 0; |
152 | 140 | } |
153 | | -
|
154 | 141 | .scrollbar-hover { |
155 | 142 | overflow-x: hidden; |
156 | 143 | } |
157 | | -
|
158 | 144 | .scrollbar-hover::-webkit-scrollbar { |
159 | 145 | width: 5px; |
160 | 146 | } |
161 | | -
|
162 | 147 | .scrollbar-hover::-webkit-scrollbar-thumb { |
163 | 148 | background-color: transparent; |
164 | 149 | } |
165 | | -
|
166 | 150 | .scrollbar-hover:hover::-webkit-scrollbar-thumb { |
167 | 151 | background-color: rgba(0, 0, 0, 0.3); |
168 | 152 | border-radius: 10px; |
|
0 commit comments