Scale capability not found

Earlier Pans had a “Scale” item in the Edit Menu that was great for tweaking the size of Image objects while maintaining the correct proportions. I don’t see this and have had to use the calculator ap to figure out the new pixel sizes in the Measurements panel.

Set the Align option to Proportional.

My niece’s wedding during the pandemic.

The Proportional maintains the width to height ratios when you first create the image object as in previous Pans. The Scale I am talking about would enlarge or shrink the object and other types of objects by a percentage like 75% or 120%.

Here is a HotKey I whipped up using the option-5 key (the % key). Once installed it will allow you to pop up a scale menu while in graphics mode when one or more objects are selected. If you want something other than a scale in the list you can chose “Other” and enter your own custom value.

definehotkeys "Global", "OPTION-5", |||  let scaler=""
let obList=""
obList=objectinfoarray({objectinfo("id")},{objectinfo("selected")},",")
if obList="" alertok "Nothing selected!" stop endif
popupatmouse ".25"+cr()+".50"+cr()+".75"+cr()+"1.25"+cr()+
    "1.50"+cr()+"1.75"+cr()+"2"+cr()+"Other", "", scaler
if scaler="" stop
elseif scaler="Other"
    gettext "Enter scale percentage.",scaler
    if scaler="" stop endif
endif
execute {changeobjects "rectangle",
    rectangletweak(objectinfo("rectangle"),"*size",}+scaler+{)} |||

This will also work in data mode if you have already selected objects with a procedure statement like selectallobjects. You can then rescale them all with this HotKey.

1 Like

How do you call a procedure while in graphics mode?

Once you have the HotKey defined you press option-5 to activate the code.

Gary that is brilliant. :clap:

Here is a slightly revised version. Most importantly, this version supports Undo.

definehotkeys "Global", "OPTION-5", |||
let scaler=""
let obList=objectinfoarray({objectinfo("id")},{objectinfo("selected")},",")
if obList="" alertok "Nothing selected!" stop endif
popupatmouse ".25"+cr()+".50"+cr()+".75"+cr()+"1.25"+cr()+
    "1.50"+cr()+"1.75"+cr()+"2"+cr()+"Other", "", scaler
if scaler="" stop
elseif scaler="Other"
    gettext "Enter scale percentage.",scaler
    if scaler="" stop endif
endif
startgraphicschange "Scale by "+scaler
changeobjects "rectangle",
    rectangletweak(objectinfo("rectangle"),"*size",val(scaler))
|||

I also eliminated the execute statement, which you were basically using to convert a string into a number. I think it’s better to just use the val( function. The execute statement is very powerful, but I also like to avoid it unless it is absolutely necessary. I think it makes it code a bit more confusing and more difficult to debug. When you need it you need it, but in this case, it wasn’t needed.

Gary inspired me to add this feature into Panorama, in the next version this will be available in the Object menu and when you right click on one or more selected objects.

My initial attempts to get the code to work gave an error indicating tht the scaler variable did not exist. I thought that was from the changeobjects parameter so I tried using the execute method to verify the problem which then went away. I probably made some simultaneous changes that actually fixed the underlying problem and never bothered to try the original version again. It was working and that is all I was concerned with as it was all experimental at the time.

Interesting that you can skip the first MODIFICATION parameter which does not seem to be optional as listed in the Help file. What does using it this way allow for undoing as compared to using one of the allowed modifications?

Gary is a total genius with Panorama. I remember his Slot Machine file as the most brilliant demonstration of Pan’s graphic capabilities. Thanks to Jim for adding Scale to the Objects Menu for the next PanX release.

Good grief, I just noticed that the statement used was startgraphicschange and not startdatabasechange! I had somehow missed that that statement was even available. Well good, I’ll have to tuck it away for future use.