Here’s the thing - we can’t have the player controller do anything here; widgets and the controller do not like talking to each other and often don’t know what the other is doing with the input.
Here are my wWindow’s Up / Down events for left mouse button:
Above, the Grab Offset is where we clicked in that window - it’s later on used when we move it around. When grabbed, the window calls an event dispatcher that is picked up by main canvas where we drag the windows.
Below, onMouseUp calls the dispatcher, informing the main canvas that we no longer wish to drag the window.
Here’s my main canvas - wScreen - where the windows are added and the dragging happens:
The top bit creates a bunch of windows and registers the above-mentioned event dispatcher. That event tells the main canvas (wScreen) that a new windows needs dragging. A reference to that window is created and we give it higher Z so it stays on top of other windows.
We need to know where the cursor is in the main canvas as well. For this, I’m overriding onMouseMove:
Tick will move the window using its reference. The final location is calculated by subtracting the Grab Offset from the Local Screen Position produced by the override above.