diff options
author | Campbell Barton <campbell@blender.org> | 2022-07-06 14:04:30 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2022-07-15 15:51:14 +0300 |
commit | cc5868234444098468f94aa7106c63ec3a386f28 (patch) | |
tree | b52e44c514403e7e0a6fec4f7b4163cbfe20fc9a /source | |
parent | 3d6f6715595ea48004132d934c21f75eac85f51d (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')
-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 8c393cc4f3f..2cae864d47f 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)) { |