Files
chrmc40 8e3dceae99 ComfyUI-PromptChain
A prompt-authoring and image-iteration suite for ComfyUI.
2026-06-17 19:35:25 -07:00

26 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Single source of truth for gallery thumbnail zoom. Two paths reach the
// same persisted pcrGalleryRowHeight: isolation.js's window-capture wheel
// handler → OutputPanel.updateGalleryZoom (node mode, where capture-phase
// stopImmediatePropagation suppresses the gallery's own listener), and
// GeneratedGallery's own wheel handler (fullscreen overlay, where it runs
// first and stops propagation). They previously used different steps and
// clamp ranges (±15 @ 40–300 vs ±25 @ 60–400), so a value pushed past one
// path's max left the other path's scroll clicks dead.
export const GALLERY_ROW_HEIGHT_MIN = 40;
export const GALLERY_ROW_HEIGHT_MAX = 400;
// ~15% per wheel notch: a fixed pixel step is a 40% jump at small sizes but
// vanishes inside the justified layout's repartition tolerance at large
// sizes; a proportional step stays visible across the whole range.
const ZOOM_FACTOR = 1.15;
export function clampGalleryRowHeight(value) {
return Math.max(GALLERY_ROW_HEIGHT_MIN, Math.min(GALLERY_ROW_HEIGHT_MAX, value));
}
export function zoomGalleryRowHeight(current, direction) {
if (!direction) return clampGalleryRowHeight(current);
const next = direction > 0 ? current * ZOOM_FACTOR : current / ZOOM_FACTOR;
return clampGalleryRowHeight(Math.round(next));
}