Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(web): image editor - panel and cropping #11074

Merged
merged 61 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6154c9c
cropping, panel
ilyaChuk Jul 12, 2024
e23fdaf
fix presets
ilyaChuk Jul 12, 2024
100f83d
types
ilyaChuk Jul 13, 2024
31790b2
Merge branch 'immich-app:main' into main
ilyaChuk Jul 13, 2024
539d271
prettier
ilyaChuk Jul 13, 2024
1cb58b9
fix lint
ilyaChuk Jul 13, 2024
aa21e08
Merge branch 'immich-app:main' into main
ilyaChuk Jul 28, 2024
0a8bab6
fix aspect ratio, performance optimization
ilyaChuk Jul 28, 2024
c81bda4
improved tool selection, removed placeholder
ilyaChuk Jul 29, 2024
71ea55f
fix the mouse's exit from canvas
ilyaChuk Jul 29, 2024
74bac38
fix error
ilyaChuk Jul 29, 2024
21731e8
the "save" button and change tracking
ilyaChuk Jul 29, 2024
dcfd221
lint, format
ilyaChuk Jul 29, 2024
e498055
the mini functionality of the save button
ilyaChuk Jul 29, 2024
c5cff01
fix aspect ratio
ilyaChuk Jul 29, 2024
0f01afe
hide editor button on mobiles
ilyaChuk Jul 29, 2024
019ed53
strict equality
ilyaChuk Jul 29, 2024
1eb7f1c
Use the dollar sign syntax for stores inside components
ilyaChuk Jul 29, 2024
9de3298
unobtrusive grid lines, circles at the corners
ilyaChuk Jul 29, 2024
b9e2f6a
more correct image load, handleError
ilyaChuk Jul 29, 2024
f982a54
more strict equality
ilyaChuk Jul 29, 2024
7cba82e
fix styles. unused and tailwind
ilyaChuk Jul 29, 2024
d17c0da
dont store isShowEditor
ilyaChuk Jul 29, 2024
840d55f
if showEditor - hide navbar & shortcuts
ilyaChuk Jul 29, 2024
574da14
crop-canvas decomposition (danger)
ilyaChuk Jul 29, 2024
7d0e3c8
Merge branch 'main' into main
ilyaChuk Jul 29, 2024
25f8d2d
fix lint
ilyaChuk Jul 29, 2024
1f1b590
Merge branch 'main' into main
ilyaChuk Jul 30, 2024
0790090
fix ts
ilyaChuk Jul 30, 2024
82e6577
Merge branch 'main' into main
ilyaChuk Jul 30, 2024
ef1ff62
callback function as props
ilyaChuk Jul 30, 2024
bfe85a3
correctly disabling shortcuts
ilyaChuk Jul 30, 2024
2bd17ba
convenient canvas borders
ilyaChuk Jul 30, 2024
4bc6beb
-the editor button for video files, -save button
ilyaChuk Jul 30, 2024
66b29f3
Merge branch 'main' into main
ilyaChuk Jul 30, 2024
22e83ee
hide editor btn if panoramic || gif || live
ilyaChuk Jul 30, 2024
9815252
corners instead of circles (preview), fix lint&format
ilyaChuk Jul 31, 2024
a8dd073
confirm close editor without save
ilyaChuk Jul 31, 2024
cadd413
vertical aspect ratios
ilyaChuk Jul 31, 2024
ba97426
Merge remote-tracking branch 'upstream/main'
ilyaChuk Jul 31, 2024
f3d4d76
recovery after merge. editor's closing shortcut
ilyaChuk Jul 31, 2024
5eef4b3
fix format
ilyaChuk Jul 31, 2024
8f6cc65
Merge branch 'main' into main
ilyaChuk Aug 9, 2024
2f1da40
move from canvas to html elements
ilyaChuk Aug 9, 2024
5028a96
fix changes detections
ilyaChuk Aug 9, 2024
6678521
rotation
ilyaChuk Aug 10, 2024
1ed0647
hide detail panel if showing editor
ilyaChuk Aug 10, 2024
20cd0b8
fix aspect ratios near min size
ilyaChuk Aug 10, 2024
bc6e18c
Merge branch 'main' into main
ilyaChuk Aug 10, 2024
73ab707
fix crop area when changing image size when rotate
ilyaChuk Aug 10, 2024
219fff9
fix of fix
ilyaChuk Aug 10, 2024
dbb3fe4
better layout - grouping
ilyaChuk Aug 10, 2024
ae0c5a3
Merge branch 'main' into main
ilyaChuk Aug 12, 2024
53e57ea
Merge branch 'main' into main
ilyaChuk Aug 12, 2024
69043f8
Merge branch 'main' into main
ilyaChuk Aug 13, 2024
59c015f
Merge branch 'main' into main
ilyaChuk Aug 14, 2024
bfd6cbe
hide the button
alextran1502 Aug 14, 2024
cb1e541
Merge branch 'main' into main
ilyaChuk Aug 14, 2024
63bfc43
fix i18n, format
ilyaChuk Aug 14, 2024
c154d00
hide button
ilyaChuk Aug 14, 2024
857f02a
hide button v2
ilyaChuk Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
mdiHeartOutline,
mdiHistory,
mdiImageAlbum,
mdiImageEditOutline,
mdiImageMinusOutline,
mdiImageOutline,
mdiImageRefreshOutline,
Expand Down Expand Up @@ -73,6 +74,7 @@
playSlideShow: void;
unstack: void;
showShareModal: void;
showEditorHandler: void;
};

