Added 'Show buttons on hover only' setting for preview buttons
This commit is contained in:
@@ -190,6 +190,7 @@ def ui_rules():
|
|||||||
Rule("model-show-copy-button", True, bool),
|
Rule("model-show-copy-button", True, bool),
|
||||||
Rule("model-show-load-workflow-button", True, bool),
|
Rule("model-show-load-workflow-button", True, bool),
|
||||||
Rule("model-info-button-on-left", False, bool),
|
Rule("model-info-button-on-left", False, bool),
|
||||||
|
Rule("model-buttons-only-on-hover", False, bool),
|
||||||
|
|
||||||
Rule("model-add-embedding-extension", False, bool),
|
Rule("model-add-embedding-extension", False, bool),
|
||||||
Rule("model-add-drag-strict-on-field", False, bool),
|
Rule("model-add-drag-strict-on-field", False, bool),
|
||||||
|
|||||||
@@ -492,7 +492,6 @@
|
|||||||
.model-manager .comfy-grid .model-preview-top-right,
|
.model-manager .comfy-grid .model-preview-top-right,
|
||||||
.model-manager .comfy-grid .model-preview-top-left {
|
.model-manager .comfy-grid .model-preview-top-left {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
top: 8px;
|
top: 8px;
|
||||||
@@ -506,6 +505,15 @@
|
|||||||
left: 8px;
|
left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.model-manager .item .model-buttons-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.model-manager .item:hover .model-buttons-hidden,
|
||||||
|
.model-manager .comfy-grid .model-buttons-visible {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.model-manager .comfy-grid .model-button {
|
.model-manager .comfy-grid .model-button {
|
||||||
opacity: 0.65;
|
opacity: 0.65;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2044,6 +2044,8 @@ class ModelGrid {
|
|||||||
Math.round(settingsElements['model-preview-thumbnail-width'].value / 0.75);
|
Math.round(settingsElements['model-preview-thumbnail-width'].value / 0.75);
|
||||||
const previewThumbnailHeight =
|
const previewThumbnailHeight =
|
||||||
Math.round(settingsElements['model-preview-thumbnail-height'].value / 0.75);
|
Math.round(settingsElements['model-preview-thumbnail-height'].value / 0.75);
|
||||||
|
const buttonsOnlyOnHover =
|
||||||
|
settingsElements['model-buttons-only-on-hover'].checked;
|
||||||
if (models.length > 0) {
|
if (models.length > 0) {
|
||||||
|
|
||||||
const $overlay = IS_FIREFOX
|
const $overlay = IS_FIREFOX
|
||||||
@@ -2085,6 +2087,8 @@ class ModelGrid {
|
|||||||
draggable: true,
|
draggable: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
const forHiddingButtonsClass = buttonsOnlyOnHover
|
||||||
|
? 'model-buttons-hidden' : 'model-buttons-visible';
|
||||||
|
|
||||||
return models.map((item) => {
|
return models.map((item) => {
|
||||||
const previewInfo = item.preview;
|
const previewInfo = item.preview;
|
||||||
@@ -2182,14 +2186,14 @@ class ModelGrid {
|
|||||||
strictDragToAdd,
|
strictDragToAdd,
|
||||||
),
|
),
|
||||||
$el(
|
$el(
|
||||||
'div.model-preview-top-right',
|
'div.model-preview-top-right.' + forHiddingButtonsClass,
|
||||||
{
|
{
|
||||||
draggable: false,
|
draggable: false,
|
||||||
},
|
},
|
||||||
modelInfoButtonOnLeft ? infoButtons : actionButtons,
|
modelInfoButtonOnLeft ? infoButtons : actionButtons,
|
||||||
),
|
),
|
||||||
$el(
|
$el(
|
||||||
'div.model-preview-top-left',
|
'div.model-preview-top-left.' + forHiddingButtonsClass,
|
||||||
{
|
{
|
||||||
draggable: false,
|
draggable: false,
|
||||||
},
|
},
|
||||||
@@ -4372,6 +4376,7 @@ class SettingsView {
|
|||||||
/** @type {HTMLInputElement} */ 'model-show-copy-button': null,
|
/** @type {HTMLInputElement} */ 'model-show-copy-button': null,
|
||||||
/** @type {HTMLInputElement} */ 'model-show-load-workflow-button': null,
|
/** @type {HTMLInputElement} */ 'model-show-load-workflow-button': null,
|
||||||
/** @type {HTMLInputElement} */ 'model-info-button-on-left': null,
|
/** @type {HTMLInputElement} */ 'model-info-button-on-left': null,
|
||||||
|
/** @type {HTMLInputElement} */ 'model-buttons-only-on-hover': null,
|
||||||
|
|
||||||
/** @type {HTMLInputElement} */ 'model-add-embedding-extension': null,
|
/** @type {HTMLInputElement} */ 'model-add-embedding-extension': null,
|
||||||
/** @type {HTMLInputElement} */ 'model-add-drag-strict-on-field': null,
|
/** @type {HTMLInputElement} */ 'model-add-drag-strict-on-field': null,
|
||||||
@@ -4690,6 +4695,10 @@ class SettingsView {
|
|||||||
$: (el) => (settings['model-info-button-on-left'] = el),
|
$: (el) => (settings['model-info-button-on-left'] = el),
|
||||||
textContent: '"Model Info" button on left',
|
textContent: '"Model Info" button on left',
|
||||||
}),
|
}),
|
||||||
|
$checkbox({
|
||||||
|
$: (el) => (settings['model-buttons-only-on-hover'] = el),
|
||||||
|
textContent: 'Show buttons on hover only',
|
||||||
|
}),
|
||||||
$el('h2', ['Node Graph']),
|
$el('h2', ['Node Graph']),
|
||||||
$checkbox({
|
$checkbox({
|
||||||
$: (el) => (settings['model-add-embedding-extension'] = el),
|
$: (el) => (settings['model-add-embedding-extension'] = el),
|
||||||
|
|||||||
Reference in New Issue
Block a user