()
| 395 | } |
| 396 | |
| 397 | private updateInputs() { |
| 398 | if (!this.panel) { |
| 399 | return; |
| 400 | } |
| 401 | if (this.textColorInput) { |
| 402 | this.textColorInput.value = this.currentSettings.color; |
| 403 | } |
| 404 | if (this.strokeColorInput) { |
| 405 | this.strokeColorInput.value = this.currentSettings.strokeColor; |
| 406 | } |
| 407 | if (this.fontSizeSlider) { |
| 408 | const numericFont = parseInt(this.currentSettings.fontSize, 10); |
| 409 | this.fontSizeSlider.value = String(Math.min(30, Math.max(14, numericFont))); |
| 410 | const fontLabel = this.panel.querySelector<HTMLSpanElement>('.font-size-value'); |
| 411 | if (fontLabel) { |
| 412 | fontLabel.textContent = `${Math.min(30, Math.max(14, numericFont))}px`; |
| 413 | } |
| 414 | this.updateSliderVisual(this.fontSizeSlider); |
| 415 | } |
| 416 | if (this.durationSlider) { |
| 417 | const durationValue = Math.min(20000, Math.max(3000, this.currentSettings.duration)); |
| 418 | this.durationSlider.value = String(durationValue); |
| 419 | const speedLabel = this.panel.querySelector<HTMLSpanElement>('.speed-value'); |
| 420 | if (speedLabel) { |
| 421 | speedLabel.textContent = this.formatDurationLabel(durationValue); |
| 422 | } |
| 423 | this.updateSliderVisual(this.durationSlider); |
| 424 | } |
| 425 | if (this.areaSlider) { |
| 426 | const areaValue = sanitizeDanmuArea(this.currentSettings.area); |
| 427 | this.areaSlider.value = String(areaValue); |
| 428 | const areaLabel = this.panel.querySelector<HTMLSpanElement>('.area-value'); |
| 429 | if (areaLabel) { |
| 430 | areaLabel.textContent = this.formatAreaLabel(areaValue); |
| 431 | } |
| 432 | this.updateSliderVisual(this.areaSlider); |
| 433 | } |
| 434 | if (this.opacitySlider) { |
| 435 | const opacityValue = sanitizeDanmuOpacity(this.currentSettings.opacity); |
| 436 | this.opacitySlider.value = String(opacityValue); |
| 437 | const opacityLabel = this.panel.querySelector<HTMLSpanElement>('.opacity-value'); |
| 438 | if (opacityLabel) { |
| 439 | opacityLabel.textContent = this.formatOpacityLabel(opacityValue); |
| 440 | } |
| 441 | this.updateSliderVisual(this.opacitySlider); |
| 442 | } |
| 443 | } |
| 444 | |
| 445 | private formatDurationLabel(value: number): string { |
| 446 | const clamped = Math.min(20000, Math.max(3000, value)); |
no test coverage detected