Re-enabled RAF_SYNCHED, given the fix for https://github.com/CreateJS/EaselJS/issues/516

This commit is contained in:
Scott Erickson 2014-11-18 15:56:33 -08:00
parent 1444d84aea
commit 8ec016e4b2
2 changed files with 42 additions and 37 deletions
app/lib/surface
vendor/scripts

View file

@ -125,7 +125,7 @@ module.exports = Surface = class Surface extends CocoClass
@webGLCanvas[0].addEventListener 'mouseup', @onMouseUp @webGLCanvas[0].addEventListener 'mouseup', @onMouseUp
@webGLCanvas.on 'mousewheel', @onMouseWheel @webGLCanvas.on 'mousewheel', @onMouseWheel
@hookUpChooseControls() if @options.choosing # TODO: figure this stuff out @hookUpChooseControls() if @options.choosing # TODO: figure this stuff out
# createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED # TODO: Reenable once this is fixed: https://github.com/CreateJS/EaselJS/issues/516 createjs.Ticker.timingMode = createjs.Ticker.RAF_SYNCHED # TODO: Reenable once this is fixed: https://github.com/CreateJS/EaselJS/issues/516
createjs.Ticker.setFPS @options.frameRate createjs.Ticker.setFPS @options.frameRate
@onResize() @onResize()

View file

@ -690,37 +690,39 @@ this.createjs = this.createjs||{};
(function() { (function() {
"use strict"; "use strict";
// constructor: // constructor:
/** /**
* The Ticker provides a centralized tick or heartbeat broadcast at a set interval. Listeners can subscribe to the tick * The Ticker provides a centralized tick or heartbeat broadcast at a set interval. Listeners can subscribe to the tick
* event to be notified when a set time interval has elapsed. * event to be notified when a set time interval has elapsed.
* *
* Note that the interval that the tick event is called is a target interval, and may be broadcast at a slower interval * Note that the interval that the tick event is called is a target interval, and may be broadcast at a slower interval
* during times of high CPU load. The Ticker class uses a static interface (ex. <code>Ticker.getPaused()</code>) and * during times of high CPU load. The Ticker class uses a static interface (ex. <code>Ticker.getPaused()</code>) and
* should not be instantiated. * should not be instantiated.
* *
* <h4>Example</h4> * <h4>Example</h4>
* *
* createjs.Ticker.addEventListener("tick", handleTick); * createjs.Ticker.addEventListener("tick", handleTick);
* function handleTick(event) { * function handleTick(event) {
* // Actions carried out each frame * // Actions carried out each frame
* if (!event.paused) { * if (!event.paused) {
* // Actions carried out when the Ticker is not paused. * // Actions carried out when the Ticker is not paused.
* } * }
* } * }
* *
* To update a stage every tick, the {{#crossLink "Stage"}}{{/crossLink}} instance can also be used as a listener, as * To update a stage every tick, the {{#crossLink "Stage"}}{{/crossLink}} instance can also be used as a listener, as
* it will automatically update when it receives a tick event: * it will automatically update when it receives a tick event:
* *
* createjs.Ticker.addEventListener("tick", stage); * createjs.Ticker.addEventListener("tick", stage);
* *
* @class Ticker * @class Ticker
* @uses EventDispatcher * @uses EventDispatcher
* @static * @static
**/ **/
var Ticker = function() { function Ticker() {
throw "Ticker cannot be instantiated."; throw "Ticker cannot be instantiated.";
}; }
// constants: // constants:
/** /**
@ -769,8 +771,8 @@ var Ticker = function() {
**/ **/
Ticker.TIMEOUT = "timeout"; Ticker.TIMEOUT = "timeout";
// events:
// static events:
/** /**
* Dispatched each tick. The event will be dispatched to each listener even when the Ticker has been paused using * Dispatched each tick. The event will be dispatched to each listener even when the Ticker has been paused using
* {{#crossLink "Ticker/setPaused"}}{{/crossLink}}. * {{#crossLink "Ticker/setPaused"}}{{/crossLink}}.
@ -793,6 +795,7 @@ var Ticker = function() {
* @since 0.6.0 * @since 0.6.0
*/ */
// public static properties: // public static properties:
/** /**
* Deprecated in favour of {{#crossLink "Ticker/timingMode"}}{{/crossLink}}, and will be removed in a future version. If true, timingMode will * Deprecated in favour of {{#crossLink "Ticker/timingMode"}}{{/crossLink}}, and will be removed in a future version. If true, timingMode will
@ -833,6 +836,7 @@ var Ticker = function() {
*/ */
Ticker.maxDelta = 0; Ticker.maxDelta = 0;
// mix-ins: // mix-ins:
// EventDispatcher methods: // EventDispatcher methods:
Ticker.removeEventListener = null; Ticker.removeEventListener = null;
@ -847,8 +851,8 @@ var Ticker = function() {
return Ticker._addEventListener.apply(Ticker, arguments); return Ticker._addEventListener.apply(Ticker, arguments);
}; };
// private static properties: // private static properties:
/** /**
* @property _paused * @property _paused
* @type {Boolean} * @type {Boolean}
@ -937,8 +941,8 @@ var Ticker = function() {
**/ **/
Ticker._raf = true; Ticker._raf = true;
// public static methods: // public static methods:
/** /**
* Starts the tick. This is called automatically when the first listener is added. * Starts the tick. This is called automatically when the first listener is added.
* @method init * @method init
@ -1147,6 +1151,7 @@ var Ticker = function() {
return Ticker._ticks - (pauseable ?Ticker._pausedTicks : 0); return Ticker._ticks - (pauseable ?Ticker._pausedTicks : 0);
}; };
// private static methods: // private static methods:
/** /**
* @method _handleSynch * @method _handleSynch
@ -1154,12 +1159,11 @@ var Ticker = function() {
* @protected * @protected
**/ **/
Ticker._handleSynch = function() { Ticker._handleSynch = function() {
var time = Ticker._getTime() - Ticker._startTime;
Ticker._timerId = null; Ticker._timerId = null;
Ticker._setupTick(); Ticker._setupTick();
// run if enough time has elapsed, with a little bit of flexibility to be early: // run if enough time has elapsed, with a little bit of flexibility to be early:
if (time - Ticker._lastTime >= (Ticker._interval-1)*0.97) { if (Ticker._getTime() - Ticker._lastTime >= (Ticker._interval-1)*0.97) {
Ticker._tick(); Ticker._tick();
} }
}; };
@ -1252,7 +1256,8 @@ var Ticker = function() {
return (now&&now.call(performance))||(new Date().getTime()); return (now&&now.call(performance))||(new Date().getTime());
}; };
createjs.Ticker = Ticker;
createjs.Ticker = Ticker;
}()); }());
/* /*
* Tween * Tween