(rawValue, { emit = true } = {})
| 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 |
no test coverage detected