-
Notifications
You must be signed in to change notification settings - Fork 35
Zoom and scale
From Egon Willighagen:
now the rendering/controlling development is strongly picking up again, I would like to point out the following...
In the original CDK-JChemPaint design now used, as set out by me and Niels, to replace the older rendering code, there are two principle concepts:
scale: this factor ensures that the world coordinates gets transformed into screen coordinates (pixels) margin: this scaling is affected by the margin: the scaling is such that there is this margin.
And then there is this:
zoom: given the above scaling, which makes a structure fit on screen, there is a zoom factor used by the user to zoom in and out, where it defaults to 1.0, thus 100%.
There is also view, screen size, etc. That is, each actual application (JChemPaint, Bioclipse, AMBIT, Cinfony, and many, many others) has an area where it depicts a structure. This application can have various options:
- fixed scale: the actual area onto which is drawn is fixed, and if the screen (Component, JFrame, etc) is enlarged, the scale remains the same, and more white space is created
- scale-to-fit: the scale is update when the size of the actual drawing area is increased; the amount of whitespace remains identical
Now, both can be combined with scroll panes, of course, to further complicate things.
However, the current CDK-JChemPaint iteration was intended to follow this design, and we set out to do so, but in time workaround were created that invalidated this design. For example, Java is pretty bad at font rendering, where the font size is in pixels, and you have to resize the font size based on the actual zoom and scale. Moreover, since font rendering is at least somewhat toolkit dependent (SVG, AWT, SWT, ...), this problem has not been resolved yet...
Why this matters: there are several bugs because of this situation. If people are going to look into this, we should very clearly communicate the design :)
Egon
-- Dr E.L. Willighagen Postdoctoral Researcher Department of Bioinformatics - BiGCaT Maastricht University (http://www.bigcat.unimaas.nl/) Homepage: http://egonw.github.com/ LinkedIn: http://se.linkedin.com/in/egonw Blog: http://chem-bla-ics.blogspot.com/ PubList: http://www.citeulike.org/user/egonw/tag/papers