left and right key
This commit is contained in:
@@ -258,7 +258,7 @@ async fn export_batch(images: Vec<ExportImageTask>, watermark: WatermarkSettings
|
||||
None => input_path.file_name().unwrap_or_default()
|
||||
};
|
||||
let output_path = Path::new(&output_dir).join(file_name);
|
||||
let output_path = Path::new(&output_dir).join(file_name);
|
||||
let _output_path = Path::new(&output_dir).join(file_name);
|
||||
|
||||
// Handle format specific saving
|
||||
// JPEG does not support Alpha channel. If we save Rgba8 to Jpeg, it might fail or look wrong.
|
||||
|
||||
18
src/App.vue
18
src/App.vue
@@ -6,11 +6,27 @@ import { useGalleryStore } from "./stores/gallery";
|
||||
import { open } from '@tauri-apps/plugin-dialog';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { FolderOpen, Download } from 'lucide-vue-next';
|
||||
import { ref } from "vue";
|
||||
import { ref, onMounted, onUnmounted } from "vue";
|
||||
|
||||
const store = useGalleryStore();
|
||||
const isExporting = ref(false);
|
||||
|
||||
function handleKeydown(event: KeyboardEvent) {
|
||||
if (event.key === 'ArrowRight') {
|
||||
store.nextImage();
|
||||
} else if (event.key === 'ArrowLeft') {
|
||||
store.prevImage();
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
window.addEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
window.removeEventListener('keydown', handleKeydown);
|
||||
});
|
||||
|
||||
async function openFolder() {
|
||||
try {
|
||||
const selected = await open({
|
||||
|
||||
@@ -287,6 +287,18 @@ export const useGalleryStore = defineStore("gallery", () => {
|
||||
}
|
||||
}
|
||||
|
||||
function nextImage() {
|
||||
if (images.value.length === 0) return;
|
||||
const nextIndex = (selectedIndex.value + 1) % images.value.length;
|
||||
selectImage(nextIndex);
|
||||
}
|
||||
|
||||
function prevImage() {
|
||||
if (images.value.length === 0) return;
|
||||
const prevIndex = (selectedIndex.value - 1 + images.value.length) % images.value.length;
|
||||
selectImage(prevIndex);
|
||||
}
|
||||
|
||||
return {
|
||||
images,
|
||||
selectedIndex,
|
||||
@@ -310,6 +322,8 @@ export const useGalleryStore = defineStore("gallery", () => {
|
||||
recalcAllWatermarks,
|
||||
processInpainting,
|
||||
processAllInpainting,
|
||||
restoreImage
|
||||
restoreImage,
|
||||
nextImage,
|
||||
prevImage
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user