Skip to content

Commit 95b18ae

Browse files
committed
Refined poll rate handling and added pluginUpdate
1 parent 43c72e2 commit 95b18ae

1 file changed

Lines changed: 16 additions & 15 deletions

File tree

src/input/InputPlugin.js

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,19 @@ var InputPlugin = new Class({
532532
*/
533533
pluginUpdate: function (time, delta)
534534
{
535-
if (!this.isActive())
535+
if (this.pollRate > -1)
536536
{
537-
return;
537+
this.update(time, delta);
538+
}
539+
else
540+
{
541+
if (!this.isActive())
542+
{
543+
return;
544+
}
545+
546+
this.pluginEvents.emit(Events.UPDATE, time, delta);
538547
}
539-
540-
this.pluginEvents.emit(Events.UPDATE, time, delta);
541548
},
542549

543550
/**
@@ -561,17 +568,17 @@ var InputPlugin = new Class({
561568

562569
var manager = this.manager;
563570

564-
// this.pluginEvents.emit(Events.UPDATE, time, delta);
571+
this.pluginEvents.emit(Events.UPDATE, time, delta);
565572

566573
// Another Scene above this one has already consumed the input events, or we're in transition
567574
if (manager.globalTopOnly && manager.ignoreEvents)
568575
{
569576
return;
570577
}
571578

572-
var runUpdate = (manager.dirty || this.pollRate === 0 || manager.useQueue);
579+
var runUpdate = (manager.dirty || this.pollRate === 0);
573580

574-
if (this.pollRate > -1)
581+
if (this.pollRate > 0)
575582
{
576583
this._pollTimer -= delta;
577584

@@ -1949,10 +1956,7 @@ var InputPlugin = new Class({
19491956
*/
19501957
setPollAlways: function ()
19511958
{
1952-
this.pollRate = 0;
1953-
this._pollTimer = 0;
1954-
1955-
return this;
1959+
return this.setPollRate(0);
19561960
},
19571961

19581962
/**
@@ -1968,10 +1972,7 @@ var InputPlugin = new Class({
19681972
*/
19691973
setPollOnMove: function ()
19701974
{
1971-
this.pollRate = -1;
1972-
this._pollTimer = 0;
1973-
1974-
return this;
1975+
return this.setPollRate(-1);
19751976
},
19761977

19771978
/**

0 commit comments

Comments
 (0)