Bug with Raphael 2.1

218 views
Skip to first unread message

Guy Morton

unread,
Apr 3, 2012, 9:02:11 AM4/3/12
to raph...@googlegroups.com
Hi folks

Look at this page:

http://g.raphaeljs.com/barchart2.html

Move your mouse over the bars to trigger the appearance of the popup data tips. If you go back and forth after a bit you'll see they stop appearing where they should, and their contents stop lining up with the tip.

This did not happen with Raphael 2.0.

Anyone got any ideas as to the cause? Anyone got an ida as to how it can be fixed?

It looks to me like on mouseout the position data is not being reset (perhaps it's a transform that's not being removed?).

TIA

Guy


Guy Morton

unread,
Apr 3, 2012, 9:06:56 AM4/3/12
to raph...@googlegroups.com
Let me clarify that - it's probably an issue with g.raphael rather than Raphael...

> --
> You received this message because you are subscribed to the Google Groups "Raphaël" group.
> To post to this group, send an email to raph...@googlegroups.com.
> To unsubscribe from this group, send email to raphaeljs+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/raphaeljs?hl=en-GB.
>

Guy Morton

unread,
Apr 3, 2012, 9:42:02 AM4/3/12
to raph...@googlegroups.com
Actually, no I think it IS something to do with Raphael - specifically getBBox.

If I mouseover a graph element multiple times, the y value returned from getBBox changes each time:

Object
• height: 28
• toString: function x_y_w_h() {
• width: 67
• x: 177
• x2: 244
• y: 31
• y2: 59
• __proto__: Object

Object
• height: 28
• toString: function x_y_w_h() {
• width: 67
• x: 177
• x2: 244
• y: -17
• y2: 59
• __proto__: Object

Note how y is decreasing? That's why the popup element keeps moving up the page on every mouseover.

So now I know why it's happening, but I don't know why Raphael 2 and 2.1 seem to deliver different results.

Can anyone shed any light on this for me?

regards

Guy

Guy Morton

unread,
Apr 3, 2012, 9:48:45 AM4/3/12
to raph...@googlegroups.com
In g.raphael if I specify isWithoutTransform when calling getBBox it fixes the problem. I'm not sure why this is needed now because as far as i can see, Raphael 2 and 2.1 haven't changed the getBBox default behaviour...anyway...main thing is the problem is solved.

Whoever is maintaining graphael probably needs to make the same change I did.

Guy

steo.js

unread,
Apr 5, 2012, 6:28:23 AM4/5/12
to raph...@googlegroups.com
same issue....diving deeper I found that:

Raphael.el.popup(..) function calls
f=this.getBBox(); // get the box
..
this.translate(..); // this CHANGE the box
..
f=this.getBBox(); // here we have the box changed
...
this.translate(..); // and again..


....deeper and deeper....(here we have a call stack:)
popup
    translate(4464)
        transform(4473)
            _extractTransform(1974) <== here the 'y' is changed

Reply all
Reply to author
Forward
0 new messages