diff --git a/config.js b/config.js
index 6d70830..9f58fc8 100644
--- a/config.js
+++ b/config.js
@@ -18,6 +18,11 @@ setParams({
/*
Default zoom level. At zoom = 0, the graph should fill a 800x700px zone
*/
+ ctlZoomPosition : "left",
+ /*
+ Defines the position of the Zoom Control Buttons : "left" or "right"
+ this setting can't be changed from the User Interface
+ */
curvedEdges : true,
/*
False for curved edges, true for straight edges
@@ -31,6 +36,14 @@ setParams({
minEdgeWidth : 1,
maxEdgeWidth : 50,
textDisplayThreshold: 9,
+ labelQuadraticFactor : 1,
+ /*
+ If more than 1, makes the big labels even bigger.
+ If 1, nothing changes.
+ If less than 1, makes the big labels smallers
+ If 0, every label has the same size
+ this setting can't be changed from the User Interface
+ */
nodeSizeFactor : 1,
/*
Change this parameter for smaller or larger nodes
@@ -46,6 +59,11 @@ setParams({
Show the weight of edges in the list
this setting can't be changed from the User Interface
*/
+ showEdgesWhileDragging : false,
+ /*
+ Show edges when dragging the graph. If False, the display is much quicker
+ this setting can't be changed from the User Interface
+ */
language: false
/*
Set to an ISO language code to switch the interface to that language.
diff --git a/index.html b/index.html
index cef7a55..4ec68db 100644
--- a/index.html
+++ b/index.html
@@ -52,8 +52,8 @@
diff --git a/js/gexfjs.js b/js/gexfjs.js
index ea42660..499a27b 100644
--- a/js/gexfjs.js
+++ b/js/gexfjs.js
@@ -174,7 +174,7 @@ function strLang(_str) {
function replaceURLWithHyperlinks(text) {
if (GexfJS.params.replaceUrls) {
- var _urlExp = /(\b(https?:\/\/)?[-A-Z0-9]+\.[-A-Z0-9.:]+(\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*)?)/ig,
+ var _urlExp = /(\b(https?:\/\/)?[-A-Z0-9]+\.[-A-Z0-9.:?=]+(\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*)?)/ig,
_protocolExp = /^https?:\/\//i;
return text.replace(_urlExp, function(_found) {
return ' 1 ? document.location.hash.substr(1) : GexfJS.params.graphFile ),
dataType: "xml",
success: function(data) {
+ var _minNodeSize = 99999;
+ var _maxNodeSize = -1;
var _s = new Date();
var _g = $(data).find("graph"),
_nodes = _g.children().filter("nodes").children(),
@@ -446,14 +464,19 @@ function loadGraph() {
r : _echelle * _size
}
}
+
+ if(_d.coords.base.r<_minNodeSize) _minNodeSize = _d.coords.base.r;
+ if(_d.coords.base.r>_maxNodeSize) _maxNodeSize = _d.coords.base.r;
+
_d.color = {
rgb : {
r : _r,
g : _g,
b : _b
},
- base : "rgba(" + _r + "," + _g + "," + _b + ",.7)",
- gris : "rgba(" + Math.floor(84 + .33 * _r) + "," + Math.floor(84 + .33 * _g) + "," + Math.floor(84 + .33 * _b) + ",.5)"
+ base : "rgba(" + _r + "," + _g + "," + _b + ",.7)",
+ baseDarker : "rgba(" + Math.floor(62 + .5 * _r) + "," + Math.floor(62 + .5 * _g) + "," + Math.floor(62 + .5 * _b) + ",1)",
+ gris : "rgba(" + Math.floor(84 + .33 * _r) + "," + Math.floor(84 + .33 * _g) + "," + Math.floor(84 + .33 * _b) + ",.5)"
}
_d.attributes = [];
$(_attr).each(function() {
@@ -505,6 +528,13 @@ function loadGraph() {
});
});
+ var _fact = Math.max(0,GexfJS.params.labelQuadraticFactor) ;
+ for(var _ii = 0 ; _ii < GexfJS.graph.nodeList.length ; _ii++) {
+ var _n = GexfJS.graph.nodeList[_ii];
+ _n.labelSize = (_fact == 0 ? 1 : ((_minNodeSize+ Math.pow(_n.coords.base.r-_minNodeSize,_fact))/_n.coords.base.r));
+ //alert("orig: "+_n.coords.base.r+ "\nafter: "+_n.labelSize)//+"\n\nMath.ceil(("+_minNodeSize+"+Math.pow("+_n.coords.base.r+"-"+_minNodeSize+","+_fact+"))/"+_n.coords.base.r+"))");
+ }//nnn
+
GexfJS.imageMini = GexfJS.ctxMini.getImageData(0, 0, GexfJS.overviewWidth, GexfJS.overviewHeight);
//changeNiveau(0);
@@ -603,9 +633,9 @@ function traceMap() {
GexfJS.ctxGraphe.closePath();
GexfJS.ctxGraphe.fill();
}
-
+
var _centralNode = ( ( GexfJS.params.activeNode != -1 ) ? GexfJS.params.activeNode : GexfJS.params.currentNode );
-
+
for (var i in GexfJS.graph.nodeList) {
var _d = GexfJS.graph.nodeList[i];
_d.coords.actual = {
@@ -622,41 +652,12 @@ function traceMap() {
if ( _centralNode != -1 ) {
_tagsMisEnValeur = [ _centralNode ];
}
-
- var _displayEdges = ( GexfJS.params.showEdges && GexfJS.params.currentNode == -1 );
-
- for (var i in GexfJS.graph.edgeList) {
- var _d = GexfJS.graph.edgeList[i],
- _six = _d.source,
- _tix = _d.target,
- _ds = GexfJS.graph.nodeList[_six],
- _dt = GexfJS.graph.nodeList[_tix];
- var _isLinked = false;
- if (_centralNode != -1) {
- if (_six == _centralNode) {
- _tagsMisEnValeur.push(_tix);
- _coulTag = _dt.color.base;
- _isLinked = true;
- _dt.visible = true;
- }
- if (_tix == _centralNode) {
- _tagsMisEnValeur.push(_six);
- _coulTag = _ds.color.base;
- _isLinked = true;
- _ds.visible = true;
- }
- }
- if ( ( _isLinked || _displayEdges ) && ( _ds.withinFrame || _dt.withinFrame ) && _ds.visible && _dt.visible ) {
- GexfJS.ctxGraphe.lineWidth = _edgeSizeFactor * _d.width;
- var _coords = ( ( GexfJS.params.useLens && GexfJS.mousePosition ) ? calcCoord( GexfJS.mousePosition.x , GexfJS.mousePosition.y , _ds.coords.actual ) : _ds.coords.actual );
- _coordt = ( (GexfJS.params.useLens && GexfJS.mousePosition) ? calcCoord( GexfJS.mousePosition.x , GexfJS.mousePosition.y , _dt.coords.actual ) : _dt.coords.actual );
- GexfJS.ctxGraphe.strokeStyle = ( _isLinked ? _d.color : "rgba(100,100,100,0.2)" );
- traceArc(GexfJS.ctxGraphe, _coords, _coordt);
- }
+ if(!GexfJS.dragOn || GexfJS.params.showEdgesWhileDragging){
+ traceMap_edges(_centralNode,_sizeFactor,_tagsMisEnValeur);
}
+
GexfJS.ctxGraphe.lineWidth = 4;
- GexfJS.ctxGraphe.strokeStyle = "rgba(0,100,0,0.8)";
if (_centralNode != -1) {
var _dnc = GexfJS.graph.nodeList[_centralNode];
@@ -682,7 +683,7 @@ function traceMap() {
var _d = GexfJS.graph.nodeList[i];
if (_d.visible && _d.withinFrame) {
if (i != _centralNode) {
- var _fs = _d.coords.real.r * _textSizeFactor;
+ var _fs = _d.coords.real.r * _d.labelSize * _textSizeFactor;//nnn
if (_d.isTag) {
if (_centralNode != -1) {
var _dist = Math.sqrt( Math.pow( _d.coords.real.x - _dnc.coords.real.x, 2 ) + Math.pow( _d.coords.real.y - _dnc.coords.real.y, 2 ) );
@@ -705,13 +706,14 @@ function traceMap() {
}
if (_centralNode != -1) {
+ GexfJS.ctxGraphe.strokeStyle = _dnc.color.baseDarker;
GexfJS.ctxGraphe.fillStyle = _dnc.color.base;
GexfJS.ctxGraphe.beginPath();
GexfJS.ctxGraphe.arc( _dnc.coords.real.x , _dnc.coords.real.y , _dnc.coords.real.r , 0 , Math.PI*2 , true );
GexfJS.ctxGraphe.closePath();
GexfJS.ctxGraphe.fill();
GexfJS.ctxGraphe.stroke();
- var _fs = Math.max(GexfJS.params.textDisplayThreshold + 2, _dnc.coords.real.r * _textSizeFactor) + 2;
+ var _fs = Math.max(GexfJS.params.textDisplayThreshold + 2, _dnc.coords.real.r * _dnc.labelSize * _textSizeFactor) + 2;
GexfJS.ctxGraphe.font = "bold " + Math.floor( _fs )+"px Arial";
GexfJS.ctxGraphe.textAlign = "center";
GexfJS.ctxGraphe.textBaseline = "middle";
@@ -720,6 +722,10 @@ function traceMap() {
GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x + 2, _dnc.coords.real.y);
GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x, _dnc.coords.real.y - 2);
GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x, _dnc.coords.real.y + 2);
+ GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x - 1, _dnc.coords.real.y +1);
+ GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x + 1, _dnc.coords.real.y +1);
+ GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x - 1, _dnc.coords.real.y -1);
+ GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x + 1, _dnc.coords.real.y -1);
GexfJS.ctxGraphe.fillStyle = "rgb(0,0,0)";
GexfJS.ctxGraphe.fillText(_dnc.label, _dnc.coords.real.x, _dnc.coords.real.y);
}
@@ -739,6 +745,43 @@ function traceMap() {
GexfJS.ctxMini.strokeRect( _x, _y, _w, _h );
}
+function traceMap_edges(_centralNode,_sizeFactor,_tagsMisEnValeur) {
+
+ var _displayEdges = ( GexfJS.params.showEdges && GexfJS.params.currentNode == -1 ),
+ _edgeSizeFactor = _sizeFactor * GexfJS.params.edgeWidthFactor;
+
+ for (var i in GexfJS.graph.edgeList) {
+ var _d = GexfJS.graph.edgeList[i],
+ _six = _d.source,
+ _tix = _d.target,
+ _ds = GexfJS.graph.nodeList[_six],
+ _dt = GexfJS.graph.nodeList[_tix];
+ var _isLinked = false;
+ if (_centralNode != -1) {
+ if (_six == _centralNode) {
+ _tagsMisEnValeur.push(_tix);
+ _coulTag = _dt.color.base;
+ _isLinked = true;
+ _dt.visible = true;
+ }
+ if (_tix == _centralNode) {
+ _tagsMisEnValeur.push(_six);
+ _coulTag = _ds.color.base;
+ _isLinked = true;
+ _ds.visible = true;
+ }
+ }
+
+ if ( ( _isLinked || _displayEdges ) && ( _ds.withinFrame || _dt.withinFrame ) && _ds.visible && _dt.visible ) {
+ GexfJS.ctxGraphe.lineWidth = _edgeSizeFactor * _d.width;
+ var _coords = ( ( GexfJS.params.useLens && GexfJS.mousePosition ) ? calcCoord( GexfJS.mousePosition.x , GexfJS.mousePosition.y , _ds.coords.actual ) : _ds.coords.actual );
+ _coordt = ( (GexfJS.params.useLens && GexfJS.mousePosition) ? calcCoord( GexfJS.mousePosition.x , GexfJS.mousePosition.y , _dt.coords.actual ) : _dt.coords.actual );
+ GexfJS.ctxGraphe.strokeStyle = ( _isLinked ? _d.color : "rgba(100,100,100,0.2)" );
+ traceArc(GexfJS.ctxGraphe, _coords, _coordt);
+ }
+ }
+}
+
function hoverAC() {
$("#autocomplete li").removeClass("hover");
$("#liac_"+GexfJS.autoCompletePosition).addClass("hover");
@@ -814,9 +857,9 @@ $(document).ready(function() {
GexfJS.ctxGraphe = document.getElementById('carte').getContext('2d');
GexfJS.ctxMini = document.getElementById('overview').getContext('2d');
- updateWorkspaceBounds();
initializeMap();
+ updateWorkspaceBounds(); // Hm... I don't really know why... maybe an intuition.
window.onhashchange = initializeMap;
diff --git a/styles/gexfjs.css b/styles/gexfjs.css
index 8818c6e..434bb78 100644
--- a/styles/gexfjs.css
+++ b/styles/gexfjs.css
@@ -78,7 +78,7 @@ h1 a {
/* ZOOM IN OUT */
#ctlzoom {
- position: absolute; left: 5px; bottom: 5px; list-style: none; padding: 0; margin: 0;
+ position: absolute; list-style: none; padding: 0; margin: 0;
}
#ctlzoom li {