The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniGraffle General (http://forums.omnigroup.com/forumdisplay.php?f=10)
-   -   Position Image on an Object in a Relative Positon So It Maintains Relative Position but no Resize (http://forums.omnigroup.com/showthread.php?t=27664)

acowan 2013-01-04 01:51 PM

Position Image on an Object in a Relative Positon So It Maintains Relative Position but no Resize
 
1 Attachment(s)
I have a project where I need
a) basic rectangle that I can move around, resize, etc. that has
b) one of several fixed size images riding along imposed on the rectangle's lower, left corner.

In the attached image, the rectangle to the left has the compliant look. The one the right show the two items. I put magnets on the image but from what I understand only magnets that are on alternatively an object and a connector attract.

Do you see a way to do this?

Things I've done and tried-
1. Place it by hand each time- labor intensive but workable (the option of last resort)
2. Group the shapes- not great because I often need to resize the rectangle and I don't want the circle to resize.
3. Make a connector to bind them that has a fixed length of near zero (seemed kludgey so didn't spend a lot of time on it)
3. Make the image think it's a connect- not sure how to do this or if it's possible

Any suggestions would be much appreciated. Thanks.

acowan 2013-01-04 04:06 PM

Related Item
 
1 Attachment(s)
I have another related item related to the question of 'Is there a way to group things but keep size static?'.

On each of the rectangles I use, I have a circle w/ an arrow attached to it that enumerates the shape (example attached). I'd like this to grip the magnet as I move the rectangle and resize it, but not resize and I'd like it to maintain it's position relative to the rectangle/the magnet where it's attached.

Possible?

RobTrew 2013-01-04 10:10 PM

3 Attachment(s)
One approach would be to group the main shape with its (two or more) satellite shapes, and use a script (perhaps at a late stage of editing) to batch-correct any satellite size distortions that have arisen during resizing of the groups.

For this to work, satellite shapes would need to be tagged (with user data, as in the [B]Inspectors > Note[/B] dialog) with their normal dimensions (before they are included in a group), so that a script can restore these dimensions later. A simple tagging script can do this to selected shapes:

[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=2681&stc=1&d=1357368725[/IMG]

[CODE]-- Tag selected shape with its own dimensions

property plstTags : {"Width", "Height"}

tell application id "OGfl"
repeat with oSeln in (selection of front window) as list
tell oSeln
set lstSize to size
repeat with i from 1 to 2
set value of user data item (item i of plstTags) to (item i of lstSize) as string
end repeat
end tell
end repeat
end tell[/CODE]

As long as the satellite shapes have these "Width" and "Height" tags, the normal width, height and position of any such satellites can be restored at any point by selecting their enclosing groups, and running a script along the lines of:

[CODE]property pTitle : "Restore satellite dimensions (and link length) within selected (resized) group(s)"
property pVer : "0.03"

property plstTags : {"Width", "Height", "LinkLength"}

tell application id "OGfl"
repeat with oSeln in (selection of front window) as list
tell oSeln
if class = group then
set refGraphics to (a reference to its graphics)
set {lstSizes, lstOrigins, lstData} to {size, origin, user data} of refGraphics
repeat with i from 1 to length of lstSizes
if item i of lstData is not missing value then
set {rWidth, rHeight} to {0, 0}
tell item i of refGraphics
try
-- READ THE NORMAL DIMENSIONS FROM ANY TAGS
set rWidth to (value of user data item (item 1 of plstTags)) as number
set rHeight to (value of user data item (item 2 of plstTags)) as number
end try

-- IF NORMAL DIMENSIONS ARE SPECIFIED, RESTORE THEM
if rWidth > 0 and rHeight > 0 then
set {lstSize, lstOrigin} to {item i of lstSizes, item i of lstOrigins}
set {rDX, rDY} to {(item 1 of lstSize) - rWidth, (item 2 of lstSize) - rHeight}

-- ADJUSTING THE ORIGIN TO LEAVE THE CENTRE UNMOVED
if rDX ≠ 0 then set item 1 of lstOrigin to (item 1 of lstOrigin) + rDX / 2
if rDY ≠ 0 then set item 2 of lstOrigin to (item 2 of lstOrigin) + rDY / 2
set {origin, size} to {lstOrigin, {rWidth, rHeight}}
end if

-- If a Link Length is specified, adjust distance of satellite from nearest edge of main shape
set rLength to 0
try
set rLength to (value of user data item (item 3 of plstTags)) as number
end try

-- Find any horizontal or vertical (incoming or outgoing) link
if rLength ≠ 0 then
set {lstIn, lstOut} to {incoming lines, outgoing lines}
set {lngIn, lngOut} to {length of lstIn, length of lstOut}
if lngIn > 0 then
set {rHoriz, rVert} to size of (item 1 of lstIn)
else if lngOut > 0 then
set {rHoriz, rVert} to size of (item 1 of lstOut)
end if

-- if a link was found then correct its length (by moving the satellite)
if (lngIn + lngOut) > 0 then
set lstOrigin to origin
if rVert > rHoriz then
set origin to {item 1 of lstOrigin, (item 2 of lstOrigin) + (rLength - rVert)}
else
set origin to {(item 1 of lstOrigin) + (rLength - rHoriz), item 2 of lstOrigin}
end if
end if
end if
end tell
end if
end repeat
end if
end tell
end repeat
end tell

[/CODE]

RobTrew 2013-01-04 10:33 PM

(You could, of course, prepare a stencil of groups in which the satellites had these Width and Height tags)

RobTrew 2013-01-05 04:37 AM

1 Attachment(s)
You could also add a "LinkLength" property to the linked (numbered) satellite, if you want the script to correct its distance from the lower edge of the main shape (as well as correcting its proportions).

[IMG]http://forums.omnigroup.com/attachment.php?attachmentid=2684&stc=1&d=1357392880[/IMG]

acowan 2013-01-08 01:04 PM

Thanks again Rob


All times are GMT -8. The time now is 01:20 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.