mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 20:26:27 -04:00
Merge 85bbfd50000925d83c81d2d39d45d48c33a02cfc into d46e50213a0d72c5cd7ca0feabc2df89196bb6d3
This commit is contained in:
commit
6b850a497f
@ -16,7 +16,7 @@
|
|||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
import ButtonContextMenu from '$lib/components/shared-components/context-menu/button-context-menu.svelte';
|
||||||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute, ProjectionType } from '$lib/constants';
|
||||||
import { user } from '$lib/stores/user.store';
|
import { user } from '$lib/stores/user.store';
|
||||||
import { photoZoomState } from '$lib/stores/zoom-image.store';
|
import { photoZoomState } from '$lib/stores/zoom-image.store';
|
||||||
import { getAssetJobName, getSharedLink } from '$lib/utils';
|
import { getAssetJobName, getSharedLink } from '$lib/utils';
|
||||||
@ -34,6 +34,7 @@
|
|||||||
mdiContentCopy,
|
mdiContentCopy,
|
||||||
mdiDatabaseRefreshOutline,
|
mdiDatabaseRefreshOutline,
|
||||||
mdiDotsVertical,
|
mdiDotsVertical,
|
||||||
|
mdiImageEditOutline,
|
||||||
mdiImageRefreshOutline,
|
mdiImageRefreshOutline,
|
||||||
mdiImageSearch,
|
mdiImageSearch,
|
||||||
mdiMagnifyMinusOutline,
|
mdiMagnifyMinusOutline,
|
||||||
@ -55,21 +56,21 @@
|
|||||||
export let onRunJob: (name: AssetJobName) => void;
|
export let onRunJob: (name: AssetJobName) => void;
|
||||||
export let onPlaySlideshow: () => void;
|
export let onPlaySlideshow: () => void;
|
||||||
export let onShowDetail: () => void;
|
export let onShowDetail: () => void;
|
||||||
// export let showEditorHandler: () => void;
|
export let showEditorHandler: () => void;
|
||||||
export let onClose: () => void;
|
export let onClose: () => void;
|
||||||
|
|
||||||
const sharedLink = getSharedLink();
|
const sharedLink = getSharedLink();
|
||||||
$: isOwner = $user && asset.ownerId === $user?.id;
|
$: isOwner = $user && asset.ownerId === $user?.id;
|
||||||
$: showDownloadButton = sharedLink ? sharedLink.allowDownload : !asset.isOffline;
|
$: showDownloadButton = sharedLink ? sharedLink.allowDownload : !asset.isOffline;
|
||||||
// $: showEditorButton =
|
$: showEditorButton =
|
||||||
// isOwner &&
|
isOwner &&
|
||||||
// asset.type === AssetTypeEnum.Image &&
|
asset.type === AssetTypeEnum.Image &&
|
||||||
// !(
|
!(
|
||||||
// asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR ||
|
asset.exifInfo?.projectionType === ProjectionType.EQUIRECTANGULAR ||
|
||||||
// (asset.originalPath && asset.originalPath.toLowerCase().endsWith('.insp'))
|
(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.insp'))
|
||||||
// ) &&
|
) &&
|
||||||
// !(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.gif')) &&
|
!(asset.originalPath && asset.originalPath.toLowerCase().endsWith('.gif')) &&
|
||||||
// !asset.livePhotoVideoId;
|
!asset.livePhotoVideoId;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@ -115,7 +116,7 @@
|
|||||||
{#if isOwner}
|
{#if isOwner}
|
||||||
<FavoriteAction {asset} {onAction} />
|
<FavoriteAction {asset} {onAction} />
|
||||||
{/if}
|
{/if}
|
||||||
<!-- {#if showEditorButton}
|
{#if showEditorButton}
|
||||||
<CircleIconButton
|
<CircleIconButton
|
||||||
color="opaque"
|
color="opaque"
|
||||||
hideMobile={true}
|
hideMobile={true}
|
||||||
@ -123,7 +124,7 @@
|
|||||||
on:click={showEditorHandler}
|
on:click={showEditorHandler}
|
||||||
title={$t('editor')}
|
title={$t('editor')}
|
||||||
/>
|
/>
|
||||||
{/if} -->
|
{/if}
|
||||||
|
|
||||||
{#if isOwner}
|
{#if isOwner}
|
||||||
<DeleteAction {asset} {onAction} />
|
<DeleteAction {asset} {onAction} />
|
||||||
|
@ -317,12 +317,12 @@
|
|||||||
order === 'previous' ? onPrevious() : onNext();
|
order === 'previous' ? onPrevious() : onNext();
|
||||||
};
|
};
|
||||||
|
|
||||||
// const showEditorHandler = () => {
|
const showEditorHandler = () => {
|
||||||
// if (isShowActivity) {
|
if (isShowActivity) {
|
||||||
// isShowActivity = false;
|
isShowActivity = false;
|
||||||
// }
|
}
|
||||||
// isShowEditor = !isShowEditor;
|
isShowEditor = !isShowEditor;
|
||||||
// };
|
};
|
||||||
|
|
||||||
const handleRunJob = async (name: AssetJobName) => {
|
const handleRunJob = async (name: AssetJobName) => {
|
||||||
try {
|
try {
|
||||||
@ -411,6 +411,7 @@
|
|||||||
{asset}
|
{asset}
|
||||||
{album}
|
{album}
|
||||||
{stack}
|
{stack}
|
||||||
|
{showEditorHandler}
|
||||||
showDetailButton={enableDetailPanel}
|
showDetailButton={enableDetailPanel}
|
||||||
showSlideshow={!!assetStore}
|
showSlideshow={!!assetStore}
|
||||||
onZoomImage={zoomToggle}
|
onZoomImage={zoomToggle}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
import { imgElement, cropAreaEl, resetCropStore, overlayEl, isResizingOrDragging, cropFrame } from './crop-store';
|
import { imgElement, cropAreaEl, resetCropStore, overlayEl, isResizingOrDragging, cropFrame } from './crop-store';
|
||||||
import { draw } from './drawing';
|
import { draw } from './drawing';
|
||||||
import { onImageLoad, resizeCanvas } from './image-loading';
|
import { onImageLoad, resizeCanvas } from './image-loading';
|
||||||
import { handleMouseDown, handleMouseMove, handleMouseUp } from './mouse-handlers';
|
import { handleMouseDown, handleMouseMove, handleMouseUp, handleWheel } from './mouse-handlers';
|
||||||
import { recalculateCrop, animateCropChange } from './crop-settings';
|
import { recalculateCrop, animateCropChange } from './crop-settings';
|
||||||
import {
|
import {
|
||||||
changedOriention,
|
changedOriention,
|
||||||
@ -66,6 +66,7 @@
|
|||||||
bind:this={$cropAreaEl}
|
bind:this={$cropAreaEl}
|
||||||
on:mousedown={handleMouseDown}
|
on:mousedown={handleMouseDown}
|
||||||
on:mouseup={handleMouseUp}
|
on:mouseup={handleMouseUp}
|
||||||
|
on:wheel={handleWheel}
|
||||||
aria-label="Crop area"
|
aria-label="Crop area"
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
|
@ -79,6 +79,32 @@ export function handleMouseMove(e: MouseEvent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function handleWheel(e: WheelEvent) {
|
||||||
|
e.preventDefault;
|
||||||
|
const canvas = get(cropAreaEl);
|
||||||
|
if (!canvas) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wheelOffset = getWheelOffset(e);
|
||||||
|
let scale = 1;
|
||||||
|
|
||||||
|
if (wheelOffset > 0) {
|
||||||
|
scale += wheelOffset * 0.1;
|
||||||
|
scale = Math.min(Math.max(0.125, scale), 10);
|
||||||
|
} else {
|
||||||
|
scale = -1;
|
||||||
|
scale += wheelOffset * 0.1;
|
||||||
|
scale = Math.max(Math.min(-0.125, scale), -10);
|
||||||
|
}
|
||||||
|
|
||||||
|
scaleCrop(scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getWheelOffset(e: WheelEvent) {
|
||||||
|
return e.deltaY;
|
||||||
|
}
|
||||||
|
|
||||||
export function handleMouseUp() {
|
export function handleMouseUp() {
|
||||||
window.removeEventListener('mouseup', handleMouseUp);
|
window.removeEventListener('mouseup', handleMouseUp);
|
||||||
document.body.style.userSelect = '';
|
document.body.style.userSelect = '';
|
||||||
@ -253,6 +279,24 @@ function moveCrop(mouseX: number, mouseY: number) {
|
|||||||
draw(crop);
|
draw(crop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function scaleCrop(scale: number) {
|
||||||
|
const canvas = get(cropAreaEl);
|
||||||
|
const crop = get(cropSettings);
|
||||||
|
if (!canvas) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const { x, y, width, height } = crop;
|
||||||
|
const minSize = 50;
|
||||||
|
fadeOverlay(false);
|
||||||
|
|
||||||
|
cropSettings.update((crop) => {
|
||||||
|
crop.width += scale;
|
||||||
|
crop.height += scale;
|
||||||
|
return crop;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function resizeCrop(mouseX: number, mouseY: number) {
|
function resizeCrop(mouseX: number, mouseY: number) {
|
||||||
const canvas = get(cropAreaEl);
|
const canvas = get(cropAreaEl);
|
||||||
const crop = get(cropSettings);
|
const crop = get(cropSettings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user