Fixes responsive images (omg finally), removes app padding

This commit is contained in:
psychedelicious 2022-10-29 12:22:07 +11:00
parent 6fb6bc6d7f
commit 9291fde960
13 changed files with 52 additions and 47 deletions

View File

@ -2,20 +2,18 @@
.App { .App {
display: grid; display: grid;
width: max-content; width: 100vw;
height: 100vh;
background-color: var(--background-color);
} }
.app-content { .app-content {
display: grid; display: grid;
row-gap: 1rem; row-gap: 0.5rem;
margin: 0.6rem; padding: $app-padding;
padding: 1rem;
border-radius: 0.5rem;
background-color: var(--background-color);
grid-auto-rows: max-content; grid-auto-rows: max-content;
width: $app-width; width: $app-width;
height: $app-height; height: $app-height;
min-width: min-content;
} }
.app-console { .app-console {

View File

@ -7,9 +7,6 @@
row-gap: 1rem; row-gap: 1rem;
background-color: var(--background-color-secondary); background-color: var(--background-color-secondary);
border-radius: 0.5rem; border-radius: 0.5rem;
&[data-tab-name='txt2img'] {
height: $app-text-to-image-height;
}
} }
.current-image-options { .current-image-options {
@ -24,25 +21,22 @@
} }
} }
.current-image-viewer {
position: relative;
width: 100%;
height: 100%;
}
.current-image-preview { .current-image-preview {
position: relative; position: relative;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
display: flex; display: flex;
width: 100%; width: 100%;
// height: 100%; height: 100%;
height: $app-text-to-image-height;
img { img {
background-color: var(--img2img-img-bg-color); background-color: var(--img2img-img-bg-color);
border-radius: 0.5rem; border-radius: 0.5rem;
object-fit: contain; object-fit: contain;
max-width: 100%;
max-height: 100%;
height: auto;
position: absolute;
} }
} }

View File

