Answered
It isn't that complicated. You don't need `getGraphics` function if you already have the graphic some other way. You can move the `intersection` logic inside the `intersectionOfGraphicFrame` function. The whole thing—minus the checking and getting—boils down to this one operation:
graphic.parent.geometricBounds = [
graphic.geometricBounds[0] > graphic.parent.geometricBounds[0] ? graphic.geometricBounds[0] : graphic.parent.geometricBounds[0],
graphic.geometricBounds[1] > graphic.parent.geometricBounds[1] ? graphic.geometricBounds[1] : graphic.parent.geometricBounds[1],
graphic.geometricBounds[2] < graphic.parent.geometricBounds[2] ? graphic.geometricBounds[2] : graphic.parent.geometricBounds[2],
graphic.geometricBounds[3] < graphic.parent.geometricBounds[3] ? graphic.geometricBounds[3] : graphic.parent.geometricBounds[3],
];
The larger issue is you don't always do a very good job of giving us examples that cover all your needs. The code I wrote works perfectly on your example document. But now you are talking about the `fit` method—which has nothing to do with your example. I know it can be hard., but try to supply examples that cover all your cases.
- Mark
Sign up
Already have an account? Login
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inSign in to Adobe Community
To post, reply, or follow discussions, please sign in with your Adobe ID.
Sign inEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.

