diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-06 14:04:30 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-07-06 14:07:29 +0300 |
commit | 9d0777e5144e6d1ee154e03a7cd4272468cdb422 (patch) | |
tree | dbd6ad4bd8d7ff5ae4e12baa8a0131bfd4cd6728 /source/blender/editors/gpencil/annotate_paint.c | |
parent | da852457040827f734287d7db98208e998cb3af6 (diff) |
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]: b8960267dd51f9108b3b49e9b762e6b4d35ae1dc
Diffstat (limited to 'source/blender/editors/gpencil/annotate_paint.c')
-rw-r--r-- | source/blender/editors/gpencil/annotate_paint.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index dd935e4f5f5..2d613e2f433 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -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)) { |