This commit is contained in:
syuilo 2025-05-30 20:37:58 +09:00
parent ddc8072103
commit cb8fc9d4e3
2 changed files with 9 additions and 3 deletions

View File

@ -46,7 +46,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, useTemplateRef, watch, onMounted, onUnmounted, reactive } from 'vue'; import { ref, useTemplateRef, watch, onMounted, onUnmounted, reactive, nextTick } from 'vue';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import type { ImageEffectorLayer } from '@/utility/image-effector/ImageEffector.js'; import type { ImageEffectorLayer } from '@/utility/image-effector/ImageEffector.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
@ -122,6 +122,8 @@ onMounted(async () => {
const closeWaiting = os.waiting(); const closeWaiting = os.waiting();
await nextTick(); // waiting
imageBitmap = await window.createImageBitmap(props.image); imageBitmap = await window.createImageBitmap(props.image);
const MAX_W = 500; const MAX_W = 500;
@ -161,7 +163,7 @@ onUnmounted(() => {
} }
}); });
function save() { async function save() {
if (layers.length === 0 || renderer == null || imageBitmap == null || canvasEl.value == null) { if (layers.length === 0 || renderer == null || imageBitmap == null || canvasEl.value == null) {
cancel(); cancel();
return; return;
@ -169,6 +171,8 @@ function save() {
const closeWaiting = os.waiting(); const closeWaiting = os.waiting();
await nextTick(); // waiting
renderer.changeResolution(imageBitmap.width, imageBitmap.height); // renderer.changeResolution(imageBitmap.width, imageBitmap.height); //
renderer.render(); // toBlob renderer.render(); // toBlob
canvasEl.value.toBlob((blob) => { canvasEl.value.toBlob((blob) => {

View File

@ -45,7 +45,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, useTemplateRef, watch, onMounted, onUnmounted, reactive } from 'vue'; import { ref, useTemplateRef, watch, onMounted, onUnmounted, reactive, nextTick } from 'vue';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import type { WatermarkPreset } from '@/utility/watermark.js'; import type { WatermarkPreset } from '@/utility/watermark.js';
import { WatermarkRenderer } from '@/utility/watermark.js'; import { WatermarkRenderer } from '@/utility/watermark.js';
@ -198,6 +198,8 @@ async function initRenderer() {
onMounted(async () => { onMounted(async () => {
const closeWaiting = os.waiting(); const closeWaiting = os.waiting();
await nextTick(); // waiting
await sampleImage_3_2_loading; await sampleImage_3_2_loading;
await sampleImage_2_3_loading; await sampleImage_2_3_loading;