Fixes alignment bug

This commit is contained in:
2024-03-05 17:03:30 +01:00
parent c43ce4870c
commit aba8d64bed
+6 -4
View File
@@ -29,9 +29,14 @@
_x: 0, _y: 0, _x: 0, _y: 0,
get_pos() { get_pos() {
stored_position = JSON.parse(localStorage.getItem("position")); stored_position = JSON.parse(localStorage.getItem("position"));
if (stored_position != null) { if (stored_position == null) {
localStorage.removeItem("position")
position.x = 0;
position.y = 0;
} else {
position.x = stored_position.x position.x = stored_position.x
position.y = stored_position.y position.y = stored_position.y
}
document.getElementById("main-window").style.transform = document.getElementById("main-window").style.transform =
`translate(${position.x}px, ${position.y}px)` `translate(${position.x}px, ${position.y}px)`
clippy = document.getElementById("clippy") clippy = document.getElementById("clippy")
@@ -40,9 +45,6 @@
`translate(${position.x}px, ${position.y}px)` `translate(${position.x}px, ${position.y}px)`
clippy.classList.remove('hide'); clippy.classList.remove('hide');
} }
} else {
localStorage.removeItem("position")
}
}, },
reset() { reset() {
this._x = 0 this._x = 0