From 6da4b4ee662f21a3991e3bdd851c820a288f201e Mon Sep 17 00:00:00 2001 From: amagalma Date: Wed, 3 Dec 2025 11:30:24 +0200 Subject: [PATCH] Release Scroll the arrange view to the top of the track lane or envelope under the mouse cursor v1.00 --- ...ane or envelope under the mouse cursor.lua | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 View/amagalma_Scroll the arrange view to the top of the track lane or envelope under the mouse cursor.lua diff --git a/View/amagalma_Scroll the arrange view to the top of the track lane or envelope under the mouse cursor.lua b/View/amagalma_Scroll the arrange view to the top of the track lane or envelope under the mouse cursor.lua new file mode 100644 index 000000000..dc9525d86 --- /dev/null +++ b/View/amagalma_Scroll the arrange view to the top of the track lane or envelope under the mouse cursor.lua @@ -0,0 +1,34 @@ +-- @description Scroll the arrange view to the top of the track lane or envelope under the mouse cursor +-- @author amagalma +-- @version 1.00 +-- @donation https://www.paypal.me/amagalma + +if not reaper.CF_SetTcpScroll then + return reaper.MB( "Please, install / update SWS.", "Missing CF_SetTcpScroll API", 0 ) +end + +local x, y = reaper.GetMousePosition() +local track, info = reaper.GetTrackFromPoint( x, y ) + +if not track then return end + +local function Info( str ) + return reaper.GetMediaTrackInfo_Value( track, str ) +end + +local position = 0 + +if info == 1 then + reaper.BR_GetMouseCursorContext() + local env, isTakeEnvelope = reaper.BR_GetMouseCursorContext_Envelope() + if not isTakeEnvelope then + position = reaper.GetEnvelopeInfo_Value( env, "I_TCPY_USED" ) + end +else + local lane = info >> 8 + if lane > 0 and Info("C_LANESCOLLAPSED") == 0 then + position = ( ( Info("I_TCPH") - 18 )/ Info("I_NUMFIXEDLANES") ) * lane - 1 + end +end + +reaper.CF_SetTcpScroll( track, position )