Let each poll speed up or slow down the scale comments
A new poll setting (polls.comment_speed, 50-200 %) scales the display time of the rotating scale comments in the presentation and embed; the duration still follows the text length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c1f9be2eef
commit
166cb475c6
10 files changed
+100
-6
No files matched your search
@@ -303,6 +303,8 @@
|
||||
timer: null,
|
||||
items: [],
|
||||
format: String,
|
||||
// Speed factor of the poll (state.poll.commentSpeed): 2 = half the time per comment.
|
||||
speed: 1,
|
||||
node: null,
|
||||
// Countdown of the comment shown (drives the progress bar across re-renders).
|
||||
startedAt: 0,
|
||||
@@ -392,7 +394,9 @@
|
||||
delay: function (item) {
|
||||
var length = item && item.text ? Array.from(item.text).length : 0;
|
||||
var ms = Comments.BASE_MS + length / Comments.CHARS_PER_SECOND * 1000;
|
||||
return Math.round(Math.min(Comments.MAX_MS, Math.max(Comments.MIN_MS, ms)));
|
||||
// The poll's speed factor scales the bounds too, so short comments change as well.
|
||||
var speed = Comments.speed > 0 ? Comments.speed : 1;
|
||||
return Math.round(Math.min(Comments.MAX_MS, Math.max(Comments.MIN_MS, ms)) / speed);
|
||||
},
|
||||
|
||||
/** (Re)start the countdown for the comment currently shown. */
|
||||
@@ -1238,6 +1242,7 @@
|
||||
container.appendChild(Results.privateSummary(state.results));
|
||||
return;
|
||||
}
|
||||
Comments.speed = state.poll && state.poll.commentSpeed;
|
||||
Results.render(container, slide && slide.isInteractive ? state.results : null, {
|
||||
onStage: function (stage) { control('stage', { stage: stage }); },
|
||||
onQuestion: function (step) { control('question', { step: step }); }
|
||||
|
||||
Reference in new issue
Block a user