From e060e3ee949983bb5804f0c4fd981a78002d81ee Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Fri, 11 Apr 2014 13:01:07 +0200 Subject: [PATCH] reverted to setTimeout in safari per #83 --- src/graph/Graph.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/graph/Graph.js b/src/graph/Graph.js index ef189c26..3a330fd4 100644 --- a/src/graph/Graph.js +++ b/src/graph/Graph.js @@ -1901,13 +1901,23 @@ if (typeof window !== 'undefined') { /** * Schedule a animation step with the refreshrate interval. - * - * @poram {Boolean} runCalculationStep */ Graph.prototype.start = function() { if (this.moving || this.xIncrement != 0 || this.yIncrement != 0 || this.zoomIncrement != 0) { - if (!this.timer) { - this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + if (!this.timer) { + var ua = navigator.userAgent.toLowerCase(); + if (ua.indexOf('safari') != -1) { + if (ua.indexOf('chrome') <= -1) { + // safari + this.timer = window.setTimeout(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + else { + this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } + } + else{ + this.timer = window.requestAnimationFrame(this._animationStep.bind(this), this.renderTimestep); // wait this.renderTimeStep milliseconds and perform the animation step function + } } } else {