Logic - Tracks Zoom/Vertical Zoom
By Nicolas Aparicio @Nicolas_Aparicio
Hi all,
Here is a simple code to quickly setup the "Tracks Zoom" in Logic Pro. Can be used by defining the "height" or using a popup search if "height" is undefined.
I've also added this to "🔸NIC'S LOGIC BAG OF SURPRISES, ready to use.
Cheers,
Nic.
/**
* @param {Object} [args]
* @param {"Mini"|"Small"|"Medium"|"Large"|"Fit to Window"} [args.height]
*/
function setTracksZoom({ height } = {}) {
function resetTracksHeight() {
const trackSplitter = sf.ui.logic.selectedTrack.children.whoseRole.is("AXSplitter").whoseDescription.is("Individual Track Zoom").first;
trackSplitter.checkboxSet({ targetValue: 'Toggle', onError: 'Continue' });
}
sf.ui.logic.appActivate();
const heightValues = [
{ name: "Mini", value: 0 },
{ name: "Small", value: 25 },
{ name: "Medium", value: 50 },
{ name: "Large", value: 75 },
{ name: "Fit to Window", value: 100 },
]
let selectedHeight;
if (height === undefined) {
selectedHeight = sf.interaction.popupSearch({
items: heightValues.map(i => ({ name: i.name, value: i.value })),
}).item;
sf.wait({ intervalMs: 100 }); // Wait for popup to close
} else {
selectedHeight = heightValues.filter(i => i.name === height)[0];
}
resetTracksHeight();
const slider = sf.ui.logic.mainWindow
.groups.whoseDescription.is("Tracks").first
.groups.whoseDescription.is("Tracks").first
.sliders.whoseDescription.is("Vertical Zoom").first
.children.whoseRole.is("AXValueIndicator").first;
slider.value.doubleValue = selectedHeight.value / 100;
slider.mouseClickElement(); // Ensure value
}