Skip to content

Commit

Permalink
修复IE下的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Jul 3, 2013
1 parent afd7472 commit e564ff2
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/chart/force.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ define(function(require) {
var filteredNodeMap = [];
var cursor = 0;
nodesRawData = _filter(nodes, function(node, idx) {
if(!node){
return;
}
if (self.selectedMap[node.category]) {
filteredNodeMap[idx] = cursor++;
return true;
Expand Down Expand Up @@ -453,7 +456,7 @@ define(function(require) {
// 节点1受到的力
vec2.scale(v12, v12, forceFactor);
vec2.add(nodeForces[s], nodeForces[s], v12);
//节点2受到的力
// 节点2受到的力
vec2.sub(nodeForces[t], nodeForces[t], v12);
}
// 到质心的向心力
Expand Down Expand Up @@ -537,7 +540,7 @@ define(function(require) {
temperature *= 0.999;
}

var interval;
var _updating;

function init(newOption, newComponent) {
option = newOption;
Expand All @@ -548,9 +551,14 @@ define(function(require) {
self.clear();
_buildShape();

interval = setInterval(function(){
_step();
}, stepTime);
_updating = true;
function cb() {
if (_updating) {
_step();
setTimeout(cb, stepTime);
}
}
setTimeout(cb, stepTime);
}

function refresh() {
Expand All @@ -560,7 +568,7 @@ define(function(require) {
}

function dispose(){
clearInterval(interval);
_updating = false;
}

/**
Expand Down

0 comments on commit e564ff2

Please sign in to comment.