OT: Re: problem with logic/math



Billy,

I can't tell from the code posted whether shiftX and shiftY refer to the center of the visible area, or not. But, I suspect not, based on the fact that you need to adjust them as you scale. I suspect that they represent the lower left corner, or something.

I suggest having the shiftX and shiftY refer to the unscaled coordinates of the center of the viewable area. Then, they do not have to change on zooming in and out, the image is just redrawn with the same center.

If the redraw() would be a hassle to change, you may get acceptable visuals by just fixing the constants to be inverses of each other. Youve got 0.6 and 1.4, but 1/1.4 != 0.6. Try (7.0/10.0) and (10.0/7.0), or something, and you should get closer.

One other change that you may want to make will be to adjust the shift quantity, currently "50", by the scaling. I think that you probably want that change anyway, although I now see that if shiftX and shiftY are scaled, a constant would work.

Eric





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]