mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-06-13 14:09:25 -03:00
feat(settings): add adjustable card overlay blur setting (#973)
This commit is contained in:
@@ -278,7 +278,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent 15%, oklch(0% 0 0 / 0.75));
|
||||
backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(var(--card-blur-amount, 8px));
|
||||
color: white;
|
||||
padding: var(--space-1);
|
||||
display: flex;
|
||||
@@ -294,7 +294,7 @@
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(oklch(0% 0 0 / 0.75), transparent 85%);
|
||||
backdrop-filter: blur(8px);
|
||||
backdrop-filter: blur(var(--card-blur-amount, 8px));
|
||||
color: white;
|
||||
padding: var(--space-1);
|
||||
display: flex;
|
||||
|
||||
@@ -813,6 +813,67 @@
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Range Slider Control */
|
||||
.range-control {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.range-control input[type="range"] {
|
||||
width: 120px;
|
||||
height: 4px;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background: var(--border-color);
|
||||
border-radius: 2px;
|
||||
outline: none;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-webkit-slider-thumb {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
background: var(--lora-accent);
|
||||
cursor: pointer;
|
||||
border: 2px solid var(--lora-surface);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
||||
transition: transform 0.15s ease;
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-webkit-slider-thumb:hover {
|
||||
transform: scale(1.15);
|
||||
}
|
||||
|
||||
.range-control input[type="range"]::-moz-range-thumb {
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border-radius: 50%;
|
||||
background: var(--lora-accent);
|
||||
cursor: pointer;
|
||||
border: 2px solid var(--lora-surface);
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.range-control .range-value {
|
||||
min-width: 36px;
|
||||
text-align: center;
|
||||
font-size: 0.9em;
|
||||
font-weight: 600;
|
||||
color: var(--text-color);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .range-control input[type="range"] {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
/* Toggle Switch */
|
||||
.toggle-switch {
|
||||
position: relative;
|
||||
|
||||
@@ -804,6 +804,16 @@ export class SettingsManager {
|
||||
);
|
||||
}
|
||||
|
||||
// Set card blur amount slider
|
||||
const cardBlurAmountInput = document.getElementById('cardBlurAmount');
|
||||
if (cardBlurAmountInput) {
|
||||
cardBlurAmountInput.value = state.global.settings.card_blur_amount ?? 8;
|
||||
}
|
||||
const cardBlurAmountValue = document.getElementById('cardBlurAmountValue');
|
||||
if (cardBlurAmountValue) {
|
||||
cardBlurAmountValue.textContent = `${state.global.settings.card_blur_amount ?? 8}px`;
|
||||
}
|
||||
|
||||
const usePortableCheckbox = document.getElementById('usePortableSettings');
|
||||
if (usePortableCheckbox) {
|
||||
usePortableCheckbox.checked = !!state.global.settings.use_portable_settings;
|
||||
@@ -2051,6 +2061,28 @@ export class SettingsManager {
|
||||
}
|
||||
}
|
||||
|
||||
async saveRangeSetting(elementId, displayId, settingKey) {
|
||||
const element = document.getElementById(elementId);
|
||||
if (!element) return;
|
||||
|
||||
const value = parseInt(element.value, 10);
|
||||
|
||||
try {
|
||||
await this.saveSetting(settingKey, value);
|
||||
this.applyFrontendSettings();
|
||||
|
||||
// Update the displayed value next to the slider
|
||||
const displayEl = document.getElementById(displayId);
|
||||
if (displayEl) {
|
||||
displayEl.textContent = `${value}px`;
|
||||
}
|
||||
|
||||
showToast('toast.settings.settingsUpdated', { setting: settingKey.replace(/_/g, ' ') }, 'success');
|
||||
} catch (error) {
|
||||
showToast('toast.settings.settingSaveFailed', { message: error.message }, 'error');
|
||||
}
|
||||
}
|
||||
|
||||
updateExampleImagesOpenSettingsVisibility() {
|
||||
const openMode = state.global.settings.example_images_open_mode || 'system';
|
||||
const localRootSetting = document.getElementById('exampleImagesLocalRootSetting');
|
||||
@@ -2887,6 +2919,10 @@ export class SettingsManager {
|
||||
}
|
||||
|
||||
applyFrontendSettings() {
|
||||
// Apply card blur amount to CSS custom property
|
||||
const cardBlurAmount = state.global.settings.card_blur_amount ?? 8;
|
||||
document.documentElement.style.setProperty('--card-blur-amount', `${cardBlurAmount}px`);
|
||||
|
||||
// Apply autoplay setting to existing videos in card previews
|
||||
const autoplayOnHover = state.global.settings.autoplay_on_hover;
|
||||
document.querySelectorAll('.card-preview video').forEach(video => {
|
||||
|
||||
@@ -32,6 +32,7 @@ const DEFAULT_SETTINGS_BASE = Object.freeze({
|
||||
auto_download_example_images: false,
|
||||
blur_mature_content: true,
|
||||
mature_blur_level: 'R',
|
||||
card_blur_amount: 8,
|
||||
autoplay_on_hover: false,
|
||||
display_density: 'default',
|
||||
card_info_display: 'always',
|
||||
|
||||
Reference in New Issue
Block a user