I know how to align and distribute layers in various ways, but one thing I can't seem to find anywhere is if it's possible to center a layer inside the viewport while I'm zoomed in. I hate having to zoom all the way out to find where the layer is and move it to where I need it and zoom back in.

  • 2
    I think the Navigator Panel is about the best option.
    – Scott
    Jan 13 '19 at 19:05
  • Thing is, if I click a layer that lies outside the part I'm looking at, I still can't see it in relation to where I'm zoomed in to know where I have to move it. Is there a way to show where the currently selected layer is in the navigation panel?
    – ddonche
    Jan 13 '19 at 19:22

There is no way to do it. Although a workaround to get the layer to the currently zoomed area would be to show the ruler in your workspace (be sure to set the units to pixels to make it easier to position your element, this can be done by right clicking any of the axis of the ruler and setting it to "pixels"), then you could see where you exactly are zoomed in, then in the layers panels select the layer you wish to position in your viewport, hit ctrl + t (cmd + t on mac) to bring up the transformation controls and in the first two fields of the top tool bar you would see the x and y ones where you would put the first numbers that you see on the respective ruler's axis, after you set the two fields, hit ctrl+enter to finish the transformation and you would have the layer in your viewport, if you wish to center it you could do it manually by calculating pixels taking references by the amount of pixels showed in the axis of the ruler and the width or height of your layer, this could be annoying but it's the only way of doing it perfectly.


It's possible to do with a script (works in CC2015.5+). This script pan the view to the actively selected layer:

var ref = new ActionReference();
ref.putProperty(stringIDToTypeID("property"), stringIDToTypeID("zoom"));
ref.putEnumerated(charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var zoom = executeActionGet(ref).getDouble(stringIDToTypeID('zoom'));

var bounds = activeDocument.activeLayer.bounds;
var x = (bounds[0] + (bounds[2] - bounds[0]) / 2) * zoom;
var y = (bounds[1] + (bounds[3] - bounds[1]) / 2) * zoom;

var panZoomDescriptor = new ActionDescriptor();
panZoomDescriptor.putDouble(stringIDToTypeID("x"), x);
panZoomDescriptor.putDouble(stringIDToTypeID("y"), y);
panZoomDescriptor.putDouble(stringIDToTypeID("z"), zoom);
panZoomDescriptor.putBoolean(stringIDToTypeID("resize"), false);
panZoomDescriptor.putBoolean(stringIDToTypeID("animate"), false);

executeAction(stringIDToTypeID("setPanZoom"), panZoomDescriptor);
  • You can also just Alt + Left-click the layer in the Layers panel. But this will not only pan to the center of the layer, it will also zoom so the layer fits in the window.
    – Wolff
    Oct 6 '20 at 15:57
  • Ah yes, that's new in cc2020. Btw did they fix that alt-clicking a layer to subtract from selection based on layer transparency was zooming to the layer 'thanks' to that feature? Oct 6 '20 at 16:20
  • I think so. Never noticed that. To subtract you have to Ctrl+ Alt + Left-click and that doesn't trigger any zooming/panning.
    – Wolff
    Oct 6 '20 at 16:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.