Author: marekz
Date: 2011-07-08 07:29:26 -0700 (Fri, 08 Jul 2011)
New Revision: 26118
Modified:
cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/cytoscapeweb-svg.js
cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/main.html
Log:
Added node labels.
Modified: cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/cytoscapeweb-svg.js
===================================================================
--- cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/cytoscapeweb-svg.js
2011-07-08 13:46:07 UTC (rev 26117)
+++ cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/cytoscapeweb-svg.js
2011-07-08 14:29:26 UTC (rev 26118)
@@ -804,25 +804,26 @@
.drag(Util.delegate(this, "_dragMove"),
Util.delegate(this, "_dragStart"), Util.delegate(this, "_dragEnd"))
.click(Util.delegate(this, "_onClick"));
}
- /*
+
var label = this.getLabel();
if (label) {
var labelSize = this.getRenderedStyle("labelSize");
if (labelSize) {
if (this._elemLabel == null) {
- this._elemLabel =
this._visualization._canvas.text(0, 0, "").attr("font-weight", "bold");
+ this._elemLabel =
this._visualization._canvas.text(0, 0, "").attr({"font-weight": "bold"});
+
this._elemLabel.node.setAttribute("pointer-events", "none");
}
this._elemLabel.attr({
"text": label,
"font-size":
this.getRenderedStyle("labelSize"),
- "color":
this.getRenderedStyle("labelColor"),
- "x": this._x,
- "y": this._y,
- });
+ "fill":
this.getRenderedStyle("labelColor"),
+ "x": this._x +
this._visualization._offsetX,
+ "y": this._y +
this._visualization._offsetY,
+ }).toFront();
}
}
- */
+
var attrMap = {
"fill": "color",
"stroke": "borderColor",
@@ -864,6 +865,7 @@
this.remove = function() {
if (this._elem) this._elem.remove();
+ if (this._elemLabel) this._elemLabel.remove();
}
}
Node.prototype = new Element();
Modified: cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/main.html
===================================================================
--- cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/main.html 2011-07-08
13:46:07 UTC (rev 26117)
+++ cytoscapeweb/branches/gsoc2011/cytoscapeweb-svg/main.html 2011-07-08
14:29:26 UTC (rev 26118)
@@ -27,11 +27,12 @@
borderColor: "#666666",
borderWidth: 3,
opacity: 1,
+
},
edges: {
color: "#999999",
width: 3,
- opacity: 0.8,
+ opacity: 0.8
}
}
@@ -43,7 +44,8 @@
color: "#cccccc",
size: 14,
borderWidth: 2,
- borderColor: "#707070"
+ borderColor: "#707070",
+ labelColor: "none"
},
edges: {
color: "#0b94b1",
@@ -203,14 +205,14 @@
<div id="container-div"></div>
Load graph:
<select
onchange="load(this.options[selectedIndex].value)">
- <option value="simpleGraph">Simple
graph</option>
+ <option selected value="simpleGraph">Simple
graph</option>
<option value="petersenGraph">Petersen
graph</option>
<option value="ringGraph">Style demo</option>
<option value="pg">Large graph</option>
</select>
Load style:
<select
onchange="setstyle(this.options[selectedIndex].value)">
- <option value="basicStyle">Basic Style</option>
+ <option selected value="basicStyle">Basic
Style</option>
<option value="demoStyle">Classic Style</option>
<option value="darkStyle">Dark style</option>
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.