Fix/steady comment box #49

Merged
gnilebein merged 3 commits from fix/steady-comment-box into main 2026-11-11 14:04:27 +01:00
3 changed files with 31 additions and 12 deletions
Showing only changes of commit 7a378a0bc5 - Show all commits

No files matched your search

+1 -1
View File
@@ -225,7 +225,7 @@ tests/ PHPUnit; PlenarioTestTrait erzeugt Testdaten, Fixtures
`Comments.delay()` = 2,5 s + 15 Zeichen/s, 5–30 s, geteilt durch das Tempo der Umfrage `polls.comment_speed` (Prozent aus `Comments.delay()` = 2,5 s + 15 Zeichen/s, 5–30 s, geteilt durch das Tempo der Umfrage `polls.comment_speed` (Prozent aus
`Poll::COMMENT_SPEEDS`, im State `poll.commentSpeed` als Faktor, Dashboard → „Einstellungen“); Vor/Zurück/Fortsetzen geben dem Kommentar wieder die volle Zeit; „Kommentar X von N“, `Poll::COMMENT_SPEEDS`, im State `poll.commentSpeed` als Faktor, Dashboard → „Einstellungen“); Vor/Zurück/Fortsetzen geben dem Kommentar wieder die volle Zeit; „Kommentar X von N“,
vor/zurück/Pause, Laufbalken bis zum Wechsel (`Comments.progress()`, setzt nach dem Neu-Rendern per negativem vor/zurück/Pause, Laufbalken bis zum Wechsel (`Comments.progress()`, setzt nach dem Neu-Rendern per negativem
`animation-delay` fort, bei Pause unsichtbar), Zustand übersteht das Neu-Rendern beim Polling; die Box ist so hoch wie der längste Kommentar – alle liegen unsichtbar in derselben Grid-Zelle –, damit die zentrierte Bühne beim Wechsel nicht springt; höchstens `--comment-max` ≈ 5 Zeilen, längere Kommentare setzt `Comments.fit()` kleiner statt sie abzuschneiden; die Bewertung steht über dem Text, damit sie an fester Stelle bleibt; der Fortschrittsbalken ist die Unterkante der Box). Bei internem Feedback erscheinen sie erst, `animation-delay` fort, bei Pause unsichtbar), Zustand übersteht das Neu-Rendern beim Polling; die Box ist so hoch wie der längste Kommentar – alle liegen unsichtbar in derselben Grid-Zelle –, damit die zentrierte Bühne beim Wechsel nicht springt; höchstens `--comment-max` ≈ 5 Zeilen, längere Kommentare setzt `Comments.fit()` kleiner statt sie abzuschneiden; die Bewertung steht über dem Text, damit sie an fester Stelle bleibt; der Fortschritt läuft als Rahmen der Box: `Comments.progressBorder()`, SVG-Rechteck mit `pathLength` 100, zwei Linien ab gegenüberliegenden Ecken). Bei internem Feedback erscheinen sie erst,
wenn der Presenter die Ergebnisse einblendet. wenn der Presenter die Ergebnisse einblendet.
- **Sterne-Bewertung** (Skala mit Setting `style = stars`, `Slide::isStarRating()`, Standard `numbers`): immer 1 bis `scale_max` - **Sterne-Bewertung** (Skala mit Setting `style = stars`, `Slide::isStarRating()`, Standard `numbers`): immer 1 bis `scale_max`
Sterne (`SlidesTable::sanitizeSettings()` erzwingt `scale_min = 1`), gespeichert wie jede Skala als `numeric_value`. Sterne (`SlidesTable::sanitizeSettings()` erzwingt `scale_min = 1`), gespeichert wie jede Skala als `numeric_value`.
+11 -6
View File
@@ -593,13 +593,18 @@ button.qa-steps__step:hover:not(:disabled) { color: var(--text); border-color: v
/* at most about 5 lines; longer comments are set smaller by Comments.fit() instead of being cut off */ /* at most about 5 lines; longer comments are set smaller by Comments.fit() instead of being cut off */
.comments { --comment-size: 1.25em; --comment-max: 9.5em; } .comments { --comment-size: 1.25em; --comment-max: 9.5em; }
.comments__sizer, .comments__current { max-height: var(--comment-max); overflow: hidden; } .comments__sizer, .comments__current { max-height: var(--comment-max); overflow: hidden; }
/* progress until the next comment: the bottom edge of the box, takes no room of its own */ /* progress until the next comment: the border of the box, two lines from opposite corners
.comments__progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--border); } (pathLength 100, dash pattern repeating every half perimeter) that meet when the time is up */
.comments__progress[hidden] { display: block; visibility: hidden; } /* paused: the edge stays plain */ .comments__progress { position: absolute; inset: 0; pointer-events: none; }
.comments__progress-fill { height: 100%; background: var(--primary); transform: scaleX(0); transform-origin: left; } .comments__progress[hidden] { display: block; visibility: hidden; } /* paused: no border */
.comments__progress svg { display: block; width: 100%; height: 100%; }
.comments__progress-fill {
x: 2px; y: 2px; width: calc(100% - 4px); height: calc(100% - 4px); rx: 12px;
fill: none; stroke: var(--primary); stroke-width: 4px; stroke-dasharray: 0 50;
}
@keyframes comment-progress { @keyframes comment-progress {
from { transform: scaleX(0); } from { stroke-dasharray: 0 50; }
to { transform: scaleX(1); } to { stroke-dasharray: 50 0; }
} }
.comments__nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; } .comments__nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.comments__button { min-width: 44px; min-height: 44px; } .comments__button { min-width: 44px; min-height: 44px; }
+19 -5
View File
@@ -360,9 +360,7 @@
]) ])
])), ])),
// Time left until the next comment; decorative, the counter carries the information. // Time left until the next comment; decorative, the counter carries the information.
items.length < 2 ? null : el('div', { class: 'comments__progress', 'data-comment-progress': '', 'aria-hidden': 'true' }, [ items.length < 2 ? null : Comments.progressBorder(),
el('div', { class: 'comments__progress-fill' })
]),
items.length < 2 ? null : el('div', { class: 'comments__nav' }, [ items.length < 2 ? null : el('div', { class: 'comments__nav' }, [
button('prev', 'Vorheriger Kommentar', '‹'), button('prev', 'Vorheriger Kommentar', '‹'),
button('toggle', '', ''), button('toggle', '', ''),
@@ -459,6 +457,22 @@
}, Comments.duration); }, Comments.duration);
}, },
/**
* Progress as the border of the box: an SVG outline (follows the rounded corners) whose
* dash pattern repeats every half perimeter, so two lines start at opposite corners
* (top left along the top, bottom right along the bottom) and meet when the time is up.
*/
progressBorder: function () {
var ns = 'http://www.w3.org/2000/svg';
var svg = document.createElementNS(ns, 'svg');
var rect = document.createElementNS(ns, 'rect');
rect.setAttribute('class', 'comments__progress-fill');
rect.setAttribute('pathLength', '100');
rect.setAttribute('data-comment-progress-fill', '');
svg.appendChild(rect);
return el('div', { class: 'comments__progress', 'data-comment-progress': '', 'aria-hidden': 'true' }, [svg]);
},
/** /**
* Fills the progress bar over the remaining time of the current comment. * Fills the progress bar over the remaining time of the current comment.
* Picks up where it was after a re-render (negative animation delay); hidden while paused. * Picks up where it was after a re-render (negative animation delay); hidden while paused.
@@ -468,10 +482,10 @@
if (!bar) { if (!bar) {
return; return;
} }
var fill = bar.firstChild; var fill = bar.querySelector('[data-comment-progress-fill]');
bar.hidden = Comments.paused; bar.hidden = Comments.paused;
fill.style.animation = 'none'; fill.style.animation = 'none';
void fill.offsetWidth; // restart the CSS animation void fill.getBoundingClientRect(); // restart the CSS animation (SVG has no offsetWidth)
if (!Comments.paused) { if (!Comments.paused) {
var elapsed = Math.min(Date.now() - Comments.startedAt, Comments.duration); var elapsed = Math.min(Date.now() - Comments.startedAt, Comments.duration);
fill.style.animation = 'comment-progress ' + Comments.duration + 'ms linear -' + elapsed + 'ms forwards'; fill.style.animation = 'comment-progress ' + Comments.duration + 'ms linear -' + elapsed + 'ms forwards';