Fix T99368: Annotation lines doesn't start where clicked

Caused by [0] which made accessing the drag-start require a function
instead of being the value written into the event cursor coordinates.

[0]: b8960267dd
This commit is contained in:
Campbell Barton 2022-07-06 21:04:30 +10:00
parent da85245704
commit 9d0777e514
Notes: blender-bot 2023-02-14 00:44:02 +01:00
Referenced by issue #99368, Regression: Annotation lines doesn't start where clicked
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
1 changed files with 12 additions and 5 deletions

View File

@ -2062,11 +2062,18 @@ static void annotation_draw_apply_event(
PointerRNA itemptr;
float mousef[2];
/* convert from window-space to area-space mouse coordinates
* add any x,y override position for fake events
*/
p->mval[0] = (float)event->mval[0] - x;
p->mval[1] = (float)event->mval[1] - y;
/* Convert from window-space to area-space mouse coordinates
* add any x,y override position for fake events. */
if (p->flags & GP_PAINTFLAG_FIRSTRUN) {
/* The first run may be a drag event, see: T99368. */
WM_event_drag_start_mval_fl(event, p->region, p->mval);
p->mval[0] -= x;
p->mval[1] -= y;
}
else {
p->mval[0] = (float)event->mval[0] - x;
p->mval[1] = (float)event->mval[1] - y;
}
/* Key to toggle stabilization. */
if ((event->modifier & KM_SHIFT) && (p->paintmode == GP_PAINTMODE_DRAW)) {