updating
This commit is contained in:
parent
1d9f2e0eb6
commit
deb9f2f84c
7 changed files with 104 additions and 74 deletions
|
|
@ -41,11 +41,23 @@ export default defineComponent({
|
|||
|
||||
// Mark input item with user's initials.
|
||||
const initials = ref("")
|
||||
initials.value = "IN";
|
||||
|
||||
// Initial position.
|
||||
const xStart = 15;
|
||||
const yStart = window.innerHeight - 200;
|
||||
// ---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}`)
|
||||
// ------------------------------------------------------------
|
||||
|
||||
// Calculate position of inputItem on drag.
|
||||
const { elementX, elementY } = draggify("inputItem", xStart, yStart, 15);
|
||||
|
|
@ -63,6 +75,17 @@ 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