Struggling to understand CoordinateSpaces using resolve method
As the title of my post says... I'm struggling to understand CoordinateSpaces. I read the description provided in the 'Adobe InDesign CS6 JavaScript Scripting Guide' and I created a simple document to confirm my understanding. But the results I received were not as expected and I don't think I understanding some core concepts.
I will write some blocks of code and then try to explain what I think they work.
$.writeln( document.selection[0].resolve( [[0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS], CoordinateSpaces.PAGE_COORDINATES )[0] );
This functions as I expected. The following is a breakdown of the arguments and my understanding of them:
- [0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS
- [0,0] – anchor position relative to the object bounds – Top Left
- BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS – I am assuming that this makes the anchor position relative to the PageItem's path where as OUTER_STROKE_BOUNDS makes the anchor position include stroke weight extending past the PageItem's path
- CoordinateSpaces.PASTEBOARD_COORDINATES – Is the location of the anchor point within the pasteboard coordinate space
Now this is all understandable but then I saw the following code on indiscripts:
$.writeln( document.selection[0].resolve( [[0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, CoordinateSpaces.INNER_COORDINATES], CoordinateSpaces.INNER_COORDINATES)[0];
- [0,0], BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS, CoordinateSpaces.INNER_COORDINATES]
- [0,0] – as above
- BoundingBoxLimits.GEOMETRIC_PATH_BOUNDS – as above
- CoordinateSpaces.INNER_COORDINATES – This bit I don't understand. I read the Adobe InDesign CS6 JavaScript Scripting Guide and it seems to suggest that this is the location of the anchor point within the coordinate space. But that doesn't make sense to me because thats what the last argument is meant to do isn't it?
- CoordinateSpaces.INNER_COORDINATES – Confused now because of point above
So as you can see this example the introduction of a coordinate space in the first argument confuses me. If somebody could help me understand its purpose I would really appreciate it.
Also I have the following questions about coordinate spaces:
- PARENT_COORDINATES – Wouldn't this just be spread? All PageItems parents are a spread right?
- INNER_COORDINATES – What is this!? Documentation says it's the coordinate space the object was created in. How can I tell what coordinate space an object is created in? Why is this usful? If I draw a rectangle on a page is its created the pasteboard, page, or spread coordinate space?
