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

Bugfix: No Image Upscale for Clips #4569

Merged
merged 1 commit into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions ui/v2.5/src/hooks/Lightbox/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,8 @@ export const LightboxComponent: React.FC<IProps> = ({
{i >= currentIndex - 1 && i <= currentIndex + 1 ? (
<LightboxImage
src={image.paths.image ?? ""}
width={image.visual_files?.[0]?.width ?? 0}
height={image.visual_files?.[0]?.height ?? 0}
displayMode={displayMode}
scaleUp={lightboxSettings?.scaleUp ?? false}
scrollMode={
Expand Down
35 changes: 5 additions & 30 deletions ui/v2.5/src/hooks/Lightbox/LightboxImage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ function calculateDefaultZoom(

interface IProps {
src: string;
width: number;
height: number;
displayMode: GQL.ImageLightboxDisplayMode;
scaleUp: boolean;
scrollMode: GQL.ImageLightboxScrollMode;
Expand All @@ -74,6 +76,8 @@ interface IProps {

export const LightboxImage: React.FC<IProps> = ({
src,
width,
height,
displayMode,
scaleUp,
scrollMode,
Expand All @@ -94,8 +98,6 @@ export const LightboxImage: React.FC<IProps> = ({
const [moving, setMoving] = useState(false);
const [positionX, setPositionX] = useState(0);
const [positionY, setPositionY] = useState(0);
const [width, setWidth] = useState(0);
const [height, setHeight] = useState(0);
const [boxWidth, setBoxWidth] = useState(0);
const [boxHeight, setBoxHeight] = useState(0);

Expand Down Expand Up @@ -135,24 +137,6 @@ export const LightboxImage: React.FC<IProps> = ({
}, 250);
}, [container]);

useEffect(() => {
let mounted = true;
const img = new Image();
function onLoad() {
if (mounted) {
setWidth(img.width);
setHeight(img.height);
}
}

img.onload = onLoad;
img.src = src;

return () => {
mounted = false;
};
}, [src]);

const minMaxY = useCallback(
(appliedZoom: number) => {
let minY, maxY: number;
Expand Down Expand Up @@ -528,15 +512,6 @@ export const LightboxImage: React.FC<IProps> = ({
}

const ImageView = isVideo ? "video" : "img";
const customStyle = isVideo
? {
touchAction: "none",
display: "flex",
margin: "auto",
width: "100%",
"max-height": "90vh",
}
: { touchAction: "none" };

return (
<div
Expand All @@ -559,7 +534,7 @@ export const LightboxImage: React.FC<IProps> = ({
src={src}
alt=""
draggable={false}
style={customStyle}
style={{ touchAction: "none" }}
onWheel={current ? (e) => onImageScroll(e) : undefined}
onMouseDown={onImageMouseDown}
onMouseUp={onImageMouseUp}
Expand Down
Loading