The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniGraffle > OmniGraffle General
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Center on page? Thread Tools Search this Thread Display Modes
Is there any way, after one selects all the objects on the page, to tell OG to take that entire "block" of objects and center the block on the page?
 
Group the objects.
Center the group on the canvas in the normal way.
Ungroup them.
 
If it proves cumbersome to repeatedly:
  • group the selected shapes,
  • attend to the options of the alignment inspector,
  • and then ungroup,

you could assign a script to a keystroke or a Launchbar/Alfred trigger:

Code:
property pTitle : "Move selected graphics to centre of 1st canvas page"
property pVer : "0.01"
property pAuthor : "Robin Trew"

--CENTRE THE SELECTED BLOCK OF GRAPHICS ON THE FIRST PAGE OF THE OMNIGRAFFLE CANVAS

on run
	tell application id "OGfl"
		tell front window to set {oCanvas, lstSeln} to {its canvas, selection}
		
		-- FIND THE CENTRE OF THE SELECTION(S)
		
		-- Find horizontal and vertical minima and maxima of the selected shapes
		set {rXMin, rXMax, rYMin, rYMax} to {10 ^ 6, 0, 10 ^ 6, 0}
		repeat with oGraphic in lstSeln
			tell oGraphic to set {{rX, rY}, {rAcross, rDown}} to {origin, size}
			set {rRight, rBottom} to {rX + rAcross, rY + rDown}
			
			if rX < rXMin then set rXMin to rX
			if rRight > rXMax then set rXMax to rRight
			if rY < rYMin then set rYMin to rY
			if rBottom > rYMax then set rYMax to rBottom
		end repeat
		
		-- and derive an aggregate centre of the selected shapes
		set {rMidSeln_X, rMidSeln_Y} to {(rXMin + (rXMax - rXMin) / 2), (rYMin + (rYMax - rYMin) / 2)}
		
		-- GET THE X,Y DELTAS BETWEEN THE SELECTION(s) CENTRE AND THE PAGE CENTRE
		tell oCanvas to set {rPageAcross, rPageDown} to page size
		set {rDeltaX, rDeltaY} to {(rPageAcross / 2) - rMidSeln_X, (rPageDown / 2) - rMidSeln_Y}
		
		-- TRANSLATE THE POSITION OF EACH SELECTED SHAPE
		repeat with oGraphic in lstSeln
			tell oGraphic
				set {rX, rY} to origin
				set origin to {rX + rDeltaX, rY + rDeltaY}
			end tell
		end repeat
	end tell
end run
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes



All times are GMT -8. The time now is 10:13 PM.


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