From 8c6710947c408efd9882eb6d0496c442596f5b4e Mon Sep 17 00:00:00 2001 From: nighca Date: Thu, 27 Jun 2024 10:38:48 +0800 Subject: [PATCH] details --- .../asset/preprocessing/PreprocessModal.vue | 38 ++- .../preprocessing/common/ProcessDetail.vue | 2 +- .../preprocessing/original-thumbnail.svg | 280 ++++++++++++++++++ .../split-sprite-sheet/SplitSpriteSheet.vue | 14 +- 4 files changed, 313 insertions(+), 21 deletions(-) create mode 100644 spx-gui/src/components/asset/preprocessing/original-thumbnail.svg diff --git a/spx-gui/src/components/asset/preprocessing/PreprocessModal.vue b/spx-gui/src/components/asset/preprocessing/PreprocessModal.vue index c55d5586c..dfa878c50 100644 --- a/spx-gui/src/components/asset/preprocessing/PreprocessModal.vue +++ b/spx-gui/src/components/asset/preprocessing/PreprocessModal.vue @@ -9,7 +9,7 @@
@@ -43,7 +43,7 @@ :key="method.value" :active="activeMethod === method.value" :input="getMethodInput(method.value)" - :applied="isApplied(method.value)" + :applied="isMethodApplied(method.value)" @applied="(output) => handleMethodApplied(method.value, output)" @cancel="cancelMethod(method.value)" /> @@ -78,15 +78,16 @@ diff --git a/spx-gui/src/components/asset/preprocessing/original-thumbnail.svg b/spx-gui/src/components/asset/preprocessing/original-thumbnail.svg new file mode 100644 index 000000000..ce61465c0 --- /dev/null +++ b/spx-gui/src/components/asset/preprocessing/original-thumbnail.svg @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spx-gui/src/components/asset/preprocessing/split-sprite-sheet/SplitSpriteSheet.vue b/spx-gui/src/components/asset/preprocessing/split-sprite-sheet/SplitSpriteSheet.vue index e9482feb0..c9f8ee060 100644 --- a/spx-gui/src/components/asset/preprocessing/split-sprite-sheet/SplitSpriteSheet.vue +++ b/spx-gui/src/components/asset/preprocessing/split-sprite-sheet/SplitSpriteSheet.vue @@ -34,15 +34,14 @@ const props = defineProps<{ applied: boolean }>() -// SplitSpriteSheet is supposed to take at most one file -const file = computed(() => props.input[0]) -const [imgRef] = useFileImg(file) - const emit = defineEmits<{ applied: [File[]] cancel: [] }>() +// SplitSpriteSheet is supposed to take at most one file +const file = computed(() => props.input[0]) +const [imgRef] = useFileImg(file) const bgColor = ref(null) const rowNum = ref(1) const colNum = ref(1) @@ -85,7 +84,8 @@ function drawGrid() { ctx.clearRect(0, 0, canvas.width, canvas.height) ctx.drawImage(img, 0, 0) ctx.strokeStyle = uiVariables.color.grey[800] - ctx.lineWidth = 1 + const scale = canvas.width / canvas.getBoundingClientRect().width + ctx.lineWidth = Math.max(1, Math.round(scale)) for (let i = 1; i < rowNum.value; i++) { const y = Math.round((i * canvas.height) / rowNum.value) ctx.beginPath() @@ -104,6 +104,10 @@ function drawGrid() { } } +/** + * If current preview-state different from the applied output. + * When the user changed the row/col number, the preview-state is dirty, until the the changes are applied again. + */ const dirty = ref(false) watch([rowNum, colNum], async () => {