/** * Slider-UX wiring shared across the editor: * * 1. `is-using` class while a slider is being dragged (eraser-rows * expand to a wider track when in use). Cleared 0.5s after * pointerup so a quick click doesn't snap back instantly. * 2. Floating value bubble above the thumb during drag. * Desktop: only the layer-opacity slider gets a bubble (the * eraser-row sliders already show a value chip on the right). * Mobile: every slider in the editor gets a bubble. * 3. Click the value chip to type a number directly — replaces * the span with an inline input until blur/Enter. * * Wired ONCE on editor open; the listeners stay alive for the whole * session via state.container delegation. * * @param {{ * registerDocClickAway: (handler: (e: Event) => void) => void, * }} deps */ import { state } from './state.js'; export function wireSliderUx({ registerDocClickAway }) { const container = state.container; if (!container) return; // ── Floating bubble ── const sliderBubble = document.createElement('div'); sliderBubble.className = 'ge-slider-bubble'; sliderBubble.hidden = true; let sliderBubbleSlider = null; // Find the container row for any slider — works for ge-eraser-row // sliders AND the layer-opacity slider on each layer item. function bubbleRowFor(slider) { return slider.closest('.ge-eraser-row, .ge-layer-item, .ge-control-row, .ge-adj-row'); } function bubbleText(slider) { const row = bubbleRowFor(slider); // Pulled-out value chip (after the slider) wins; fall back to // the various `