MCPcopy Create free account
hub / github.com/DFin/Neural-Network-Visualisation / applyConnectionLimit

Function applyConnectionLimit

assets/main.js:435–451  ·  view source on GitHub ↗
(rawValue, { emit = true } = {})

Source from the content-addressed store, hash-verified

433 };
434
435 const applyConnectionLimit = (rawValue, { emit = true } = {}) => {
436 let parsed = Number.parseInt(rawValue, 10);
437 if (!Number.isFinite(parsed)) {
438 parsed = neuralScene.options.maxConnectionsPerNeuron;
439 }
440 const maxValue = Number.parseInt(connectionSlider.max, 10) || sliderMax;
441 const clamped = Math.min(maxValue, Math.max(1, parsed));
442 syncConnectionUi(clamped);
443 if (!emit) return;
444 const changed = neuralScene.setMaxConnectionsPerNeuron(clamped);
445 if (changed) {
446 if (typeof onConnectionsSettingsChange === "function") {
447 onConnectionsSettingsChange(clamped);
448 }
449 VISUALIZER_CONFIG.maxConnectionsPerNeuron = clamped;
450 }
451 };
452
453 applyConnectionLimit(neuralScene.options.maxConnectionsPerNeuron, { emit: false });
454

Callers 1

Calls 3

syncConnectionUiFunction · 0.85

Tested by

no test coverage detected