save states on ctrl W
This commit is contained in:
parent
deb9f2f84c
commit
fe44d23453
5 changed files with 31 additions and 42 deletions
|
|
@ -42,22 +42,9 @@ export default defineComponent({
|
|||
// Mark input item with user's initials.
|
||||
const initials = ref("")
|
||||
|
||||
// ---Set xStart and yStart------------------------------------
|
||||
const cordsStr = window.localStorage.getItem("input_cords")
|
||||
|
||||
let cords = {x: 15, y: window.innerHeight - 200} // default values
|
||||
|
||||
if (cordsStr) {
|
||||
console.log("found archived cords!")
|
||||
cords = JSON.parse(cordsStr)
|
||||
}
|
||||
|
||||
const xStart = cords.x;
|
||||
const yStart = cords.y;
|
||||
|
||||
console.log(`xStart: ${xStart}`)
|
||||
console.log(`yStart: ${yStart}`)
|
||||
// ------------------------------------------------------------
|
||||
// Default values for position.
|
||||
const xStart = 15;
|
||||
const yStart = window.innerHeight - 200;
|
||||
|
||||
// Calculate position of inputItem on drag.
|
||||
const { elementX, elementY } = draggify("inputItem", xStart, yStart, 15);
|
||||
|
|
@ -75,17 +62,6 @@ export default defineComponent({
|
|||
window.ipcRenderer.on("update-profile", onUpdateProfile);
|
||||
})
|
||||
|
||||
const savePosition = () => {
|
||||
const cords = JSON.stringify(
|
||||
{
|
||||
x: elementX.value,
|
||||
y: elementY.value
|
||||
}
|
||||
)
|
||||
window.localStorage.setItem("input_cords", cords)
|
||||
console.log(`Start saved: ${cords}`)
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
window.ipcRenderer.removeAllListeners("update-profile");
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue