Thanks!  This is a great launch board to start from.



On Jun 13, 2004, at 2:52 AM, Brian Yennie wrote:

Simon,

How about something like this:

1) When you create a new stack, set a couple of properties of the stack to remember what size it wants to be:

set the actualHeight of this stack to (11*72)   ## 11 inches at 72DPI
set the actualWidth of this stack to (17*72)    ## 17 inches at 72DPI
set the zoomPercent of this stack to 100       ## start viewing at 100%

2) Ditto for objects- you want to remember what size they _want_ to be as accurately as possible (if you just translate each time, cumulatively, you'll probably notice them start to drift)

ex:

on newButton
set the actualHeight of the target to (the height of the target * 100 / the zoomPercent of this stack)
set the actualWidth of the target to (the width of the target * 100 / the zoomPercent of this stack)
set the actualLeft of the target to (the left of the target * 100 / the zoomPercent of this stack)
set the actualTop of the target to (the top of the target * 100 / the zoomPercent of this stack)
end newButton


3) Create a simple handler which resizes the stack itself and you can call when needed:

on zoomLayout toPercent
set the zoomPercent of this stack to toPercent
get the rect of this stack
put (item 2 of it + round(the actualHeight of this stack * toPercent / 100)) into item 4 of it
put (item 1 of it + round(the actualWidth of this stack * toPercent / 100)) into item 3 of it
set the rect of this stack to it
end zoomLayout


4) Catch the resizeStack handler to fix your objects:

on resizeStack newWidth, newHeight, oldWidth, oldHeight
repeat with i=1 to (number of cd parts)
put the actualLeft of cd part i * (the zoomPercent of this stack / 100) into newLeft
put the actualTop of cd part i * (the zoomPercent of this stack / 100) into newTop
put the actualHeight of cd part i * (the zoomPercent of this stack / 100) into newHeight
put the actualWidth of cd part i * (the zoomPercent of this stack / 100) into newWidth
set the rect of cd part i to (round(newLeft)&comma&round(newTop)&comma&round(newLeft + newWidth)&comma&round(newTop + newHeight))
end repeat
end resizeStack



All of this (with some work I'm sure, this is off the top of my head) should buy you fairly reasonable resizing, although you probably won't achieve ultra-accurate layout by nature of the beast- Rev isn't vector graphics nor able to store higher zoomable resolutions for you to maintain in the background when someone is zoomed out. When the user is working at 800x600 pixels, newly created objects are going to be limited by the available pixels and when you zoom way back out, you might get nudged slightly by rounding inconsistencies.


If you need finer alignment, you might consider other tactics, such as allowing objects to be aligned horizontally / vertically and carefully honoring that when zooming, etc. But the above approach should give reasonable results.

You might also investigate the Rev geometry manager for inspiration...

HTH



Hi all, I want to throw out the following question to see if anyone has a stack already done that can do the following...

My stack allows users to create a layout using template objects that fit the printed page. However, some users don't have monitor that can display the full resolution, and 11 x 17 layouts are near impossible for most.

So I'm looking to make a stack that can resize all objects on a card *proportionally* to fit the new stack size (for example, a user wants to scale the stack down to 77% because that's all that fits on his viewable screen space). But it will always be an aspect ratio proportionate to the layout they are working on. That way when it comes time to print (or preview a print) I can scale everything to 100%.

Or is there another way?

Sincerely,
Simon

_______________________________________________
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard



_______________________________________________ metacard mailing list [EMAIL PROTECTED] http://lists.runrev.com/mailman/listinfo/metacard


Sincerely,
Simon

_______________________________________________
metacard mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/metacard

Reply via email to