LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
TheWaterbug

Constrain graphic's aspect ratio when re-sizing

Status: Already Implemented

Shift key constrains to vertical, aspect, or horizontal. If you drag diagonally holding down the shift key, it maintains aspect ratio.

I imported and pasted a graphic (my company logo) onto the front panel of my VI, but apparently there's no simple way to resize it while constraining the aspect ratio (e.g. resizing it proportionally).

 

I'm not asking to do it programmatically; I'm asking simply about resizing it to fit the rest of the front panel's design. 

 

If I grab the handles and drag, it allows arbitrary resizing on both axes. If I hold down Shift it constrains it to resizing the vertical axis only. I've tried every combination of modifier keys, on both OS X and on Windows, and I can't seem to constrain the aspect ratio.

 

Most other applications that allow image resizing offer one or more of the following:

  1. Holding down a modifier key (typically Shift) while dragging a corner resize handle forces proportional resizing. The current behavior in LV makes no sense. Holding down Shift forces a vertical resizing only, but this can be done by dragging the top/bottom handle (e.g. not a corner handle).
  2. In the Set Width/Height dialog, have a checkbox to Preserve Aspect Ratio. If checked, any entry into height or width causes automatic calculation in width or height OnBlur.
  3. In the Set Width/Height dialog, support entry by % or by pixels, with the same option to constrain.

This will help all of us produce more professional-looking applications. 

8 Comments
AristosQueue (NI)
NI Employee (retired)

Shift key constrains to vertical, aspect, or horizontal. I just double-checked... it works in the couple versions that I tried. If you drag diagonally holding down the shift key, it maintains aspect ratio.

Darren
Proven Zealot
Status changed to: Already Implemented

Shift key constrains to vertical, aspect, or horizontal. If you drag diagonally holding down the shift key, it maintains aspect ratio.

TheWaterbug
Member

Ah, I think I'm seeing the problem now. It works, but only  for images that are closer to a squarish aspect ratio.

 

It fails (or is extraordinarily picky) if the image has a very wide or very narrow aspect ratio.

 

For example, drop this logo or this rotated version onto a front panel and attempt to scale either proportionally. I've been trying for 2 days! If there's some magic angle at which I need to drag it, I haven't found it yet.

 

 

With a graphic of "normal" aspect ratio, the user can drag the corner handle arbitrarily, but in an approximately diagonal direction, and if s/he then presses Shift, the aspect ratio snaps to the original, and a diagonal line appears from the drag handle to the original corner.

 

On a wide or narrow graphic, this doesn't happen. Pressing shift during an arbitrary resize constrains to vertical, not to proportional.

 

edit: after some more trial and error, I can find the magic angle, but only to make these tall/wide graphics larger, not to make them smaller.

 

So I'll recategorize this as a bug for the resize handle, and maintain the checkbox as a suggested feature. Smiley Happy

 

AristosQueue (NI)
NI Employee (retired)

I see your point about the very narrow images. I agree, that looks like a bug.

TheWaterbug
Member

For some reason I excel at finding obscure bugs and at crashing software. It's a gift! 

 

It's not very useful during a zombie apocalypse, but at least I'm good at something.

elset191
Active Participant

Add +1 to being annoyed by the narrow behavior, whether extraordinarily picky or buggy.  I run into that a lot messing with the pipe controls in the DSC toolkit since I tend to make them long and short.

--
Tim Elsey
Certified LabVIEW Architect
wiebe@CARYA
Knight of NI

>For some reason I excel at finding obscure bugs and at crashing software. It's a gift! 

 

A lot of us (I assume) found and learned to live with this bug long before the idea exchange came to life. It is one of those things... Would be nice if it could be fixed though. Sorry, can't Kudo anymore.

lcmstill
Member

For anyone who's stuck on this and needs a workaround solution for narrow objects, I've found this works:

Add some dummy item (a button or whatever, it doesn't matter) above/below the narrow object you want to rescale and then group them (action toolbar -> reorder -> group) so that the bounding box of the group as a whole is more square-shaped. You can now resize the whole group whilst holding shift key and maintain the aspect ratio of all of the items in the group.

After you've got your object to the size you want, ungroup them again and delete the dummy object.