[Bf-blender-cvs] [9d0777e5144] master: Fix T99368: Annotation lines doesn't start where clicked

Campbell Barton noreply at git.blender.org
Wed Jul 6 13:08:08 CEST 2022


Commit: 9d0777e5144e6d1ee154e03a7cd4272468cdb422
Author: Campbell Barton
Date:   Wed Jul 6 21:04:30 2022 +1000
Branches: master
https://developer.blender.org/rB9d0777e5144e6d1ee154e03a7cd4272468cdb422

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

===================================================================

M	source/blender/editors/gpencil/annotate_paint.c

===================================================================

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)) {



More information about the Bf-blender-cvs mailing list