Skip to main content
Participant
November 3, 2022
Question

Zoom to Fit Shortcut (Ctrl-0) fits to full space without gap

  • November 3, 2022
  • 2 replies
  • 781 views

Hi

 

When I reinstalled Photoshop on my new Windows computer (v24.0), the Zoom to Fit Shortcut (Ctrl-0) now fills the full space.

 

Previously it left a little gap at the top and bottom so I could easily use the marquee tool to select my artwork at the edges to copy it.

 

Now as its filled to the top and bottom, when I use the marquee tool it moves the board to be able to select up the edges so I have zoom out a bit again to be able to copy upto th edges.

 

Is there a way for it to fill but still leave a small gap still, or is this the way it just works now?

This topic has been closed for replies.

2 replies

Tom Winkelmann
Inspiring
November 4, 2022

And until it is fixed, you can help yourself with a small script. Copy the script into the scripts folder and then assign a shortcut (e.g. CTRL+0).

 

function sTID(s) {return app.stringIDToTypeID(s);}
app.runMenuItem(charIDToTypeID("FtOn"));

setZoom(zoomLevel()*.98);

function zoomLevel(){
if(!documents.length) return;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var desc = executeActionGet(ref);
return desc.getDouble(stringIDToTypeID('zoom'))*100;
};

function setZoom( zoom ) {
   cTID = function(s) { return app.charIDToTypeID(s); };
   var docRes = activeDocument.resolution;
   activeDocument.resizeImage( undefined, undefined, 72/(zoom/100), ResampleMethod.NONE );
   var desc = new ActionDescriptor();
   var ref = new ActionReference();
   ref.putEnumerated( cTID( "Mn  " ), cTID( "MnIt" ), cTID( 'PrnS' ) );
   desc.putReference( cTID( "null" ), ref );
   executeAction( cTID( "slct" ), desc, DialogModes.NO );
   activeDocument.resizeImage( undefined, undefined, docRes, ResampleMethod.NONE );
};

 

Per Berntsen
Community Expert
Community Expert
November 4, 2022

Thanks for that, but the script doesn't work.

I named it "Fit in window.jsx". I don't know anything about scripting, not sure if that's the right extension.

 

Per Berntsen
Community Expert
Community Expert
November 4, 2022

It's working now, I had failed to copy the brace and semicolon at the end.

But I can't figure out how to create a shortcut for it, since it doesn't appear in the list of scripts under File > Scripts – I have to click browse.