Skip to content

About

Just zoom to your current selection vie shortcut.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

ZoomToSelection.jsx

"Fit Selection in Window" for Adobe InDesign — the missing zoom function.

InDesign has "Fit Page in Window" and "Fit Spread in Window", but no "Fit Selection in Window". This script fills that gap: select any object (or multiple objects), run the script, and the view zooms to show your selection centered with a 10 % margin — regardless of which page it's on.

Compatibility

Created and tested with Adobe InDesign 2026 (v21.3) on macOS.
Should work with recent CC versions. Not tested on older versions or Windows.

Installation

  1. Open the Scripts panel: Window → Utilities → Scripts
  2. Right-click the User folder → Reveal in Finder
  3. Copy ZoomToSelection.jsx into the Scripts Panel folder
  4. The script appears immediately in the Scripts panel — no restart needed

Assign a Keyboard Shortcut (recommended)

Edit → Keyboard Shortcuts → Product Area: Scripts
Find ZoomToSelection in the list, assign your preferred shortcut (luc prefers Command Shift 2), click Assign. Shortcut suggested sby Claude: ⌥⌘= (mirrors the feel of the existing fit commands ... but luc did not bother to try on his german keyboard )

Usage

  1. Select one or more objects
  2. Run the script (double-click in Scripts panel, or use your shortcut)
  3. The view zooms to fit the selection with 10% padding, centered

Works with any page item: text frames, images, groups, shapes.
Handles multi-object selections (zooms to the combined bounding box).

How it works

InDesign 2026's scripting API offers no direct scroll position control —
scrollPosition, viewBounds, and setting zoom as a property are all
unavailable or broken. The script works around this by:

  1. Using parentPage to reliably identify the page containing the selection
  2. Calling zoom(ZoomOptions.FIT_PAGE) to establish a zoom reference
  3. Reading layoutWindows[0].zoomPercentage (the only working zoom API)
  4. Calculating the target zoom from the page/selection size ratio
  5. Setting zoomPercentage — InDesign automatically centers on the active selection

This centering behavior (InDesign centers zoom changes on the current selection)
is the key that makes the whole thing work.

Author

luc / lucdesign Vienna
Developed April 2025 with Claude (Anthropic) after considerable API archaeology.

License

Do whatever you want with it.

Author's note:

This was made with A LOT of help from AI.

About

Just zoom to your current selection vie shortcut.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages