From e4264cfdf00c0a0ffc885caee8168f4d5d449eaf Mon Sep 17 00:00:00 2001 From: Natasquare <82507131+Natasquare@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:12:13 +0700 Subject: [PATCH 1/2] fix: check for instance deletion before setting hasMoved --- dist/InfiniteCraftHelper.user.js | 3 ++- script/copy.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dist/InfiniteCraftHelper.user.js b/dist/InfiniteCraftHelper.user.js index fb5f678..b8bda0e 100644 --- a/dist/InfiniteCraftHelper.user.js +++ b/dist/InfiniteCraftHelper.user.js @@ -485,7 +485,8 @@ unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0].setInstancePosition(unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance, e.clientX - width / 2, e.clientY - height / 2); unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0].setInstanceZIndex(unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance, data.id); unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.elem.addEventListener('mouseup', exportFunction((e) => { - if (!unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved) { + if (unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance && + !unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved) { unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved = true; unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0].calcInstanceSize(unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance); diff --git a/script/copy.ts b/script/copy.ts index 3144402..c6c817a 100644 --- a/script/copy.ts +++ b/script/copy.ts @@ -61,6 +61,7 @@ export function setMiddleClickOnMutations(mutations: MutationRecord[], elements: 'mouseup', exportFunction((e: MouseEvent) => { if ( + unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance && !unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved ) { unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved = From 94ac09a1f2db611250cc0b97b81b6afcb345e3bf Mon Sep 17 00:00:00 2001 From: Natasquare <82507131+Natasquare@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:16:25 +0700 Subject: [PATCH 2/2] style: ran prettier --- script/copy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/copy.ts b/script/copy.ts index c6c817a..3fe34d7 100644 --- a/script/copy.ts +++ b/script/copy.ts @@ -61,7 +61,7 @@ export function setMiddleClickOnMutations(mutations: MutationRecord[], elements: 'mouseup', exportFunction((e: MouseEvent) => { if ( - unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance && + unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance && !unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved ) { unsafeWindow.$nuxt.$root.$children[2].$children[0].$children[0]._data.selectedInstance.hasMoved =