UX improvements
This commit is contained in:
@@ -72,7 +72,9 @@
|
|||||||
{@const hidden = item?.attrs?.hidden}
|
{@const hidden = item?.attrs?.hidden}
|
||||||
<div class="animation-wrapper"
|
<div class="animation-wrapper"
|
||||||
class:hidden={hidden}
|
class:hidden={hidden}
|
||||||
animate:flip={{duration:flipDurationMs}}>
|
animate:flip={{duration:flipDurationMs}}
|
||||||
|
style={item?.attrs?.flexGrow ? `flex-grow: ${item.attrs.flexGrow}` : ""}
|
||||||
|
>
|
||||||
<WidgetContainer dragItem={item} zIndex={zIndex+1} />
|
<WidgetContainer dragItem={item} zIndex={zIndex+1} />
|
||||||
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
{#if item[SHADOW_ITEM_MARKER_PROPERTY_NAME]}
|
||||||
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
<div in:fade={{duration:200, easing: cubicIn}} class='drag-item-shadow'/>
|
||||||
|
|||||||
@@ -103,6 +103,7 @@
|
|||||||
{:else if spec.type === "number"}
|
{:else if spec.type === "number"}
|
||||||
<label class="number-wrapper">
|
<label class="number-wrapper">
|
||||||
<BlockTitle>{spec.name}</BlockTitle>
|
<BlockTitle>{spec.name}</BlockTitle>
|
||||||
|
<div class="number">
|
||||||
<input
|
<input
|
||||||
type="number"
|
type="number"
|
||||||
value={target.attrs[spec.name]}
|
value={target.attrs[spec.name]}
|
||||||
@@ -110,6 +111,7 @@
|
|||||||
on:change={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
on:change={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
||||||
on:input={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
on:input={(e) => updateAttribute(spec, e.currentTarget.valueAsNumber)}
|
||||||
/>
|
/>
|
||||||
|
</div>
|
||||||
</label>
|
</label>
|
||||||
{:else if spec.type === "enum"}
|
{:else if spec.type === "enum"}
|
||||||
<label class="select-wrapper">
|
<label class="select-wrapper">
|
||||||
@@ -135,7 +137,7 @@
|
|||||||
<TextBox
|
<TextBox
|
||||||
value={node.properties[spec.name]}
|
value={node.properties[spec.name]}
|
||||||
on:change={(e) => updateProperty(spec, e.detail)}
|
on:change={(e) => updateProperty(spec, e.detail)}
|
||||||
on:input={(e) => updateAttribute(spec, e.detail)}
|
on:input={(e) => updateProperty(spec, e.detail)}
|
||||||
label={spec.name}
|
label={spec.name}
|
||||||
max_lines={1}
|
max_lines={1}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -21,6 +21,16 @@ export type LayoutState = {
|
|||||||
isMenuOpen: boolean
|
isMenuOpen: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type Attributes = {
|
||||||
|
direction: "horizontal" | "vertical",
|
||||||
|
title: string,
|
||||||
|
showTitle: boolean,
|
||||||
|
classes: string,
|
||||||
|
blockVariant?: "block" | "hidden",
|
||||||
|
hidden?: boolean,
|
||||||
|
flexGrow?: number
|
||||||
|
}
|
||||||
|
|
||||||
export type AttributesSpec = {
|
export type AttributesSpec = {
|
||||||
name: string,
|
name: string,
|
||||||
type: string,
|
type: string,
|
||||||
@@ -61,6 +71,12 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
|
|||||||
editable: true,
|
editable: true,
|
||||||
values: ["horizontal", "vertical"]
|
values: ["horizontal", "vertical"]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "flexGrow",
|
||||||
|
type: "number",
|
||||||
|
location: "widget",
|
||||||
|
editable: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "classes",
|
name: "classes",
|
||||||
type: "string",
|
type: "string",
|
||||||
@@ -102,15 +118,6 @@ const ALL_ATTRIBUTES: AttributesSpecList = [
|
|||||||
];
|
];
|
||||||
export { ALL_ATTRIBUTES };
|
export { ALL_ATTRIBUTES };
|
||||||
|
|
||||||
export type Attributes = {
|
|
||||||
direction: "horizontal" | "vertical",
|
|
||||||
title: string,
|
|
||||||
showTitle: boolean,
|
|
||||||
classes: string,
|
|
||||||
blockVariant?: "block" | "hidden",
|
|
||||||
hidden?: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IDragItem {
|
export interface IDragItem {
|
||||||
type: string,
|
type: string,
|
||||||
id: DragItemID,
|
id: DragItemID,
|
||||||
@@ -190,6 +197,7 @@ function addContainer(parent: ContainerLayout | null, attrs: Partial<Attributes>
|
|||||||
direction: "vertical",
|
direction: "vertical",
|
||||||
classes: "",
|
classes: "",
|
||||||
blockVariant: "block",
|
blockVariant: "block",
|
||||||
|
flexGrow: 100,
|
||||||
...attrs
|
...attrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -216,6 +224,7 @@ function addWidget(parent: ContainerLayout, node: ComfyWidgetNode, attrs: Partia
|
|||||||
showTitle: true,
|
showTitle: true,
|
||||||
direction: "horizontal",
|
direction: "horizontal",
|
||||||
classes: "",
|
classes: "",
|
||||||
|
flexGrow: 100,
|
||||||
...attrs
|
...attrs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -413,6 +422,7 @@ function initDefaultLayout() {
|
|||||||
store.set({
|
store.set({
|
||||||
root: null,
|
root: null,
|
||||||
allItems: {},
|
allItems: {},
|
||||||
|
allItemsByNode: {},
|
||||||
currentId: 0,
|
currentId: 0,
|
||||||
currentSelection: [],
|
currentSelection: [],
|
||||||
isMenuOpen: false,
|
isMenuOpen: false,
|
||||||
@@ -487,6 +497,8 @@ function deserialize(data: SerializedLayoutState, graph: LGraph) {
|
|||||||
attrsChanged: writable(false)
|
attrsChanged: writable(false)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dragItem.attrs.flexGrow = 100;
|
||||||
|
|
||||||
const dragEntry: DragItemEntry = {
|
const dragEntry: DragItemEntry = {
|
||||||
dragItem,
|
dragItem,
|
||||||
children: [],
|
children: [],
|
||||||
|
|||||||
@@ -37,9 +37,22 @@
|
|||||||
$nodeValue = option
|
$nodeValue = option
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let gradient: string = ""
|
||||||
|
let elem: HTMLDivElement = null;
|
||||||
|
|
||||||
|
$: if (elem && node !== null && option !== null && (!$propsChanged || $propsChanged)) {
|
||||||
|
const slider = elem.querySelector("input[type='range']") as any
|
||||||
|
//const range_selectors = "[id$='_clone']:is(input[type='range'])";
|
||||||
|
let spacing = ((slider.step / ( slider.max - slider.min )) * 100.0);
|
||||||
|
let tsp = 'max(3px, calc('+spacing+'% - 2px))';
|
||||||
|
let fsp = 'max(4px, calc('+spacing+'% + 0px))';
|
||||||
|
const style = elem.style;
|
||||||
|
style.setProperty('--ae-slider-bg-overlay', 'repeating-linear-gradient( 90deg, transparent, transparent '+tsp+', var(--ae-input-border-color) '+tsp+', var(--ae-input-border-color) '+fsp+' )');
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="wrapper gradio-slider">
|
<div class="wrapper gradio-slider" bind:this={elem}>
|
||||||
{#if node !== null && option !== null}
|
{#if node !== null && option !== null}
|
||||||
<Range
|
<Range
|
||||||
bind:value={option}
|
bind:value={option}
|
||||||
|
|||||||
@@ -152,19 +152,18 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget.selected {
|
.animation-wrapper > .widget:not(.selected) {
|
||||||
background: var(--ae-primary-color) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animation-wrapper > .widget {
|
|
||||||
background: var(--ae-panel-bg-color) !important;
|
background: var(--ae-panel-bg-color) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container.z-index2 > .block > .v-pane > .animation-wrapper > .widget:not(.edit) {
|
.container {
|
||||||
|
.z-index0, .z-index1, .z-index2 {
|
||||||
|
> .block > .v-pane > .animation-wrapper > .widget:not(.edit) {
|
||||||
padding: var(--ae-inside-padding-size) !important;
|
padding: var(--ae-inside-padding-size) !important;
|
||||||
border: 1px solid var(--ae-panel-border-color) !important;
|
border: 1px solid var(--ae-panel-border-color) !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.widget:has(> .gradio-button) {
|
.widget:has(> .gradio-button) {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
|
||||||
@@ -226,10 +225,15 @@ div.float {
|
|||||||
color: var(--ae-primary-color)!important;
|
color: var(--ae-primary-color)!important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.widget.edit {
|
.widget {
|
||||||
|
&.selected {
|
||||||
|
background: var(--ae-primary-color) !important;
|
||||||
|
}
|
||||||
|
&.edit:not(.selected) {
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
border-color: var(--ae-primary-color) !important;
|
border-color: var(--ae-primary-color) !important;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.target-name {
|
.target-name {
|
||||||
background: var(--ae-subpanel-bg-color);
|
background: var(--ae-subpanel-bg-color);
|
||||||
@@ -722,6 +726,12 @@ input[type=range]::-ms-fill-upper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.widget > .wrapper.comfy-combo .svelte-select {
|
.widget > .wrapper.comfy-combo .svelte-select {
|
||||||
|
--font-size: 13px;
|
||||||
|
--height: 32px;
|
||||||
|
--input-padding: 0px;
|
||||||
|
--chevron-height: 32px;
|
||||||
|
--padding: 0 0 0 8px;
|
||||||
|
|
||||||
background: var(--ae-input-bg-color) !important;
|
background: var(--ae-input-bg-color) !important;
|
||||||
border-radius: 0px !important;
|
border-radius: 0px !important;
|
||||||
border-color: var(--ae-input-border-color) !important;
|
border-color: var(--ae-input-border-color) !important;
|
||||||
|
|||||||
Reference in New Issue
Block a user