Movalex wrote:Looks like keypress events don't work with borderless windows...
That's unfortunate. The keypress works AFAIK when the window has the foreground input focus. So likely a floating view is persistently on top of things but not considered "in focus"?
I'm just brainstorming here, but potentially you might try using a hybrid approach?
A .fu hotkey entry could be used to switch (toggle) your Toolbar into a "move" window state that would modify the
WindowFlags = {SplashScreen = true, NoDropShadowWindowHint = true, WindowStaysOnTopHint = show_on_top},
settings to add the "stock" window titlebar back temporarily.
Tapping the same hotkey button a 2nd time would then toggle the window back into your borderless mode.
In the longer term, I'm starting to think that it would be cool if you dug through the Fusion native window layout information and worked out the position of the Fusion views in screen pixel coordinates for placement. Then you could have the Toolbar stay locked to the relative position of a specific view.
Thinking out loud, you could possibly use the
ui:Timer()
function set to refresh at a certain rate. Or an "Action Listener v2" like approach could be triggered whenever the artist does something in the visual Fusion session. That could help trigger an update in your toolbar script so it can roughly track your Fusion layout window positioning information so the toolbar refreshes itself and stays locked in place over time as the user resizes and adjusts their Fusion workspace and the window dividers.
Here is an example of the type of screen space (
_sxpos
,
_sypos
) and window space (
_wypos
,
_wxpos
) coordinate data you can get back from a lot of actions that can be listened to in Fusion:
Args =
_sxpos = 569
index = 1
__flags = 1048832
_wypos = 665
_wxpos = 569
_sypos = 737
And at the same time, when a lot of actions trigger you also get some bonus "modifier" keypress information from the
Rets
variable too:
Rets =
modifiers =
MetaModifier = false
ControlModifier = false
ShiftModifier = false
GroupSwitchModifier = false
KeypadModifier = false
AltModifier = false
Also, you could look at the old 2017-08-14 era UI Manager thread "
Editing the FuBox Radial Menu UI Settings" experiment on how the mouse position can be passed from a .fu execute section into the running .lua script:
Execute = [[target:RunScript("$CFG/FuBoxUI.lua", { mousex = args._sxpos, mousey = args._sypos})]],
For a .fu file there are several extra things you can define for a hotkeys entry keypress code like adding
_RELEASED
, or
_REPEAT
, or
_DBLCLICK
to the end of the key name.
You have the following "modifiers" you can add to a keypress code if you are running out of unmapped single key combination hotkeys that are available on your keyboard:
- SHIFT_
- CONTROL_
- ALT_
- META_
- KEYPAD_
- MOUSEMOVE
- MOUSE1_
- MOUSE2_
- MOUSE3_
- MOUSE4_
- MOUSE5_
- MOUSE6_
- MOUSE7_
- MOUSE8_
From looking at some random notes on my hard disk from back in 2017 I saw a tip I got from a little birdie about the possibility of using a mouse-only "hotkey" for things like a smooth view zooming:
Action
{
ID = "View_Zoom_Mode",
Modal = true,
Args =
{
},
Targets =
{
PlayerView =
{
Start = [[ ]],
Enter =
[[
mode:Set("StartZoom", target.Zoom)
mode:Set("OrigX", target.OriginX)
mode:Set("OrigY", target.OriginY)
]],
Execute =
[[
local dx = args._wxpos - mode.EnterPosX
local zoom = (2 ^ (dx * 0.005))
local cx = mode.EnterPosX - target.ViewWidth/2
local cy = mode.EnterPosY - target.ViewHeight/2
target.Zoom = mode:Get("StartZoom") * zoom
target.OriginX = cx + (mode:Get("OrigX") - cx) * zoom
target.OriginY = cy + (mode:Get("OrigY") - cy) * zoom
]],
Exit = [[ ]],
End = [[ ]],
},
},
},
And then you could use a pair of mouse button interaction based event/modifier based hotkeys entries like this:
-- Mouse button 1 & 3
MOUSE3_MOUSE1_RELEASED = "View_Zoom_Relative{ scale = 1.414, mouse = true }",
-- Mouse Button 2 & 3
MOUSE3_MOUSE2_RELEASED = "View_Zoom_Relative{ scale = 0.707, mouse = true }",
or even this is a possbible hotkeys entry kind of option:
MOUSE1_MOUSE3_MOUSEMOVE = "View_Zoom_Mode",
I haven't tested the above code in like 2 years so my memory is hazy with any issues that might come up from that approach.
