Article View: adobe.indesign.sdk
Article #196Re: Where did PageItemUtils::ValidateRelativeMoveData go?
From: Satoru_Fujimori
Date: Fri, 06 Mar 2009 04:59
Date: Fri, 06 Mar 2009 04:59
39 lines
1918 bytes
1918 bytes
Hi all
I tried to implement this validating function.
/*----------------
validate whether itemList can be moved to newPoint
itemList : target items before moving
moveX,moveY : amount of moving from current position of itemList
pbBounds : bounds of spread in pasteboard
----------------*/
ErrorCode validateRelativeMoveData(
const UIDList& itemList,
PMReal moveX, PMReal moveY,
const PMRect& pbBounds)
{
ErrorCode result = kFailure;
do {
// get old PMRect of itemList before moving in pasteboard coordinates
PMRect oldRect = Utils<Facade::IGeometryFacade>()->GetItemsBounds(
itemList,
Transform::PasteboardCoordinates(),
Geometry::OuterStrokeBounds()
);
//get new PMRect after moving
PMRect newRect = oldRect.MoveRel( moveX, moveY );
//if any point of each corners falls with pbBounds, itemList can be moveed.
if ( pbBounds.PointIn( newRect.GetPoint( PMRect::kLeftTop ))==kTrue ||
pbBounds.PointIn( newRect.GetPoint( PMRect::kRightTop ))==kTrue ||
pbBounds.PointIn( newRect.GetPoint( PMRect::kLeftBottom ))==kTrue ||
pbBounds.PointIn( newRect.GetPoint( PMRect::kRightBottom ))==kTrue ) {
result = kSuccess;
}
} while (0);
return result;
}
Thanks for any advise.
-Satoru Fujimori
Technical Details
Message-ID:
<59b8212c.1@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b8212c.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f63e9,f1d5d89967c6916f X-Google-Attributes: gidf63e9,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Satoru_Fujimori@adobeforums.com Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.indesign.sdk Subject: Re: Where did PageItemUtils::ValidateRelativeMoveData go? Message-ID: <59b8212c.1@webcrossing.la2eafNXanI> Date: Thu, 5 Mar 2009 20:59:18 -0800 References: <59b8212c.-1@webcrossing.la2eafNXanI> Lines: 45 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit