In my star charts, I'm allowing users to make use of the Adobe SVG
Viewer's built-in scaling facilities (Shift/Cntl-Shift-click, "Zoom
In" and "Zoom Out" in the context menu). When the user sooms in, I
want all my stars to spatially scale, but I want the apparent radius
of the circles to remain visually the same.
I seemed to make sense to me to trap the SVGZoom event from the <svg>
element, obtain the currentScale, and scream through the <circle>
elements, resetting their "r" attributes to a new calculation based
on the current scale factor.
I calculate the "r" attribute for a star as 15.0 minus the visual
magnitude for that star. If the visual magnitude is 8.8, then the
radius for the circle is set to 15.0 - 8.8, or 6.2. When I trap the
zoom event, and find that the new scale factor is 2.0, it seems to me
that I ought to be able to reset the star's radius to the same
equation (15.0 - 8.8), but then divide it by the new scale factor. If
the scale factor is 2.0, then I end up with (15.0 - 8.8) / 2, or 3.1.
The radius gets set to exactly half of what it was at the original
1.0 scale.
Now it seemed like that would work. The radiuses scale down as the
view scales up, and vice versa. But it's not working. As I scale the
view up, the radiuses get smaller, but they get too small. It almost
seems as if my setting the new radiuses works independently of the
current scale factor. According to my math, I should be seeing
absolutely no change in the apparentr diameter of a star as I zoom
into it, because I am mathematically working in opposition to the
scaling. But it's not happening.
Am I thinking wrongly about this problem?
-Christopher
|