Skip to content

Commit db59dc2

Browse files
committed
Maintain scroll position when unit system is changed on Home view
1 parent a78749e commit db59dc2

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/modules/plots.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,6 @@ export function makePlots(flightlog, element, useImperialUnits) {
228228
element.replaceChildren([])
229229

230230
let el = document.createElement("div")
231-
document.create
232231
element.append(el)
233232
const altitudeYLabel = useImperialUnits ? "Altitude [ft]" : "Altitude [m]"
234233
makePlot(flightlog.flightInfo, el, "State Estimation - Altitude", altitudeYLabel, ["height"], eventInfo, useImperialUnits)
@@ -265,4 +264,7 @@ export function makePlots(flightlog, element, useImperialUnits) {
265264
el = document.createElement("div")
266265
element.append(el)
267266
makePlot(flightlog.voltageInfo, el, "Battery Voltage", "Voltage [V]", ["voltage"], eventInfo)
267+
268+
// restore scroll position
269+
element.scrollTop = scrollTop;
268270
}

src/views/Home.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,9 @@ export default {
151151
watch: {
152152
useImperialUnits(newValue) {
153153
if (this.flightLog) {
154-
this.$refs.flightLogPlotContainer.innerHTML = "";
154+
const savedWindowScrollY = window.scrollY;
155155
this.replot();
156+
window.scrollTo(0, savedWindowScrollY);
156157
}
157158
}
158159
}

0 commit comments

Comments
 (0)