-
Notifications
You must be signed in to change notification settings - Fork 0
layout
In many places you will see strings for layout or thickness. We could just use a floating point number to indicate pixel location, but this is limiting. For example, we want the displays to be resizable, so that changing the canvas size doesn't require that we also change all the locations of objects on the page. IDL has the idea of normalized coordinates, but this is limited as well.
Things are specified using layout strings, which contain a normal position, em offsets, and pixel offsets in one string. For example, "80%-1em" means a position which is 80% of the way across the screen, and then 1 em-height off of that. This means that if you enlarge the font, then the position would change as well, perhaps allowing room for a larger label. Note the 80% position isn't always relative to the page. It might mean 80% of the length of the X-axis, for example, and its meaning depends on the context.
Let's look at a particular example. The application property dom.canvases[0].marginColumn has two properties, right and left. When value of right is 100%-5.0em it means that the right side of the column is 5 em-heights in from the right side. If the font is "Scheme Bk-20" the em height is 20 pixels, so the right side of the plot is located 100 pixels in from the right side. Note that "100%-100px" would resolve to the same location, but if the font size is changed the position would remain the same.
The rows and columns which lay out the canvas can be relative to another row or canvas, its parent. So suppose you have two plots, which occupy two rows. Each row has a parent which is the marginRow. The first row might have its top equal to "0%", meaning the top of the margin row. But if its bottom is "50%-2em", then the position is the middle of the marginRow, and then up 2ems. (Note Autoplot's layout has the historic that nearly every graphics system has, that (0,0) is the upper-left corner--a decision which goes back to the early 2000s.)