How to nudge 1px or 10px at a time?


#1

Can I use the Units and Grid inspectors to set it so that the arrow keys nudge an object by exactly 1 pixel, and Shift-arrow keys nudge it by 10 pixels? Regardless of zoom level?

Closest I can get it is by setting Major Grid Spacing to 100px, and Minor Grid Steps to 10, then Shift-arrow nudges by 10px regardless of zoom level. But arrows nudge by some mysterious number, which also depends on the zoom level.

I can turn on Snap to Grid, and force arrows to nudge by 1px, but then I can’t get Shift-arrows to nudge by a larger amount anymore. I’d prefer not to use Snap to Grid.


#2

Short answer: There is meaning behind the nudge amount, but it’s not typically desirable for pixel/point-based canvases, and there isn’t currently a way to get nudging to do what you want, short of configuring the grid as you already noted. Sorry. :(

Longer answer:

Note that the term “pixel” is ambiguous: there are both screen pixels and ruler pixels. Personally I always use Points for the ruler units instead of Pixel, largely to avoid such ambiguity, but OmniGraffle’s default ruler scale for Pixel-based rulers is 1 px = 1 pt, so it works out to the same unless you’ve configured a different scale.

OmniGraffle nudges based on screen pixels, because that’s the smallest meaningful nudge amount (especially when using, say, inches for ruler units and the user has zoomed in for finer control). Note that we obey the system scaling factor, so on a retina screen what is (generally) presented as 1 pixel is actually 2 device pixels.

If your canvas uses pixels for the ruler units, then at 100% zoom, a nudge should get you a 1-pixel movement because 1 screen pixel = 1 ruler pixel; but at 400% zoom it should get you a 1/4-pixel movement because 1 screen pixel = 1/4 ruler pixel; etc. (It’s a lot less obvious what’s going on when you’re not at a “nice” zoom level. For instance, at 127% zoom 1 screen pixel = 0.7874 ruler pixels, which is going to look completely non-obvious.

While this is a known limitation, emailing us about this (“Contact Omni” in the Help menu) will help reflect the need for a solution.


#3

It might be helpful to have this script one of our engineers created. It takes your selection and rounds it to the nearest pixel. You can save this as .omnigrafflejs and put it in your plug-ins folder from the Automation menu if you have OmniGraffle Pro. You can put this in your plug-ins and you will see Pixel Align from the Automation Menu (Pro Only)-

perform: function(selection) {

   var gs = selection.solids
   for (i in gs) {
       var g = gs[i]
       var r = g.geometry

       r.x = Math.round(r.x)
       r.y = Math.round(r.y)
       r.width = Math.round(r.width)
       r.height = Math.round(r.height)

       g.geometry = r
   }
}

I’ve also posted a link at https://www.dropbox.com/s/e9o9uevjrvgwqkr/PixelAlign.omnijs?dl=0 if you’d like to try getting the plug-in and putting it into your plug-ins folder.

Thanks,
Lanette