const dispatch = createEventDispatcher<EventTypes>();
Expand Down Expand Up @@ -168,6 +170,15 @@
title={asset.isFavorite ? $t('unfavorite') : $t('to_favorite')}
/>
{/if}
{#if isOwner}
<CircleIconButton
color="opaque"
hideMobile={true}
icon={mdiImageEditOutline}
on:click={() => dispatch('showEditorHandler')}
title={$t('editor')}
/>
{/if}

{#if isOwner}
<DeleteButton
Expand Down
38 changes: 35 additions & 3 deletions web/src/lib/components/asset-viewer/asset-viewer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import { updateNumberOfComments } from '$lib/stores/activity.store';
import { assetViewingStore } from '$lib/stores/asset-viewing.store';
import type { AssetStore } from '$lib/stores/assets.store';
import { isShowDetail, showDeleteModal } from '$lib/stores/preferences.store';
import { isShowDetail, isShowEditor, showDeleteModal } from '$lib/stores/preferences.store';
import { featureFlags } from '$lib/stores/server-config.store';
import { SlideshowNavigation, SlideshowState, slideshowStore } from '$lib/stores/slideshow.store';
import { stackAssetsStore } from '$lib/stores/stacked-asset.store';
Expand Down Expand Up @@ -61,6 +61,8 @@
import { canCopyImagesToClipboard } from 'copy-image-clipboard';
import { t } from 'svelte-i18n';
import { focusTrap } from '$lib/actions/focus-trap';
import EditorPanel from './editor/editor-panel.svelte';
import CropCanvas from './editor/crop-canvas.svelte';

export let assetStore: AssetStore | null = null;
export let asset: AssetResponseDto;
Expand Down Expand Up @@ -334,6 +336,12 @@
}
$isShowDetail = !$isShowDetail;
};
const showEditorHandler = () => {
if (isShowActivity) {
isShowActivity = false;
}
$isShowEditor = !$isShowEditor;
};

const trashOrDelete = async (force: boolean = false) => {
if (force || !isTrashEnabled) {
Expand Down Expand Up @@ -532,6 +540,12 @@
}
};

let selectedEditType: string = '';

function handleUpdateSelectedEditType(event: CustomEvent) {
selectedEditType = event.detail;
}

$: if (!$user) {
shouldShowShareModal = false;
}
Expand Down Expand Up @@ -581,6 +595,7 @@
on:delete={() => trashOrDelete()}
on:permanentlyDelete={() => trashOrDelete(true)}
on:favorite={toggleFavorite}
on:showEditorHandler={showEditorHandler}
on:addToAlbum={() => openAlbumPicker(false)}
on:restoreAsset={() => handleRestoreAsset()}
on:addToSharedAlbum={() => openAlbumPicker(true)}
Expand All @@ -597,7 +612,7 @@
</div>
{/if}

{#if $slideshowState === SlideshowState.None && showNavigation}
{#if $slideshowState === SlideshowState.None && showNavigation && !$isShowEditor}
<div class="z-[1001] my-auto column-span-1 col-start-1 row-span-full row-start-1 justify-self-start">
<NavigationArea onClick={(e) => navigateAsset('previous', e)} label={$t('view_previous_asset')}>
<Icon path={mdiChevronLeft} size="36" ariaHidden />
Expand Down Expand Up @@ -667,6 +682,8 @@
.toLowerCase()
.endsWith('.insp'))}
<PanoramaViewer {asset} />
{:else if $isShowEditor && selectedEditType == 'crop'}
ilyaChuk marked this conversation as resolved.
Show resolved Hide resolved
<CropCanvas {asset} />
{:else}
<PhotoViewer bind:zoomToggle bind:copyImage {asset} {preloadAssets} on:close={closeViewer} {sharedLink} />
{/if}
Expand Down Expand Up @@ -696,7 +713,7 @@
{/if}
</div>

{#if $slideshowState === SlideshowState.None && showNavigation}
{#if $slideshowState === SlideshowState.None && showNavigation && !$isShowEditor}
<div class="z-[1001] my-auto col-span-1 col-start-4 row-span-full row-start-1 justify-self-end">
<NavigationArea onClick={(e) => navigateAsset('next', e)} label={$t('view_next_asset')}>
<Icon path={mdiChevronRight} size="36" ariaHidden />
Expand All @@ -715,6 +732,21 @@
</div>
{/if}

{#if $isShowEditor}
ilyaChuk marked this conversation as resolved.
Show resolved Hide resolved
<div
transition:fly={{ duration: 150 }}
id="detail-panel"
class="z-[1002] row-start-1 row-span-4 w-[460px] overflow-y-auto bg-immich-bg transition-all dark:border-l dark:border-l-immich-dark-gray dark:bg-immich-dark-bg"
translate="yes"
>
<EditorPanel
{asset}
on:updateSelectedType={handleUpdateSelectedEditType}
on:close={() => ($isShowEditor = false)}
/>
</div>
{/if}

{#if $stackAssetsStore.length > 0 && withStacked}
<div
id="stack-slideshow"
Expand Down
Loading
Loading