mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 07:05:43 -03:00
refactor: remove unused height properties and simplify widget height handling in various components, fixes #284
This commit is contained in:
@@ -5,9 +5,6 @@ export function addJsonDisplayWidget(node, name, opts) {
|
|||||||
|
|
||||||
// Set initial height
|
// Set initial height
|
||||||
const defaultHeight = 200;
|
const defaultHeight = 200;
|
||||||
container.style.setProperty('--comfy-widget-min-height', `${defaultHeight}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-max-height', `${defaultHeight * 2}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-height', `${defaultHeight}px`);
|
|
||||||
|
|
||||||
Object.assign(container.style, {
|
Object.assign(container.style, {
|
||||||
display: "block",
|
display: "block",
|
||||||
@@ -113,16 +110,6 @@ export function addJsonDisplayWidget(node, name, opts) {
|
|||||||
widgetValue = v;
|
widgetValue = v;
|
||||||
displayJson(widgetValue, widget);
|
displayJson(widgetValue, widget);
|
||||||
},
|
},
|
||||||
getMinHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-min-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
getMaxHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-max-height')) || defaultHeight * 2;
|
|
||||||
},
|
|
||||||
getHeight: function() {
|
|
||||||
// Return actual container height to reduce the gap
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
hideOnZoom: true
|
hideOnZoom: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ app.registerExtension({
|
|||||||
|
|
||||||
// Update input widget callback
|
// Update input widget callback
|
||||||
const inputWidget = this.widgets[0];
|
const inputWidget = this.widgets[0];
|
||||||
|
inputWidget.options.getMaxHeight = () => 100;
|
||||||
this.inputWidget = inputWidget;
|
this.inputWidget = inputWidget;
|
||||||
inputWidget.callback = (value) => {
|
inputWidget.callback = (value) => {
|
||||||
if (isUpdating) return;
|
if (isUpdating) return;
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ app.registerExtension({
|
|||||||
|
|
||||||
// Update input widget callback
|
// Update input widget callback
|
||||||
const inputWidget = this.widgets[0];
|
const inputWidget = this.widgets[0];
|
||||||
|
inputWidget.options.getMaxHeight = () => 100;
|
||||||
this.inputWidget = inputWidget;
|
this.inputWidget = inputWidget;
|
||||||
inputWidget.callback = (value) => {
|
inputWidget.callback = (value) => {
|
||||||
if (isUpdating) return;
|
if (isUpdating) return;
|
||||||
|
|||||||
@@ -19,9 +19,6 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
|
|
||||||
// Set initial height using CSS variables approach
|
// Set initial height using CSS variables approach
|
||||||
const defaultHeight = 200;
|
const defaultHeight = 200;
|
||||||
container.style.setProperty('--comfy-widget-min-height', `${defaultHeight}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-max-height', `${defaultHeight * 2}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-height', `${defaultHeight}px`);
|
|
||||||
|
|
||||||
Object.assign(container.style, {
|
Object.assign(container.style, {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -712,23 +709,8 @@ export function addLorasWidget(node, name, opts, callback) {
|
|||||||
widgetValue = updatedValue;
|
widgetValue = updatedValue;
|
||||||
renderLoras(widgetValue, widget);
|
renderLoras(widgetValue, widget);
|
||||||
},
|
},
|
||||||
getMinHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-min-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
getMaxHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-max-height')) || defaultHeight * 2;
|
|
||||||
},
|
|
||||||
getHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
hideOnZoom: true,
|
hideOnZoom: true,
|
||||||
selectOn: ['click', 'focus'],
|
selectOn: ['click', 'focus']
|
||||||
afterResize: function(node) {
|
|
||||||
// Re-render after node resize
|
|
||||||
if (this.value && this.value.length > 0) {
|
|
||||||
renderLoras(this.value, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
widget.value = defaultValue;
|
widget.value = defaultValue;
|
||||||
|
|||||||
@@ -5,9 +5,6 @@ export function addTagsWidget(node, name, opts, callback) {
|
|||||||
|
|
||||||
// Set initial height
|
// Set initial height
|
||||||
const defaultHeight = 150;
|
const defaultHeight = 150;
|
||||||
container.style.setProperty('--comfy-widget-min-height', `${defaultHeight}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-max-height', `${defaultHeight * 2}px`);
|
|
||||||
container.style.setProperty('--comfy-widget-height', `${defaultHeight}px`);
|
|
||||||
|
|
||||||
Object.assign(container.style, {
|
Object.assign(container.style, {
|
||||||
display: "flex",
|
display: "flex",
|
||||||
@@ -199,23 +196,8 @@ export function addTagsWidget(node, name, opts, callback) {
|
|||||||
widgetValue = v;
|
widgetValue = v;
|
||||||
renderTags(widgetValue, widget);
|
renderTags(widgetValue, widget);
|
||||||
},
|
},
|
||||||
getMinHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-min-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
getMaxHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-max-height')) || defaultHeight * 2;
|
|
||||||
},
|
|
||||||
getHeight: function() {
|
|
||||||
return parseInt(container.style.getPropertyValue('--comfy-widget-height')) || defaultHeight;
|
|
||||||
},
|
|
||||||
hideOnZoom: true,
|
hideOnZoom: true,
|
||||||
selectOn: ['click', 'focus'],
|
selectOn: ['click', 'focus']
|
||||||
afterResize: function(node) {
|
|
||||||
// Re-render tags after node resize
|
|
||||||
if (this.value && this.value.length > 0) {
|
|
||||||
renderTags(this.value, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Set initial value
|
// Set initial value
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ app.registerExtension({
|
|||||||
|
|
||||||
// Update input widget callback
|
// Update input widget callback
|
||||||
const inputWidget = this.widgets[1];
|
const inputWidget = this.widgets[1];
|
||||||
|
inputWidget.options.getMaxHeight = () => 100;
|
||||||
this.inputWidget = inputWidget;
|
this.inputWidget = inputWidget;
|
||||||
inputWidget.callback = (value) => {
|
inputWidget.callback = (value) => {
|
||||||
if (isUpdating) return;
|
if (isUpdating) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user