[Bf-blender-cvs] [15fb122008e] filebrowser_redesign: Fix background pattern not scrolling with view

Julian Eisel noreply at git.blender.org
Thu Jul 25 01:55:45 CEST 2019


Commit: 15fb122008e9e247637ad8dbb9a2a499195a7904
Author: Julian Eisel
Date:   Thu Jul 25 00:45:02 2019 +0200
Branches: filebrowser_redesign
https://developer.blender.org/rB15fb122008e9e247637ad8dbb9a2a499195a7904

Fix background pattern not scrolling with view

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

M	source/blender/editors/space_file/file_draw.c

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

diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 25874145cc9..0f93bba4591 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -610,6 +610,7 @@ static void renamebutton_cb(bContext *C, void *UNUSED(arg1), char *oldname)
 
 static void draw_background(FileLayout *layout, View2D *v2d)
 {
+  const int item_height = layout->tile_h + (2 * layout->tile_border_y);
   int i;
   int sy;
 
@@ -619,8 +620,10 @@ static void draw_background(FileLayout *layout, View2D *v2d)
 
   /* alternating flat shade background */
   for (i = 2; (i <= layout->rows + 1); i += 2) {
-    sy = (int)v2d->cur.ymax - layout->offset_top -
-         i * (layout->tile_h + 2 * layout->tile_border_y) - layout->tile_border_y;
+    sy = (int)v2d->cur.ymax - layout->offset_top - i * item_height - layout->tile_border_y;
+
+    /* Offsett pattern slightly to add scroll effect. */
+    sy += round_fl_to_int(item_height * (v2d->tot.ymax - v2d->cur.ymax) / item_height);
 
     immRectf(pos,
              v2d->cur.xmin,



More information about the Bf-blender-cvs mailing list