mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 13:08:07 -06:00
ScriptUI: a drag keeps its control past the window edge; MouseEvent.buttons (#2584)
A drag that started on a script control stopped at the window edge: moves outside were dropped and a release outside never reached the control. While a button is held, the control it was pressed on now gets the moves (with screen and control-relative coordinates) and the release, wherever the pointer is, as in After Effects. Every MouseEvent also carries buttons (held: 1 left, 2 right, 4 middle), so a handler can tell a drag from a hover; scriptui.mouse accepts it too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9250a30b37
commit
01f92b04c5
@@ -745,7 +745,8 @@ function __uiMouseWanted(c, inherited) {
|
||||
}
|
||||
|
||||
// A ScriptUI MouseEvent. `v`: {x, y (relative to the target control), button (0 left, 1 middle,
|
||||
// 2 right), detail (click count), screenX, screenY, altKey, ctrlKey, metaKey, shiftKey}.
|
||||
// 2 right), buttons (held: 1 left, 2 right, 4 middle), detail (click count), screenX, screenY,
|
||||
// altKey, ctrlKey, metaKey, shiftKey}.
|
||||
function __uiMouseEvent(type, target, v) {
|
||||
var num = function (x, d) {
|
||||
x = Number(x);
|
||||
@@ -765,6 +766,7 @@ function __uiMouseEvent(type, target, v) {
|
||||
timeStamp: new Date(),
|
||||
detail: num(v.detail, type === "mousemove" || type === "mouseover" || type === "mouseout" ? 0 : 1),
|
||||
button: num(v.button, 0),
|
||||
buttons: num(v.buttons, 0),
|
||||
clientX: num(v.x, 0),
|
||||
clientY: num(v.y, 0),
|
||||
screenX: num(v.screenX, 0),
|
||||
|
||||
Reference in New Issue
Block a user