Hi @chrscheuer & @Kitch
There seems to be an issue in selecting the popup menu for track size in the latest version 5.7.1, which was a similar issue that happen in 5.7.0 when selecting a tracks titleButton
popup menu (seems fixed in 5.7.1) where it deselects the selected track which then results in it failing to open up the popup menu to select the track size.
cheers
Mitch
function trackSize({ sizeOfTracks }) {
var selectedTrack = sf.ui.proTools.selectedTrack
var f = selectedTrack.frame;
selectedTrack.trackScrollToView();
var popupMenu = selectedTrack.popupMenuOpenFromElement({
relativePosition: { x: f.w - 10, y: 5 },
isOption: true,
}).popupMenu;
popupMenu.menuClickPopupMenu({
menuPath: [sizeOfTracks]
});
};
trackSize({ sizeOfTracks: 'small' });
- Christian Scheuer @chrscheuer2024-03-17 02:25:52.742Z
Hi Mitch,
You will need to specify the
anchor
property and set it to'TopLeft'
, as such:var popupMenu = selectedTrack.popupMenuOpenFromElement({ relativePosition: { x: f.w - 10, y: 5 }, anchor: 'TopLeft', isOption: true, }).popupMenu;
Christian Scheuer @chrscheuer2024-03-17 02:26:50.414Z
The longer reply: We changed
popupMenuOpenFromElement
to by default click on the center of the element. By specifying the anchor property, you're overriding that behavior to go back to what it used to be (top left corner, which your relative position calculation here depends on)Christian Scheuer @chrscheuer2024-03-17 02:28:21.229Z
Note, this also means you can now write the entire script more simply like this:
var selectedTrack = sf.ui.proTools.selectedTrack; selectedTrack.trackScrollToView(); selectedTrack.popupMenuSelect({ relativePosition: { x: -10, y: 0 }, anchor: 'MidRight', isOption: true, menuPath: ['small'], });
Mitch Willard @Mitch_Willard
Cheers for that @chrscheuer, too easy! Super simple fix.
- In reply tochrscheuer⬆:
Mitch Willard @Mitch_Willard
Hey @chrscheuer,
This is working perfect. Thanks for this.
Though now, we have a few scripts that will fetch the current size of the track using
.popupMenuFetchAllItems()
to return it to that size after a script which doesn't have the option toanchor
the mouse click to open up the track size. Will this be getting added?I tried using the tracks
frame
but to no luck, even though it places the mouse in the correct position.var selectedTrack = sf.ui.proTools.selectedTrack var currentTrackSize = selectedTrack.popupMenuFetchAllItems({ relativePosition: { x: selectedTrack.frame.w, y: selectedTrack.frame.y + 5 }, }).menuItems.filter(mi => mi.element.isMenuChecked)[0].names[0]; log(currentTrackSize)
Christian Scheuer @chrscheuer2024-03-18 01:16:17.074Z
Thanks! I'll add
anchor
topopupMenuFetchAllItems
in SF 5.7.5 :)Mitch Willard @Mitch_Willard
awesome @chrscheuer ! you're the best!
- DIn reply toMitch_Willard⬆:Dean Landon @Dean
Hi Christian,
I tried this script:
var selectedTrack = sf.ui.proTools.selectedTrack;
selectedTrack.trackScrollToView();
selectedTrack.popupMenuSelect({
relativePosition: { x: -10, y: 0 },
anchor: 'MidRight',
isOption: true,
menuPath: ['small'],
});...but after running it, all my tracks are small. Any way of selecting certain tracks so that only the ones high-lighted are small?
Thanks!
Mitch Willard @Mitch_Willard
Here you go @Dean
function trackSizeSelectedTracks({ sizeOfTracks }) { var selectedTrack = sf.ui.proTools.selectedTrack selectedTrack.trackScrollToView(); selectedTrack.popupMenuSelect({ relativePosition: { x: -10, y: 0 }, anchor: 'MidRight', isOption: true, isShift: true, menuPath: [sizeOfTracks], }); }; trackSizeSelectedTracks({ sizeOfTracks: 'small' });
- DIn reply toMitch_Willard⬆:Dean Landon @Dean
Thank you Mitch. Works like a charm.