MCPcopy Create free account
hub / github.com/DFin/palaeograph / syncPointScaleControls

Function syncPointScaleControls

src/main.js:122–149  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

120}
121
122function syncPointScaleControls() {
123 let min = Number(state.mapping.pointScaleMin);
124 let max = Number(state.mapping.pointScaleMax);
125 if (!Number.isFinite(min)) min = 0;
126 if (!Number.isFinite(max)) max = min + 1;
127 if (min < 0) min = 0;
128 if (max < min) {
129 max = min;
130 }
131 state.mapping.pointScaleMin = min;
132 state.mapping.pointScaleMax = max;
133 if (dom.pointScaleMin) dom.pointScaleMin.value = String(min);
134 if (dom.pointScaleMax) dom.pointScaleMax.value = String(max);
135 if (dom.pointScale) {
136 dom.pointScale.min = String(min);
137 dom.pointScale.max = String(Math.max(max, min));
138 const span = Math.max(Math.abs(max - min), 0);
139 const step = span > 0 ? span / 100 : 0.01;
140 dom.pointScale.step = step.toFixed(6);
141 state.mapping.pointScale = clamp(
142 Number(state.mapping.pointScale),
143 min,
144 Math.max(max, min)
145 );
146 dom.pointScale.value = String(state.mapping.pointScale);
147 scene.setPointScaleFactor(state.mapping.pointScale);
148 }
149}
150
151function syncLabelScaleControls() {
152 let min = Number(state.mapping.labelScaleMin);

Callers 3

resetUIFunction · 0.85
handleFileListFunction · 0.85
main.jsFile · 0.85

Calls 2

clampFunction · 0.85
setPointScaleFactorMethod · 0.80

Tested by

no test coverage detected