Skip to content

Commit 89582c1

Browse files
authored
Merge pull request #444 from tjenkinson/request-item-when-rate-change
request a new item when the rate changes from 0 to something
2 parents df19f54 + 7ca9c4b commit 89582c1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/marquee.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class Marquee {
105105
this._waitingForItem = false;
106106
}
107107

108-
this._tick();
108+
this._tick(this._waitingForItem);
109109
}
110110

111111
getRate() {
@@ -192,12 +192,12 @@ export class Marquee {
192192
this._windowOffset = 0;
193193
}
194194

195-
_tick() {
195+
_tick(force = false) {
196196
this._boundary.enter(({ callbacks }) => {
197197
this._renderTimer && clearTimeout(this._renderTimer);
198198
this._renderTimer = null;
199199

200-
if (!this._items.length && !this._pendingItem) {
200+
if (!force && !this._items.length && !this._pendingItem) {
201201
this._cleanup();
202202
return;
203203
}
@@ -305,7 +305,7 @@ export class Marquee {
305305

306306
// add a buffer on the side to make sure that new elements are added before they would actually be on screen
307307
const buffer = (renderInterval / 1000) * Math.abs(this._rate);
308-
let requireNewItem = false;
308+
let requireNewItem = this._waitingForItem;
309309
if (
310310
!this._waitingForItem &&
311311
this._items.length /* there should always be items at this point */

0 commit comments

Comments
 (0)