Skip to content

Commit

Permalink
feat: filter file picker selection to image formats (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrani authored Feb 26, 2024
1 parent 87a494d commit 5b315b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ struct CropDimension {
}

async fn select_image() -> Option<PathBuf> {
FileDialogBuilder::new().pick_file()
FileDialogBuilder::new()
.add_filter("Image", &["png", "jpg", "jpeg", "webp"])
.pick_file()
}

fn create_file<P: AsRef<Path>>(file_path: P) -> Result<File, ()> {
Expand Down
10 changes: 5 additions & 5 deletions src/lib/components/ViewActionButtons.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<button
aria-label="download"
on:click={downloadImageEffect}
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white p-1 rounded items-center justify-center"
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white p-1 rounded-md items-center justify-center"
>
<svg
class:small
Expand All @@ -50,7 +50,7 @@
<button
aria-label="medium screen"
on:click|stopPropagation={() => openModal(false)}
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white p-1 rounded justify-center items-center ml-2"
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white p-1 rounded-md justify-center items-center ml-2"
class:hidden={!small && visible}
>
<svg
Expand All @@ -69,7 +69,7 @@
<button
aria-label="open fullscreen"
on:click|stopPropagation={() => openModal(true)}
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white rounded p-1 justify-center items-center ml-2"
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white rounded-md p-1 justify-center items-center ml-2"
class:hidden={visible && full}
>
<svg
Expand All @@ -93,7 +93,7 @@
<button
aria-label="exit fullscreen"
on:click|stopPropagation={() => openModal(false)}
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white rounded p-1 justify-center items-center ml-2"
class="inline-flex bg-gray-900 h-fit w-fit border-solid border-2 border-white rounded-md p-1 justify-center items-center ml-2"
class:hidden={!visible || !full}
>
<svg
Expand All @@ -116,7 +116,7 @@
<button
on:click={closeModal}
aria-label="close modal"
class="flex bg-gray-900 border-solid h-fit w-fit border-2 border-white rounded p-1 justify-center items-center ml-2"
class="flex bg-gray-900 border-solid h-fit w-fit border-2 border-white rounded-md p-1 justify-center items-center ml-2"
class:hidden={small || !visible}
>
<svg
Expand Down

0 comments on commit 5b315b7

Please sign in to comment.