Shortcut for resizing a selected object ?
Richard Gaskin
ambassador at fourthworld.com
Wed Dec 16 11:27:14 CST 2009
FWIW, here's the simplified version I put into my copy of the MC IDE. I
find it useful - should we add it to the master?
--
Richard Gaskin
Fourth World Media Corporation
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
-- Thanks to zryip.theslug at gmail.com for resizing with Option/Alt key
--
http://lists.runrev.com/pipermail/use-revolution/2009-December/132011.html
on arrowKey which
if the short name of the defaultStack <> the short name of the
topStack then pass arrowKey -- RG 090313
--
if (the selectedField) is not empty or the selectedObject is empty\
or word 1 of the selectedObject is "stack"\
or word 1 of the selectedObject is "card"\
and word 2 of the selectedObject is not among the items of
"field,button,image,player,scrollbar,graphic"
then pass arrowKey
lock screen
local diff
if the shiftkey is down
then put 10 into diff
else put 1 into diff
if the optionKey is "down" then
repeat for each line l in the selectedObjects
switch which
case "left"
AdjustRectFromArrow l, 3, -diff
break
case "right"
AdjustRectFromArrow l, 3, diff
break
case "up"
AdjustRectFromArrow l, 4, -diff
break
case "down"
AdjustRectFromArrow l, 4, diff
break
end switch
end repeat
else
repeat for each line l in the selectedObjects
switch which
case "left"
set the left of l to the left of l - diff
break
case "right"
set the left of l to the left of l + diff
break
case "up"
set the top of l to the top of l - diff
break
case "down"
set the top of l to the top of l + diff
break
end switch
end repeat
end if
unlock screen
end arrowKey
command AdjustRectFromArrow pObj, pItem, pAmount
get the rect of pObj
add pAmount to item pItem of it
set the rect of pObj to it
end AdjustRectFromArrow
On 12/16/09 9:10 AM, Richard Gaskin wrote:
> Nicely done. Limiting the resizing to the left and bottom removes the
> ambiguity I was wondering about in terms of which sides gets adjusted.
>
> I think I'll add this to my copy of the MC IDE, and have cc'd the MC
> discussion list here in hopes that the crew agrees it would be useful to
> add to the master version.
>
> It's a nice compliment to the Shift key modifier, which moves the
> objects by 10-pixel increments. With Option added for resizing, it
> really rounds out the arrow key use quite well.
>
> Thanks for the script - useful stuff.
>
> --
> Richard Gaskin
> Fourth World
> Rev training and consulting: http://www.fourthworld.com
> Webzine for Rev developers: http://www.revjournal.com
> revJournal blog: http://revjournal.com/blog.irv
>
> zryip wrote:
>
>>
>> How ?
>> Try this 8) :
>>
>> on rawkeyDown theKey
>> if (the altKey is down) and (theKey >= 65361) and (theKey <= 65364)
>> then -- only if alt key is pressed when using arrow key
>> put the selectedObjects into objectsList -- keep in memory the
>> list of objects to resize
>> get number of lines of objectsList
>> if it > 0 then
>> repeat with x = 1 to it -- a loop to resize all the objects in the list
>> resizeObject line x of the selectedObjects,theKey
>> end repeat
>> end if
>> else
>> pass rawkeyDown
>> end if
>> end rawkeyDown
>>
>> on resizeObject theObject,theKey
>> do "get rect of" && theObject
>> put numKey2Const(theKey) into direction
>> put getStep(direction,the shiftKey is down) into myStep -- step = 1
>> pixel or 5 pixels when the shift key is down
>> add myStep to item numKey2rectItem(direction) of it
>> do "set rect of" && (theObject) && "to it"
>> end resizeObject
>>
>> function numKey2Const valueKey
>> -- Not necessary but usefull to not keep in mind 65361 when I
>> search my left. 8)
>> switch valueKey
>> case 65361
>> return "left"
>> case 65362
>> return "up"
>> case 65363
>> return "right"
>> case 65364
>> return "down"
>> default
>> return ""
>> end switch
>> end numKey2Const
>>
>> function numKey2rectItem direction
>> if (direction is in "left,right") then
>> return 3
>> else
>> return 4
>> end if
>> end numKey2rectItem
>>
>> function getStep direction,shiftFlag
>> if (direction is in "left,up") then
>> put -1 into myStep -- reduce the size of the object
>> else
>> put 1 into myStep -- grow up the size of the object
>> end if
>> if shiftFlag then put (myStep * 5) into myStep
>> return myStep
>> end getStep
>>
>> -Zryip TheSlug- wish you the best ! 8)
>>
>> 2009/12/16 Richard Gaskin <ambassador at fourthworld.com>
>>
>> I use this feature in Fireworks and other tools that let you
>> select a single bounds handle, but how would this work in Rev (or HC
>> for that matter, since it used the "marching ants" marquee to indicate
>> selection)?
More information about the metacard
mailing list