@ -2,7 +2,6 @@ import { RootState, useAppSelector } from '../../app/store';
import CurrentImageButtons from './CurrentImageButtons'; import CurrentImageButtons from './CurrentImageButtons';
import { MdPhoto } from 'react-icons/md'; import { MdPhoto } from 'react-icons/md';
import CurrentImagePreview from './CurrentImagePreview'; import CurrentImagePreview from './CurrentImagePreview';
import ImageMetadataViewer from './ImageMetaDataViewer/ImageMetadataViewer';
import { tabMap } from '../tabs/InvokeTabs'; import { tabMap } from '../tabs/InvokeTabs';
import { GalleryState } from './gallerySlice'; import { GalleryState } from './gallerySlice';
import { OptionsState } from '../options/optionsSlice'; import { OptionsState } from '../options/optionsSlice';
@ -37,7 +36,6 @@ const CurrentImageDisplay = () => {
currentImage, currentImage,
intermediateImage, intermediateImage,
activeTabName, activeTabName,
shouldShowImageDetails,
} = useAppSelector(currentImageDisplaySelector); } = useAppSelector(currentImageDisplaySelector);
const imageToDisplay = intermediateImage || currentImage; const imageToDisplay = intermediateImage || currentImage;
@ -47,15 +45,7 @@ const CurrentImageDisplay = () => {
{imageToDisplay ? ( {imageToDisplay ? (
<> <>
<CurrentImageButtons image={imageToDisplay} /> <CurrentImageButtons image={imageToDisplay} />
<div className="current-image-viewer"> <CurrentImagePreview imageToDisplay={imageToDisplay} />
<CurrentImagePreview imageToDisplay={imageToDisplay} />
{shouldShowImageDetails && (
<ImageMetadataViewer
image={imageToDisplay}
styleClass="current-image-metadata"
/>
)}
</div>
</> </>
) : ( ) : (
<div className="current-image-display-placeholder"> <div className="current-image-display-placeholder">

View File

@ -7,6 +7,7 @@ import * as InvokeAI from '../../app/invokeai';
import { createSelector } from '@reduxjs/toolkit'; import { createSelector } from '@reduxjs/toolkit';
import _ from 'lodash'; import _ from 'lodash';
import { OptionsState } from '../options/optionsSlice'; import { OptionsState } from '../options/optionsSlice';
import ImageMetadataViewer from './ImageMetaDataViewer/ImageMetadataViewer';
export const imagesSelector = createSelector( export const imagesSelector = createSelector(
[(state: RootState) => state.gallery, (state: RootState) => state.options], [(state: RootState) => state.gallery, (state: RootState) => state.options],
@ -72,9 +73,8 @@ export default function CurrentImagePreview(props: CurrentImagePreviewProps) {
<div className={'current-image-preview'}> <div className={'current-image-preview'}>
<Image <Image
src={imageToDisplay.url} src={imageToDisplay.url}
fit="contain" width={imageToDisplay.width}
maxWidth={'100%'} height={imageToDisplay.height}
maxHeight={'100%'}
/> />
{!shouldShowImageDetails && ( {!shouldShowImageDetails && (
<div className="current-image-next-prev-buttons"> <div className="current-image-next-prev-buttons">
@ -108,6 +108,12 @@ export default function CurrentImagePreview(props: CurrentImagePreviewProps) {
</div> </div>
</div> </div>
)} )}
{shouldShowImageDetails && (
<ImageMetadataViewer
image={imageToDisplay}
styleClass="current-image-metadata"
/>
)}
</div> </div>
); );
} }

View File

@ -1,7 +1,19 @@
@use '../../styles/Mixins/' as *;
.progress-bar { .progress-bar {
background-color: var(--root-bg-color); background-color: var(--root-bg-color);
height: $progress-bar-thickness !important;
div { div {
background-color: var(--progress-bar-color); background-color: var(--progress-bar-color);
&[data-indeterminate] {
background-color: unset;
background-image: linear-gradient(
to right,
transparent 0%,
var(--progress-bar-color) 50%,
transparent 100%
);
}
} }
} }

View File

@ -28,7 +28,6 @@ const ProgressBar = () => {
return ( return (
<Progress <Progress
height="4px"
value={value} value={value}
isIndeterminate={isProcessing && !currentStatusHasSteps} isIndeterminate={isProcessing && !currentStatusHasSteps}
className="progress-bar" className="progress-bar"

View File

@ -4,10 +4,10 @@
} }
.site-header-left-side { .site-header-left-side {
display: grid; display: flex;
grid-template-columns: repeat(2, max-content);
column-gap: 0.6rem;
align-items: center; align-items: center;
column-gap: 0.7rem;
padding-left: 0.5rem;
img { img {
width: 32px; width: 32px;
@ -20,8 +20,7 @@
} }
.site-header-right-side { .site-header-right-side {
display: grid; display: flex;
grid-template-columns: repeat(7, max-content);
align-items: center; align-items: center;
column-gap: 0.5rem; column-gap: 0.5rem;
} }

View File

@ -39,16 +39,17 @@
} }
.init-image-preview { .init-image-preview {
position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
height: $app-text-to-image-height;
img { img {
border-radius: 0.5rem; border-radius: 0.5rem;
object-fit: contain; object-fit: contain;
position: absolute;
} }
} }

View File

@ -3,7 +3,7 @@
.app-tabs { .app-tabs {
display: grid !important; display: grid !important;
grid-template-columns: min-content auto; grid-template-columns: min-content auto;
column-gap: 1rem; column-gap: 0.5rem;
} }
.app-tabs-list { .app-tabs-list {

View File

@ -7,7 +7,7 @@
.workarea-main { .workarea-main {
display: flex; display: flex;
column-gap: 1rem; column-gap: 0.5rem;
.workarea-options-panel { .workarea-options-panel {
width: $options-bar-max-width; width: $options-bar-max-width;
@ -19,14 +19,14 @@
width: 100%; width: 100%;
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
height: $app-content-height; // height: $app-content-height;
background-color: var(--background-color-secondary); background-color: var(--background-color-secondary);
border-radius: 0.5rem; border-radius: 0.5rem;
} }
.workarea-single-view { .workarea-single-view {
width: 100%; width: 100%;
height: $app-content-height; // height: $app-content-height;
background-color: var(--background-color-secondary); background-color: var(--background-color-secondary);
border-radius: 0.5rem; border-radius: 0.5rem;
} }

View File

@ -2,6 +2,7 @@
.text-to-image-area { .text-to-image-area {
padding: 1rem; padding: 1rem;
height: 100%;
} }
.text-to-image-panel { .text-to-image-panel {

View File

@ -1,16 +1,20 @@
// Calc Values // Calc Values
$app-cutoff: 1.6rem; $app-cutoff: 0px;
$app-content-height-cutoff: 7rem; // default: 7rem $app-content-height-cutoff: 4rem; // default: 7rem
// Usage Variables // Usage Variables
// app // app
$app-padding: 0.5rem;
$progress-bar-thickness: 0.3rem;
$app-width: calc(100vw - $app-cutoff); $app-width: calc(100vw - $app-cutoff);
$app-height: calc(100vh - $app-cutoff); $app-height: calc(100vh - $progress-bar-thickness);
$app-content-height: calc(100vh - $app-content-height-cutoff); $app-content-height: calc(100vh - $app-content-height-cutoff);
$app-gallery-height: calc(100vh - ($app-content-height-cutoff + 5.5rem)); $app-gallery-height: calc(100vh - ($app-content-height-cutoff + 5.5rem));
$app-gallery-popover-height: calc(100vh - ($app-content-height-cutoff + 6rem)); $app-gallery-popover-height: calc(100vh - ($app-content-height-cutoff + 6rem));
$app-metadata-height: calc(100vh - ($app-content-height-cutoff + 4.4rem)); $app-metadata-height: calc(100vh - ($app-content-height-cutoff + 4.4rem));
$app-text-to-image-height: calc(100vh - 9.4375rem - 1.925rem - 1.15rem); // do not touch ffs $app-text-to-image-height: calc(
100vh - 9.4375rem - 1.925rem - 1.15rem
); // do not touch ffs
// option bar // option bar
$options-bar-max-width: 22.5rem; $options-bar-max-width: 22.5rem;

View File

@ -74,6 +74,7 @@ html,
body { body {
@include HideScrollbar; @include HideScrollbar;
background-color: var(--root-bg-color); background-color: var(--root-bg-color);
overflow: hidden;
} }
#root { #root {