On Windows (but I suppose also on Mac and Linux), holding Alt button and drag with Mouse (Left button), by default it moves the whole Window.
I’d like to bypass this behaviour if I hold Alt and drag with Mouse (Left button) on a specific Rect of my module plot (easily defined by nvgRect(args.vg, x, y, w, h)).
Yes, it’s easy to do. I did it in my ancient Seq++. Make sure you really want to do it, however. I found it rather difficult to get used to, at least for my application. One of the reasons I ended up putting in a key re-mapping feature.
This way, pressing “alt” within the plot and than leftclick mouse button to “drag” an element in the plot, should avoid Rack on move the window, but it still moves it around…
Am I missing somethings other? Maybe onDragStart/Move etc?
I’m not sure, it’s been so long since I’ve looked at that. Seq++ was written for rack version 0.6! But I think that may be all you need to do. It’s also been a while since I’ve dragged things. So…. ?
seems strange, if that code bypasses racks ctrl behavior and other behaviors. But I haven’t tried it in a long time - for all I know it doesn’t work any more. I’d try normal debugging techniques, but don’t really have any more to tell you.
Update: just tried it with the version in the library. control keys work fine. If you don’t want to figure it out yourself, you could build that module and try modifying it for alt key…
I could
I’m not able to emulate the behaviour though: what should I do? Is the CTRL (i.e. bypass rack zoom) that is handled differently right? Can’t make it works on the Seq++… sequencer?
Not on “onHover” method. So I see it always itercept that line before my onButton method.
This way, it seems that probably its not feasible? Not sure I can place myself “before” the onButton method.
This comment// Handle Alt-click before children, since most widgets consume Alt-click without needing to. and that return make me think won’t be possible…
Interesting. I guess if you could somehow get that on button first, but you would probably have to make some widget be a child or rack itself. Don’t know if that’s possible or not. Maybe someone else will…
I fear neither this will work. Tried to do this (so appending a widget to rack on top, follow @stoermelder trick on Stroke):
APP->scene->rack->addChild(new Test());
But it still call ScrollWidget widgets methods first (so its onButton(), which will consume and return). Using addChildBottom instead seems the same (it intercepts always ScrollWidget first).