|
@@ -25,7 +25,8 @@
|
|
var _canvas = _$canvas[0];
|
|
var _canvas = _$canvas[0];
|
|
var _ctx = _canvas.getContext('2d');
|
|
var _ctx = _canvas.getContext('2d');
|
|
var _canvas_props = {
|
|
var _canvas_props = {
|
|
- 'margin_top':90,
|
|
|
|
|
|
+ // 'margin_top':90, // with red border on head
|
|
|
|
+ 'margin_top':75, // without red border on head
|
|
'margin_right':0,
|
|
'margin_right':0,
|
|
'margin_bottom':65,
|
|
'margin_bottom':65,
|
|
'margin_left':0
|
|
'margin_left':0
|
|
@@ -206,13 +207,13 @@
|
|
// define radius regarding entries length
|
|
// define radius regarding entries length
|
|
switch(true){
|
|
switch(true){
|
|
case this.entrees.length > 3:
|
|
case this.entrees.length > 3:
|
|
- this.r = 10;
|
|
|
|
|
|
+ this.r = 8;//10;
|
|
break;
|
|
break;
|
|
case this.entrees.length > 1 && this.entrees.length <= 3:
|
|
case this.entrees.length > 1 && this.entrees.length <= 3:
|
|
- this.r = 7;
|
|
|
|
|
|
+ this.r = 5;//7;
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
- this.r = 4;
|
|
|
|
|
|
+ this.r = 3;//4;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -225,7 +226,8 @@
|
|
this.aside = false;
|
|
this.aside = false;
|
|
this.scrambling = false;
|
|
this.scrambling = false;
|
|
|
|
|
|
- this.n_repulses = {};
|
|
|
|
|
|
+ this.wall_bouncing_elasticity = 0.75;
|
|
|
|
+ // this.n_repulses = {};
|
|
|
|
|
|
// prototypes
|
|
// prototypes
|
|
if (typeof Node.initialized == "undefined") {
|
|
if (typeof Node.initialized == "undefined") {
|
|
@@ -300,7 +302,7 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(_mouse_in && !this.aside)
|
|
|
|
|
|
+ if(_mouse_in && !this.aside && !this.faded)
|
|
this.checkMouse();
|
|
this.checkMouse();
|
|
|
|
|
|
// if(this.debug)
|
|
// if(this.debug)
|
|
@@ -322,19 +324,27 @@
|
|
switch(true){
|
|
switch(true){
|
|
case this.x < this.wall_limits.left && this.p.velocity.x < 0:
|
|
case this.x < this.wall_limits.left && this.p.velocity.x < 0:
|
|
this.p.position.x = this.wall_limits.left;
|
|
this.p.position.x = this.wall_limits.left;
|
|
- this.p.velocity.multiplyScalarXY(-1, 1).multiplyScalar(0.75);
|
|
|
|
|
|
+ this.p.velocity
|
|
|
|
+ .multiplyScalarXY(-1, 1)
|
|
|
|
+ .multiplyScalar(this.wall_bouncing_elasticity);
|
|
break;
|
|
break;
|
|
case this.x > this.wall_limits.right && this.p.velocity.x > 0:
|
|
case this.x > this.wall_limits.right && this.p.velocity.x > 0:
|
|
this.p.position.x = this.wall_limits.right;
|
|
this.p.position.x = this.wall_limits.right;
|
|
- this.p.velocity.multiplyScalarXY(-1, 1).multiplyScalar(0.75);
|
|
|
|
|
|
+ this.p.velocity
|
|
|
|
+ .multiplyScalarXY(-1, 1)
|
|
|
|
+ .multiplyScalar(this.wall_bouncing_elasticity);
|
|
break;
|
|
break;
|
|
case this.y < this.wall_limits.top && this.p.velocity.y < 0 :
|
|
case this.y < this.wall_limits.top && this.p.velocity.y < 0 :
|
|
this.p.position.y = this.wall_limits.top;
|
|
this.p.position.y = this.wall_limits.top;
|
|
- this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75);
|
|
|
|
|
|
+ this.p.velocity
|
|
|
|
+ .multiplyScalarXY(1,-1)
|
|
|
|
+ .multiplyScalar(this.wall_bouncing_elasticity);
|
|
break;
|
|
break;
|
|
case this.y > this.wall_limits.bottom && this.p.velocity.y > 0 :
|
|
case this.y > this.wall_limits.bottom && this.p.velocity.y > 0 :
|
|
this.p.position.y = this.wall_limits.bottom;
|
|
this.p.position.y = this.wall_limits.bottom;
|
|
- this.p.velocity.multiplyScalarXY(1,-1).multiplyScalar(0.75);
|
|
|
|
|
|
+ this.p.velocity
|
|
|
|
+ .multiplyScalarXY(1,-1)
|
|
|
|
+ .multiplyScalar(this.wall_bouncing_elasticity);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -352,16 +362,23 @@
|
|
&& _m_pos.y < this.y + this.r){
|
|
&& _m_pos.y < this.y + this.r){
|
|
if(_node_hover_id == -1 || _node_hover_id !== this.id){
|
|
if(_node_hover_id == -1 || _node_hover_id !== this.id){
|
|
// console.log("Node hover", this.id);
|
|
// console.log("Node hover", this.id);
|
|
- this.hover = true;
|
|
|
|
- _node_hover_id = this.id;
|
|
|
|
- _node_pop_up.setNode(this);
|
|
|
|
|
|
+ this.setHover();
|
|
}
|
|
}
|
|
}else{
|
|
}else{
|
|
- this.hover = false;
|
|
|
|
- if (_node_hover_id == this.id) {
|
|
|
|
- _node_hover_id = -1;
|
|
|
|
- _node_pop_up.removeNode();
|
|
|
|
- }
|
|
|
|
|
|
+ this.unsetHover();
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ Node.prototype.setHover = function(){
|
|
|
|
+ this.hover = true;
|
|
|
|
+ _node_hover_id = this.id;
|
|
|
|
+ _node_pop_up.setNode(this);
|
|
|
|
+ };
|
|
|
|
+ Node.prototype.unsetHover = function(){
|
|
|
|
+ this.hover = false;
|
|
|
|
+ if (_node_hover_id == this.id) {
|
|
|
|
+ _node_hover_id = -1;
|
|
|
|
+ _node_pop_up.removeNode();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
@@ -421,12 +438,14 @@
|
|
this.unsetCentered();
|
|
this.unsetCentered();
|
|
this.ori_p.position.x = this.x < _canvas.width /2 ? this.wall_limits.left : this.wall_limits.right;
|
|
this.ori_p.position.x = this.x < _canvas.width /2 ? this.wall_limits.left : this.wall_limits.right;
|
|
this.ori_p_attract.on = true;
|
|
this.ori_p_attract.on = true;
|
|
|
|
+ this.wall_bouncing_elasticity = 0.15;
|
|
}
|
|
}
|
|
Node.prototype.unsetAside = function(){
|
|
Node.prototype.unsetAside = function(){
|
|
console.log('unsetAside');
|
|
console.log('unsetAside');
|
|
this.aside = false;
|
|
this.aside = false;
|
|
this.ori_p_attract.on = false;
|
|
this.ori_p_attract.on = false;
|
|
this.ori_p.position.x = this.ori_pos.x;
|
|
this.ori_p.position.x = this.ori_pos.x;
|
|
|
|
+ this.wall_bouncing_elasticity = 0.75;
|
|
// this.unFade();
|
|
// this.unFade();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -464,15 +483,25 @@
|
|
// actif entouré de rouge
|
|
// actif entouré de rouge
|
|
|
|
|
|
_ctx.beginPath();
|
|
_ctx.beginPath();
|
|
- _ctx.globalAlpha = this.faded ? 0.1 : 1;
|
|
|
|
- // _ctx.fillStyle = !this.p.resting() ? _ecolors[this.e_color] : 'rgb(0, 0, 0)';
|
|
|
|
- _ctx.fillStyle = _ecolors[this.e_color];
|
|
|
|
|
|
+ _ctx.globalAlpha = this.faded ? 0.15 : 1;
|
|
|
|
+ // carre plein
|
|
|
|
+ // _ctx.fillStyle = _ecolors[this.e_color];
|
|
|
|
+ // _ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
|
|
|
|
+ // ou carre contour
|
|
|
|
+ _ctx.lineWidth = '2px';
|
|
|
|
+ _ctx.fillStyle = 'rgb(255,255,255)';
|
|
_ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
|
|
_ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
|
|
|
|
+ _ctx.strokeStyle = _ecolors[this.e_color];
|
|
|
|
+ _ctx.strokeRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
|
|
|
|
|
|
if(this.opened){
|
|
if(this.opened){
|
|
- _ctx.lineWidth = '1px';
|
|
|
|
- _ctx.strokeStyle = 'rgb(255,0,0)';
|
|
|
|
- _ctx.strokeRect(this.x - this.r-3,this.y - this.r-3,this.r*2+6,this.r*2+6);
|
|
|
|
|
|
+ // carre plein
|
|
|
|
+ // _ctx.lineWidth = '1px';
|
|
|
|
+ // _ctx.strokeStyle = 'rgb(255,0,0)';
|
|
|
|
+ // _ctx.strokeRect(this.x - this.r-3,this.y - this.r-3,this.r*2+6,this.r*2+6);
|
|
|
|
+ // ou carre contour
|
|
|
|
+ _ctx.fillStyle = _ecolors[this.e_color];
|
|
|
|
+ _ctx.fillRect(this.x - this.r,this.y - this.r,this.r*2,this.r*2);
|
|
}
|
|
}
|
|
_ctx.globalAlpha = 1;
|
|
_ctx.globalAlpha = 1;
|
|
_ctx.closePath();
|
|
_ctx.closePath();
|
|
@@ -507,7 +536,8 @@
|
|
nb = _nodes[q];
|
|
nb = _nodes[q];
|
|
mb = nb.p.mass;
|
|
mb = nb.p.mass;
|
|
// avoid impact between center and aside particules
|
|
// avoid impact between center and aside particules
|
|
- if((na.center && nb.aside) || (na.aside && nb.center))
|
|
|
|
|
|
+ // and between aside particules
|
|
|
|
+ if((na.center && nb.aside) || (na.aside && nb.center) || (na.aside && nb.aside))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
// avoid impact between two centered particulses that comes to the center
|
|
// avoid impact between two centered particulses that comes to the center
|
|
@@ -518,6 +548,9 @@
|
|
}
|
|
}
|
|
|
|
|
|
w = h = (na.r+nb.r);
|
|
w = h = (na.r+nb.r);
|
|
|
|
+ // if(!na.aside && !nb.aside){
|
|
|
|
+ w = h += 4; // add a saftey zone around squares eccept for aside squares
|
|
|
|
+ // }
|
|
dx = na.p.position.x - nb.p.position.x;
|
|
dx = na.p.position.x - nb.p.position.x;
|
|
dy = na.p.position.y - nb.p.position.y;
|
|
dy = na.p.position.y - nb.p.position.y;
|
|
|
|
|
|
@@ -624,6 +657,7 @@
|
|
if(!$li.is('.opened')){
|
|
if(!$li.is('.opened')){
|
|
_$entrees_block_termlinks.parents('li').removeClass('opened');
|
|
_$entrees_block_termlinks.parents('li').removeClass('opened');
|
|
$li.addClass('opened');
|
|
$li.addClass('opened');
|
|
|
|
+ $li.parents('.item-list').addClass('opened')
|
|
filterEntree(tid);
|
|
filterEntree(tid);
|
|
if(bubbling){
|
|
if(bubbling){
|
|
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
|
_$body.trigger({'type':'open_entree', 'tid':tid, 'url':url, 'sys_path':sys_path});
|
|
@@ -631,6 +665,7 @@
|
|
// bubbling is true only when event is a real click on entree link
|
|
// bubbling is true only when event is a real click on entree link
|
|
}else if(bubbling){
|
|
}else if(bubbling){
|
|
$li.removeClass('opened');
|
|
$li.removeClass('opened');
|
|
|
|
+ $li.parents('.item-list').removeClass('opened')
|
|
scrambleCollection();
|
|
scrambleCollection();
|
|
_$body.trigger({'type':'close_entree', 'tid':tid});
|
|
_$body.trigger({'type':'close_entree', 'tid':tid});
|
|
}
|
|
}
|
|
@@ -651,7 +686,9 @@
|
|
createNodesRepulsions();
|
|
createNodesRepulsions();
|
|
};
|
|
};
|
|
function highlightEntries(){
|
|
function highlightEntries(){
|
|
- _$entrees_block_termlinks.removeClass('highlighted');
|
|
|
|
|
|
+ _$entrees_block_termlinks
|
|
|
|
+ .parents('li').removeClass('highlighted')
|
|
|
|
+ .parents('.item-list').removeClass('highlighted');
|
|
var id = -1;
|
|
var id = -1;
|
|
if(_node_hover_id != -1){
|
|
if(_node_hover_id != -1){
|
|
id = _node_hover_id;
|
|
id = _node_hover_id;
|
|
@@ -664,7 +701,8 @@
|
|
entree = _nodes[id].entrees[i];
|
|
entree = _nodes[id].entrees[i];
|
|
_$entrees_block_termlinks.filter(function(){
|
|
_$entrees_block_termlinks.filter(function(){
|
|
return $(this).attr('tid') == entree;
|
|
return $(this).attr('tid') == entree;
|
|
- }).addClass('highlighted');
|
|
|
|
|
|
+ }).parents('li').addClass('highlighted')
|
|
|
|
+ .parents('.item-list').addClass('highlighted');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -802,6 +840,18 @@
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
+ .on('mouseover-audio-link', function(e){
|
|
|
|
+ console.log("Corpus on mouseover-audio-link", e);
|
|
|
|
+ // _node_hover_id = _nodes_Nid_Id[e.nid];
|
|
|
|
+ // _node_pop_up.setNode(_nodes_by_nid[e.nid]);
|
|
|
|
+ _nodes_by_nid[e.nid].setHover();
|
|
|
|
+ })
|
|
|
|
+ .on('mouseout-audio-link', function(e){
|
|
|
|
+ console.log("Corpus on mouseover-audio-link", e);
|
|
|
|
+ // _node_hover_id = -1;
|
|
|
|
+ // _node_pop_up.removeNode();
|
|
|
|
+ _nodes_by_nid[e.nid].unsetHover();
|
|
|
|
+ })
|
|
.on('audio-node-opened', function(e){
|
|
.on('audio-node-opened', function(e){
|
|
// console.log('Corpus audio-node-opened', e);
|
|
// console.log('Corpus audio-node-opened', e);
|
|
openNodeByNid(e.nid);
|
|
openNodeByNid(e.nid);
|
|
@@ -852,8 +902,12 @@
|
|
})
|
|
})
|
|
.on('new-content-not-entree-ajax-loaded', function(e){
|
|
.on('new-content-not-entree-ajax-loaded', function(e){
|
|
// close all entries only if entry already opened
|
|
// close all entries only if entry already opened
|
|
|
|
+ // TODO: user the function close all entries ?
|
|
|
|
+ // closeAllEntries(); not working, is closing also the ajax loaded content
|
|
if(_$entrees_block_termlinks.parents('li.opened').length){
|
|
if(_$entrees_block_termlinks.parents('li.opened').length){
|
|
- _$entrees_block_termlinks.parents('li').removeClass('opened');
|
|
|
|
|
|
+ _$entrees_block_termlinks
|
|
|
|
+ .parents('li').removeClass('opened')
|
|
|
|
+ .parents('.item-list').removeClass('opened');
|
|
scrambleCollection();
|
|
scrambleCollection();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -863,7 +917,8 @@
|
|
_$entrees_block.find('li.entree').each(function(index, el) {
|
|
_$entrees_block.find('li.entree').each(function(index, el) {
|
|
var $li = $(this);
|
|
var $li = $(this);
|
|
if($('a.is-active', $li).length){
|
|
if($('a.is-active', $li).length){
|
|
- $li.addClass('opened');
|
|
|
|
|
|
+ $li.addClass('opened')
|
|
|
|
+ .parents('.item-list').addClass('opened');
|
|
filterEntree($li.attr('tid'));
|
|
filterEntree($li.attr('tid'));
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|