|
@@ -102,11 +102,11 @@
|
|
onCorpusLoaded(data);
|
|
onCorpusLoaded(data);
|
|
})
|
|
})
|
|
.fail(function(jqxhr, textStatus, error){
|
|
.fail(function(jqxhr, textStatus, error){
|
|
- onCorpusLoadError(jqxhr, textStatus, error, $link, sys_path);
|
|
|
|
|
|
+ onCorpusLoadError(jqxhr, textStatus, error);
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
- function onCorpusLoadError(jqxhr, textStatus, error, $link, sys_path){
|
|
|
|
|
|
+ function onCorpusLoadError(jqxhr, textStatus, error){
|
|
console.warn('corpus load failed', jqxhr.responseText);
|
|
console.warn('corpus load failed', jqxhr.responseText);
|
|
};
|
|
};
|
|
|
|
|
|
@@ -114,9 +114,9 @@
|
|
console.log('corpus loaded : data', data);
|
|
console.log('corpus loaded : data', data);
|
|
// console.log('first node', data.nodes[0]);
|
|
// console.log('first node', data.nodes[0]);
|
|
// buildParticles(data.nodes);
|
|
// buildParticles(data.nodes);
|
|
|
|
+ initNodePopup();
|
|
buildNodes(data.nodes);
|
|
buildNodes(data.nodes);
|
|
initEvents();
|
|
initEvents();
|
|
- initNodePopup();
|
|
|
|
startAnime();
|
|
startAnime();
|
|
};
|
|
};
|
|
|
|
|
|
@@ -180,6 +180,10 @@
|
|
this.p = _physics.makeParticle(this.mass, this.x, this.y);
|
|
this.p = _physics.makeParticle(this.mass, this.x, this.y);
|
|
this.p.velocity = new Physics.Vector((Math.random()-0.5)*_p_velocity_factor, (Math.random()-0.5)*_p_velocity_factor);
|
|
this.p.velocity = new Physics.Vector((Math.random()-0.5)*_p_velocity_factor, (Math.random()-0.5)*_p_velocity_factor);
|
|
|
|
|
|
|
|
+ // if(this.id == '620'){
|
|
|
|
+ // _node_pop_up.setNode(this);
|
|
|
|
+ // }
|
|
|
|
+
|
|
// prototypes
|
|
// prototypes
|
|
if (typeof Node.initialized == "undefined") {
|
|
if (typeof Node.initialized == "undefined") {
|
|
|
|
|
|
@@ -234,10 +238,9 @@
|
|
&& _m_pos.x < this.x + this.r
|
|
&& _m_pos.x < this.x + this.r
|
|
&& _m_pos.y > this.y - this.r
|
|
&& _m_pos.y > this.y - this.r
|
|
&& _m_pos.y < this.y + this.r){
|
|
&& _m_pos.y < this.y + this.r){
|
|
- if(_node_hover_id == -1 || _node_hover_id == this.id){
|
|
|
|
- // console.log("Node hover", this.id);
|
|
|
|
|
|
+ if(_node_hover_id == -1 || _node_hover_id !== this.id){
|
|
|
|
+ console.log("Node hover", this.id);
|
|
this.hover = true;
|
|
this.hover = true;
|
|
- // this.highlightEntries();
|
|
|
|
_node_hover_id = this.id;
|
|
_node_hover_id = this.id;
|
|
_node_pop_up.setNode(this);
|
|
_node_pop_up.setNode(this);
|
|
}
|
|
}
|
|
@@ -250,17 +253,6 @@
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
- // Node.prototype.highlightEntries = function(){
|
|
|
|
- // _$entrees_block_termlinks.removeClass('highlighted');
|
|
|
|
- // var entree;
|
|
|
|
- // for (var i = 0; i < this.entrees.length; i++) {
|
|
|
|
- // entree = this.entrees[i];
|
|
|
|
- // _$entrees_block_termlinks.filter(function(){
|
|
|
|
- // return $(this).attr('tid') == entree;
|
|
|
|
- // }).addClass('highlighted');
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
Node.prototype.draw = function(){
|
|
Node.prototype.draw = function(){
|
|
// carre plein
|
|
// carre plein
|
|
// clouleur aléatoire ds les entrees
|
|
// clouleur aléatoire ds les entrees
|
|
@@ -439,26 +431,48 @@
|
|
if (typeof NodePopUp.initialized == "undefined") {
|
|
if (typeof NodePopUp.initialized == "undefined") {
|
|
|
|
|
|
NodePopUp.prototype.setNode = function(n){
|
|
NodePopUp.prototype.setNode = function(n){
|
|
|
|
+ console.log('NodePopUp setNode()');
|
|
this.node = n;
|
|
this.node = n;
|
|
// positioning NodePopUp regarding node position
|
|
// positioning NodePopUp regarding node position
|
|
|
|
+ this.setPositioning();
|
|
|
|
+ // update NodePopUp content
|
|
|
|
+ this.setContent();
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ NodePopUp.prototype.setPositioning = function(){
|
|
switch(true){
|
|
switch(true){
|
|
- case n.x > n.wall_limits.right-350 && n.y < n.wall_limits.top+200:
|
|
|
|
|
|
+ case this.node.x > this.node.wall_limits.right-350 && this.node.y < this.node.wall_limits.top+200:
|
|
this.$dom.attr('pos', 'bottom-left');
|
|
this.$dom.attr('pos', 'bottom-left');
|
|
break;
|
|
break;
|
|
- case n.x > n.wall_limits.right-350:
|
|
|
|
|
|
+ case this.node.x > this.node.wall_limits.right-350:
|
|
this.$dom.attr('pos', 'top-left');
|
|
this.$dom.attr('pos', 'top-left');
|
|
break;
|
|
break;
|
|
- case n.y < n.wall_limits.top+200:
|
|
|
|
|
|
+ case this.node.y < this.node.wall_limits.top+200:
|
|
this.$dom.attr('pos', 'bottom-right');
|
|
this.$dom.attr('pos', 'bottom-right');
|
|
break;
|
|
break;
|
|
default:
|
|
default:
|
|
this.$dom.attr('pos', 'top-right');
|
|
this.$dom.attr('pos', 'top-right');
|
|
}
|
|
}
|
|
- // update NodePopUp content
|
|
|
|
- this.$content.html(this.node.title);
|
|
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ NodePopUp.prototype.setContent = function(){
|
|
|
|
+ // console.log(this.node);
|
|
|
|
+ this.$content.html('');
|
|
|
|
+ var $entrees = $('<div>').addClass('entrees');
|
|
|
|
+ for (var i = 0; i < this.node.entrees.length; i++) {
|
|
|
|
+ var tid = this.node.entrees[i];
|
|
|
|
+ $entrees.append($('<span>').addClass('entree').attr('tid', tid));
|
|
|
|
+ }
|
|
|
|
+ this.$content
|
|
|
|
+ .append($entrees)
|
|
|
|
+ .append('<h2 class="title">'+this.node.title+'</h2>')
|
|
|
|
+ .append('<section class="description">'+this.node.description+'</section>');
|
|
|
|
+
|
|
|
|
+ // TODO: favoris marker
|
|
};
|
|
};
|
|
|
|
|
|
NodePopUp.prototype.removeNode = function(){
|
|
NodePopUp.prototype.removeNode = function(){
|
|
|
|
+ console.log('NodePopUp removeNode()');
|
|
this.node = false;
|
|
this.node = false;
|
|
};
|
|
};
|
|
|
|
|