[Bf-blender-cvs] [a5d5f152dd3] master: Fix T63681: bad clipping of very long tooltips

Brecht Van Lommel noreply at git.blender.org
Sun Apr 21 01:25:35 CEST 2019


Commit: a5d5f152dd317b4d39c112da36bce34d40fa7120
Author: Brecht Van Lommel
Date:   Sun Apr 21 01:22:07 2019 +0200
Branches: master
https://developer.blender.org/rBa5d5f152dd317b4d39c112da36bce34d40fa7120

Fix T63681: bad clipping of very long tooltips

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

M	source/blender/blenlib/intern/rct.c

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

diff --git a/source/blender/blenlib/intern/rct.c b/source/blender/blenlib/intern/rct.c
index 2723e1708cb..0cf3e928f7c 100644
--- a/source/blender/blenlib/intern/rct.c
+++ b/source/blender/blenlib/intern/rct.c
@@ -700,6 +700,9 @@ bool BLI_rcti_clamp_pt_v(const rcti *rect, int xy[2])
 /**
  * Clamp \a rect within \a rect_bounds, setting \a r_xy to the offset.
  *
+ * Keeps the top left corner within the bounds, which for user interface
+ * elements is typically where the most important information is.
+ *
  * \return true if a change is made.
  */
 bool BLI_rctf_clamp(rctf *rect, const rctf *rect_bounds, float r_xy[2])
@@ -709,16 +712,16 @@ bool BLI_rctf_clamp(rctf *rect, const rctf *rect_bounds, float r_xy[2])
   r_xy[0] = 0.0f;
   r_xy[1] = 0.0f;
 
-  if (rect->xmin < rect_bounds->xmin) {
-    float ofs = rect_bounds->xmin - rect->xmin;
+  if (rect->xmax > rect_bounds->xmax) {
+    float ofs = rect_bounds->xmax - rect->xmax;
     rect->xmin += ofs;
     rect->xmax += ofs;
     r_xy[0] += ofs;
     changed = true;
   }
 
-  if (rect->xmax > rect_bounds->xmax) {
-    float ofs = rect_bounds->xmax - rect->xmax;
+  if (rect->xmin < rect_bounds->xmin) {
+    float ofs = rect_bounds->xmin - rect->xmin;
     rect->xmin += ofs;
     rect->xmax += ofs;
     r_xy[0] += ofs;
@@ -751,16 +754,16 @@ bool BLI_rcti_clamp(rcti *rect, const rcti *rect_bounds, int r_xy[2])
   r_xy[0] = 0;
   r_xy[1] = 0;
 
-  if (rect->xmin < rect_bounds->xmin) {
-    int ofs = rect_bounds->xmin - rect->xmin;
+  if (rect->xmax > rect_bounds->xmax) {
+    int ofs = rect_bounds->xmax - rect->xmax;
     rect->xmin += ofs;
     rect->xmax += ofs;
     r_xy[0] += ofs;
     changed = true;
   }
 
-  if (rect->xmax > rect_bounds->xmax) {
-    int ofs = rect_bounds->xmax - rect->xmax;
+  if (rect->xmin < rect_bounds->xmin) {
+    int ofs = rect_bounds->xmin - rect->xmin;
     rect->xmin += ofs;
     rect->xmax += ofs;
     r_xy[0] += ofs;



More information about the Bf-blender-cvs mailing list