DmitryBaranovskiy/raphael — Issue #431: bad text alignment in hidden div
Author: andrewluetgers
Created: 2011-10-26 22:40:14+00:00
State: open

When we have a raphael 2.0 canvas that gets drawn in a container that is hidden the text alignment gets screwy. Here is a simple example:

http://jsfiddle.net/pcPYJ/3/

Specifically the dy value on the tspan will be the same as the parent y value.

I know that on issue 156 you simply stated "Text doesn’t work properly on hidden canvas." and closed the bug with that.

But in this case we have a dramatic departure from the behavior in 1.5 where, in which case, if the div were hidden we would simply loose some of the fine tuning that happens to get the text vertically aligned. This fine-tuning usually amounted to a few pixels. Now with 2.0 if i position text at y of 200 it's tspan will now also have a dy of 200 and the result will not be anywhere near the correct neighborhood.

A potential solution to this is to simply create another canvas with display:block and visibility:hidden to then calculate the correct adjustment needed for text in the original canvas.