Old 01-26-2021, 01:47 AM   #1
Rodilab
Human being with feelings
 
Rodilab's Avatar
 
Join Date: Jan 2021
Location: Paris
Posts: 255
Default Left-edge or rigth-edge click

Hi !

How do I know which edge I clicked on with ReaScript ?

I would like to create a script to "double click on item edge" mouse modifier.
But there is no distinction between left and right edge. And my script has to do different things if I click on left or right este.
How can I do it ?

Thx
Rodilab is offline   Reply With Quote
Old 01-26-2021, 02:59 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

https://mespotin.uber.space/Ultrasch...eCursorContext
https://mespotin.uber.space/Ultrasch...ntext_Position
https://mespotin.uber.space/Ultrasch...tItemFromPoint

These three allow you to get the item and the projectposition.
Just check, if the position is close the left or right edge of the item(left: item start, right: item start+length).

To get itemposition and length, use this:
https://mespotin.uber.space/Ultrasch...ItemInfo_Value
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 01-26-2021, 03:23 PM   #3
amagalma
Human being with feelings
 
amagalma's Avatar
 
Join Date: Apr 2011
Posts: 3,458
Default

I had to fight with Reaper in order to make this work with my script

You can't always get the item using ItemFromPoint when you are over an edge.

Best API to use is GetItemEditingTime, but it does not return the item.. You have to find it yourself... (iterate on all items on the track under the mouse cursor and compare each item's start and end position to the returned position)
Code:
track_under_mouse = reaper.GetTrackFromPoint( reaper.GetMousePosition() )
position, pcm_source, flags = reaper.GetItemEditingTime2()
etc...
__________________
Most of my scripts can be found in ReaPack.
If you find them useful, a donation would be greatly appreciated! Thank you! :)

Last edited by amagalma; 01-26-2021 at 03:30 PM.
amagalma is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.