Problems with Tree Animation on Mac OS X

48 views
Skip to first unread message

alessandro.colantonio

unread,
Apr 18, 2012, 12:27:20 PM4/18/12
to JavaScript InfoVis Toolkit
Hi,

I am currently using JIT in my application. In particular, I am using
the following tree:

http://thejit.org/static/v20/Jit/Examples/Spacetree/example1.html

Unfortunately, I have noticed that when I use Safari and "drag" the
tree, the labels within nodes are always "one step behind" the node
position. Moreover, if I hover with the mouse pointer on nodes, then
the picture refreshes so that labels are correctly displayed. You can
test it by yourselves with the link above.

The problem is even worse when I do not use mouse to move the tree,
but I "shift" the graph by several pixels from javascript.

Could anyone possibly help me to fix the problem?

Thanks in advance

Alessandro

D Soa

unread,
Apr 20, 2012, 4:29:46 PM4/20/12
to JavaScript InfoVis Toolkit
I don't know about space tree or if this applies to your situation,
but I didn't like the way RGraph would make nodes "jump" to the
location of the cursor when dragging a label. Say I clicked in the
upper left corner of the label, the node center jumped to this
position when I started dragging. Anyway, for what it's worth, I
fixed it by keeping track of an offset between where I clicked and
where the center of the node was. Maybe something similar will help
you. (self below is my object and I added a few functions for
removing the current selection which was causing some problems with
highlighting text in browsers.

onDragStart: function(node, eventInfo, e){
self.dragging = true;
self.setCursorForNode(node, 'move');
$jit.util.event.stop(e);
self.removeSelection();
var ePos = eventInfo.getPos();
var nPos = node.pos.getc();
self.offsetX = ePos.x - nPos.x;
self.offsetY = ePos.y - nPos.y;
},
onDragMove: function(node, eventInfo, e){
self.dragging = true;
self.removeTip();
$jit.util.event.stop(e);
self.removeSelection();
var pos = eventInfo.getPos();
node.pos.setc(pos.x - self.offsetX, pos.y - self.offsetY);
self.jitrgraph.plot();
},
onDragEnd: function(node, eventInfo, e){
self.dragging = false;
self.setCursorForNode(node, '');
self.offsetX = 0;
self.offsetY = 0;
}
Reply all
Reply to author
Forward
0 new messages