Copy link to clipboard
Copied
Hi all,
I'm hoping someone can help me—I want to position a page item in the layout window, eg. in the center of the window, but preferably anywhere in the window.
Constraints are:
1. Do not disturb the layout window (or if you do, put it back exactly), and
2. Do not disturb the clipboard.
Is this possible?
- Mark
P.S. I was wondering if CoordinateSpaces might extend to the layoutWindow, but it doesn't seem to. @Marc Autret I would be grateful to hear your thoughts as I know you've done a lot of work in this area.
Copy link to clipboard
Copied
Hi Mark,
Difficult question! Of course the LayoutWindow object has bounds, but they are expressed in screen coordinates and (to my knowledge) there is no mapping from screen space to DOM coordinate spaces. These are totally different beasts.
I haven't explored the question further, but perhaps an approach would be to create a transformation matrix yourself, at a specific time, from a known state of the ‘viewport’. For example, when you run View > Entire Pasteboard you get some fixed view that forcibly contains the whole active spread (and a few more pixels around!). At this particular time and zoom percentage, there is a virtual connection between the window bounds and the spread coordinate space, something like [k, 0, 0, k, tx, ty] in terms of transformation matrix.
This solution seems extremely fragile though. Furthermore, it does not meet your goal (constraint 1) which implies that the screen↔DOM mapping should be determinated from any view state. Looks like a very hard problem 😞
Best,
Marc
Copy link to clipboard
Copied
Thanks a lot for considering my question Marc. I suspected that would be the anwer. - Mark
Copy link to clipboard
Copied
Hi all, I have made a feature request for this. I suggested just a simple method of LayoutWindow that aligns the layoutWindow's viewport's center with a point in document coordinates—this is what Illustrator does. Combining this with zoom, which we already have, will be enough for my purposes.
If you would like to see this feature, please vote.
- Mark
Copy link to clipboard
Copied
Interesting. Screenspace coordinates like this could also be used to snap dialog windows to pageItems. I came here by googling if a dialog can be made to position itself over a frame.
Copy link to clipboard
Copied
Hi @Stephan Moebius, I think for this purpose we would need, as Marc discussed, a way of mapping between DOM coordinate space(s) and screen coordinates. I would like to see that, too!