I am working on a plugin that
1. Allows the user to select a plugin tool
2. Allows the user to drag a rectangle in which, depending on the selected plugin tool, SVG content created by the plugin has to be placed
This is working except for one aspect.
The plugin uses ExecPlaceRequest from the AIPlacedSuite and I am trying to find out how I can have the "place request" replace the art that was created while the user was dragging the rectangle in one ExecPlaceRequest call.
The reason this is needed is that there does not seem to be a way to correctly translate the placed art (m_hNewArt) to its correct position (where the rectangle was drawn), as it is not possible to find the top left corner of the placed svg art. What is possible is to find the bounding rectangle of the placed art but that might be smaller than the rectangle drawn by the user.
I was hoping that by assigning the drawn rectangle art to m_hOldArt in the place request data and using one of the place options, correct placement of the placed svg would be taken care of. Unfortunately that is not happening. The placed art is still randomly(?) positioned even when using one of the possible values for m_lPlaceMode that seems to allude to replacement (e.g. kForceReplace)
All tips warmly welcomed.
If you have the bounding rectangle of the placed art, don't you also have the upper left corner? I'm not sure why translating the art is not possible.
Thanks for taking the time to reply.
Unfortunately the svg that has to be placed is not completely filling the rectangle the user draws. The bounding box returned from the placed art obviously only takes into account the area where something is drawn. What I have done now is put an invisible 1x1 rectangle in the top left corner of the svg. That does allow me to find the correct location of the top left corner of the placed art and translate it correctly. But the dot serves no purpose but to support the translation, which all in all is not overly elegant.
I am also puzzled why there is support for an m_hOldArt value and force replace placement mode if that is not doing anything in my case. I can't find any documentation on how to properly use all these placement options either nor any samples that can help me.
So while I have worked around the problem I would really like to have a more elegant solution and at the same time learn how to properly use the placement options.