Author: clopes
Date: 2012-05-14 12:15:18 -0700 (Mon, 14 May 2012)
New Revision: 29261
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
Log:
Fixes bug #2703 : Node Image does not show until mouse hover
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
===================================================================
---
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
2012-05-14 17:46:16 UTC (rev 29260)
+++
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/view/render/NodeRenderer.as
2012-05-14 19:15:18 UTC (rev 29261)
@@ -58,7 +58,7 @@
private static const WRAP_PAD:Number = 5;
- private var drawTimerId:uint = 0;
+ private var drawTimers:Object = {}; // node_id -> timer_id
private static var _instance:NodeRenderer = new NodeRenderer();
public static function get instance():NodeRenderer { return _instance;
}
@@ -214,22 +214,26 @@
if (w > 0 && h > 0 && url != null && StringUtil.trim(url).length >
0) {
// Load the image into the cache first?
- if (!_imgCache.contains(url)) {trace("Will load IMAGE...");
+ if (!_imgCache.contains(url)) {trace("Will load IMAGE
(node="+d.data.id+")...");
_imgCache.loadImage(url);
}
- if (_imgCache.isLoaded(url)) {trace(" .LOADED :-)");
+ if (_imgCache.isLoaded(url)) {trace(" .IMG LOADED
(node="+d.data.id+")");
draw();
- } else {trace(" .NOT loaded :-(");
+ } else {trace(" .IMG NOT loaded (node="+d.data.id+")");
drawWhenLoaded();
}
function drawWhenLoaded():void {
- if (drawTimerId != 0)
- clearTimeout(drawTimerId);
+ var timerId:* = drawTimers[d.data.id];
- drawTimerId = setTimeout(function():void {trace("
.TIMEOUT: Checking again...");
+ if (timerId != null) {
+ clearTimeout(timerId);
+ delete drawTimers[d.data.id];
+ }
+
+ drawTimers[d.data.id] = setTimeout(function():void
{trace(" .TIMEOUT (node="+d.data.id+"): Checking again...");
if (_imgCache.isLoaded(url)) {
- drawTimerId = 0;
+ delete drawTimers[d.data.id];
draw();
} else if (!_imgCache.isBroken(url)) {
drawWhenLoaded();
@@ -237,7 +241,7 @@
}, 50);
}
- function draw():void {trace("Will draw: " + d.data.id);
+ function draw():void {trace("Will draw IMG: " + d.data.id);
// Get the image from cache:
var bd:BitmapData = _imgCache.getImage(url);
--
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.