File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 88
88
89
89
watch: {
90
90
isExpanded (value ) {
91
- for (const [idx , /** @type {HTMLDivElement} */ seg ] of Object .entries (this .$refs .segments )) {
92
- seg .style .transform = value
93
- ? ` translate(${ - seg .offsetLeft } px, ${ 41 * (this .graphData [idx][2 ] + 1 )} px)`
94
- : ` translate(0, 0)`
91
+ if (value) {
92
+ const containerX = this .$refs .segments [0 ].parentElement .getBoundingClientRect ().x
93
+ this .$refs .segments .forEach ((/** @type {HTMLDivElement} */ seg , idx ) => {
94
+ seg .style .transform = ` translate(${ - (Math .round (seg .getBoundingClientRect ().x ) - containerX)} px, ${ 41 * (this .graphData [idx][2 ] + 1 )} px)`
95
+ })
96
+ } else {
97
+ this .$refs .segments .forEach (seg => {
98
+ seg .style .transform = ' translate(0, 0)'
99
+ })
95
100
}
96
101
},
97
102
},
You can’t perform that action at this time.
0 commit comments