MCPcopy Create free account
hub / github.com/32comic/image2pixel-web / initializeSliderControls

Method initializeSliderControls

pixelizer.js:92–120  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90 }
91
92 initializeSliderControls() {
93 const sliders = [
94 { range: 'targetWidth', input: 'targetWidthInput' },
95 { range: 'pixelColorCount', input: 'pixelColorCountInput' },
96 { range: 'prefilterStrength', input: 'prefilterStrengthInput' }
97 ];
98
99 sliders.forEach(({ range, input }) => {
100 const rangeEl = document.getElementById(range);
101 const inputEl = document.getElementById(input);
102
103 if (rangeEl && inputEl) {
104 rangeEl.addEventListener('input', () => {
105 inputEl.value = rangeEl.value;
106 this.updatePreviewIfNeeded();
107 });
108
109 inputEl.addEventListener('input', () => {
110 let value = parseInt(inputEl.value) || 1;
111 const min = parseInt(inputEl.min);
112 const max = parseInt(inputEl.max);
113 value = Math.min(Math.max(value, min), max);
114 inputEl.value = value;
115 rangeEl.value = value;
116 this.updatePreviewIfNeeded();
117 });
118 }
119 });
120 }
121
122 handleDragOver(e) {
123 e.preventDefault();

Callers 1

Calls 1

updatePreviewIfNeededMethod · 0.95

Tested by

no test coverage detected