fixe map node on hiver or opened kan160
This commit is contained in:
@@ -321,6 +321,11 @@
|
||||
Node.prototype.onUpdate = function(){
|
||||
|
||||
// this.p.velocity.multiplyScalar(0.99);
|
||||
if(this.hover || this.opened){
|
||||
this.p.fixed = true;
|
||||
}else{
|
||||
this.p.fixed = false;
|
||||
}
|
||||
|
||||
if(this.center)
|
||||
this.slowDownNearCenter();
|
||||
@@ -530,14 +535,11 @@
|
||||
for (var q = n+1; q < _nodes.length; q++) {
|
||||
if(q===n) continue;
|
||||
|
||||
|
||||
// avoid impact between center and aside particules
|
||||
if((_nodes[n].center && _nodes[q].aside) || (_nodes[n].aside && _nodes[q].center))
|
||||
continue;
|
||||
|
||||
// TODO: what if centered nodes are repulsing each other ??
|
||||
|
||||
margin = _nodes[n].center ? 1 : 1;
|
||||
margin = _nodes[n].center ? 0 : 0; // in px
|
||||
|
||||
// avoid impact between two centered particulses that comes to the center
|
||||
if(_nodes[n].center && _nodes[q].center){
|
||||
@@ -548,7 +550,7 @@
|
||||
|
||||
d = _nodes[n].p.distanceTo(_nodes[q].p);
|
||||
|
||||
full_rad = _nodes[n].r*margin + _nodes[q].r*margin;
|
||||
full_rad = _nodes[n].r + _nodes[q].r + margin;
|
||||
|
||||
// if not colliding skip following
|
||||
if(d > full_rad) continue;
|
||||
|
||||
@@ -321,6 +321,11 @@
|
||||
Node.prototype.onUpdate = function(){
|
||||
|
||||
// this.p.velocity.multiplyScalar(0.99);
|
||||
if(this.hover || this.opened){
|
||||
this.p.fixed = true;
|
||||
}else{
|
||||
this.p.fixed = false;
|
||||
}
|
||||
|
||||
if(this.center)
|
||||
this.slowDownNearCenter();
|
||||
@@ -530,14 +535,11 @@
|
||||
for (var q = n+1; q < _nodes.length; q++) {
|
||||
if(q===n) continue;
|
||||
|
||||
|
||||
// avoid impact between center and aside particules
|
||||
if((_nodes[n].center && _nodes[q].aside) || (_nodes[n].aside && _nodes[q].center))
|
||||
continue;
|
||||
|
||||
// TODO: what if centered nodes are repulsing each other ??
|
||||
|
||||
margin = _nodes[n].center ? 1 : 1;
|
||||
margin = _nodes[n].center ? 0 : 0; // in px
|
||||
|
||||
// avoid impact between two centered particulses that comes to the center
|
||||
if(_nodes[n].center && _nodes[q].center){
|
||||
@@ -548,7 +550,7 @@
|
||||
|
||||
d = _nodes[n].p.distanceTo(_nodes[q].p);
|
||||
|
||||
full_rad = _nodes[n].r*margin + _nodes[q].r*margin;
|
||||
full_rad = _nodes[n].r + _nodes[q].r + margin;
|
||||
|
||||
// if not colliding skip following
|
||||
if(d > full_rad) continue;
|
||||
|
||||
Reference in New Issue
Block a user