Skip to content

Commit 89f1684

Browse files
cursoragenthipsterusername
authored andcommitted
Improve placeholder styling with badge and refined text positioning
Co-authored-by: kent <kent@invoke.ai>
1 parent 14fbee1 commit 89f1684

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

invokeai/frontend/web/src/features/controlLayers/konva/CanvasStagingAreaModule.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
2828
placeholder: {
2929
group: Konva.Group;
3030
rect: Konva.Rect;
31+
badgeBg: Konva.Rect;
3132
text: Konva.Text;
3233
};
3334
};
@@ -64,21 +65,36 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
6465
}),
6566
rect: new Konva.Rect({
6667
name: `${this.type}:placeholder_rect`,
67-
fill: 'hsl(220 12% 10% / 1)', // 'base.900'
68+
fill: 'transparent',
6869
width,
6970
height,
7071
listening: false,
7172
perfectDrawEnabled: false,
7273
}),
74+
badgeBg: new Konva.Rect({
75+
name: `${this.type}:placeholder_badge_bg`,
76+
fill: 'hsl(220 12% 10% / 0.8)', // 'base.900' with opacity
77+
x: 6,
78+
y: 6,
79+
width: Math.min(204, width - 12),
80+
height: 36,
81+
cornerRadius: 6,
82+
stroke: 'hsl(220 12% 50% / 1)', // 'base.700'
83+
strokeWidth: 1,
84+
listening: false,
85+
perfectDrawEnabled: false,
86+
}),
7387
text: new Konva.Text({
7488
name: `${this.type}:placeholder_text`,
75-
fill: 'hsl(220 12% 80% / 1)', // 'base.900'
76-
width,
77-
height,
89+
fill: 'hsl(220 12% 80% / 1)', // 'base.300'
90+
x: 8,
91+
y: 8,
92+
width: Math.min(200, width - 16),
93+
height: 32,
7894
align: 'center',
7995
verticalAlign: 'middle',
8096
fontFamily: '"Inter Variable", sans-serif',
81-
fontSize: width / 24,
97+
fontSize: 14,
8298
fontStyle: '600',
8399
text: 'Waiting for Image',
84100
listening: false,
@@ -88,6 +104,7 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
88104
};
89105

90106
this.konva.placeholder.group.add(this.konva.placeholder.rect);
107+
this.konva.placeholder.group.add(this.konva.placeholder.badgeBg);
91108
this.konva.placeholder.group.add(this.konva.placeholder.text);
92109
this.konva.group.add(this.konva.placeholder.group);
93110

@@ -124,9 +141,8 @@ export class CanvasStagingAreaModule extends CanvasModuleBase {
124141
const { width, height } = this.manager.stateApi.getBbox().rect;
125142
this.konva.placeholder.rect.width(width);
126143
this.konva.placeholder.rect.height(height);
127-
this.konva.placeholder.text.width(width);
128-
this.konva.placeholder.text.height(height);
129-
this.konva.placeholder.text.fontSize(width / 24);
144+
this.konva.placeholder.badgeBg.width(Math.min(204, width - 12));
145+
this.konva.placeholder.text.width(Math.min(200, width - 16));
130146
};
131147

132148
initialize = () => {

invokeai/frontend/web/src/features/gallery/components/ImageViewer/ProgressImage.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { SystemStyleObject } from '@invoke-ai/ui-library';
2-
import { Flex, Heading, Image } from '@invoke-ai/ui-library';
2+
import { Badge, Flex, Image } from '@invoke-ai/ui-library';
33
import { useStore } from '@nanostores/react';
44
import { createSelector } from '@reduxjs/toolkit';
55
import { useAppSelector } from 'app/store/storeHooks';
@@ -37,8 +37,23 @@ export const ProgressImage = memo(() => {
3737

3838
if (!progressImage) {
3939
return (
40-
<Flex width="full" height="full" alignItems="center" justifyContent="center" minW={0} minH={0}>
41-
<Heading>Waiting for Image</Heading>
40+
<Flex width="full" height="full" position="relative" minW={0} minH={0}>
41+
<Badge
42+
position="absolute"
43+
top={2}
44+
left={2}
45+
color="base.300"
46+
borderColor="base.700"
47+
borderWidth={1}
48+
bg="base.900"
49+
opacity={0.8}
50+
fontSize="sm"
51+
fontWeight="semibold"
52+
zIndex={1}
53+
pointerEvents="none"
54+
>
55+
Waiting for Image
56+
</Badge>
4257
</Flex>
4358
);
4459
}

0 commit comments

Comments
 (0)