Clone in a terminal:
Commit 6adb769
Johan Mattsson - 2015-10-30T11:00:32+00:00
6adb769469f5d54014db7ba5208133beb7fd4467johan.mattsson.m@gmail.com

Fix scroll in overview on Mac OS

Changed files (2)

Diff

diff --git a/libbirdfont/AbstractMenu.vala b/libbirdfont/AbstractMenu.valaindex ef72232..2077e58 100644--- a/libbirdfont/AbstractMenu.vala+++ b/libbirdfont/AbstractMenu.vala@@ -77,18 +77,19 @@ public class AbstractMenu : GLib.Object { 		ToolItem tm; 		unichar lower_keyval = ((unichar) keyval).tolower (); 		+        display = current_display.get_name ();++        if (current_display is Glyph) {+            display = "Glyph";+        }+         		foreach (MenuItem item in sorted_menu_items) {		-			if (item.key.tolower () == lower_keyval && item.modifiers == KeyBindings.modifier) {+			if (item.key.tolower () == lower_keyval+                && item.modifiers == KeyBindings.modifier+                && item.in_display (display)) { 				-				display = current_display.get_name ();--				if (current_display is Glyph) {-					display = "Glyph";-				}- 				if (!current_display.needs_modifier () || item.modifiers != NONE) { 					if (!SettingsDisplay.update_key_bindings -						&& item.in_display (display) 						&& !(item is ToolItem)) { 						item.action (); 						return;diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 844c756..ff0831a 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -304,23 +304,36 @@ public class OverView : FontDisplay { 		return true; 	} +    public bool all_characters_in_view () {+		double length;+		Font f;+        +		if (all_available) {+			f = BirdFont.get_current_font ();+			length = f.length ();+		} else {+			length = glyph_range.length ();+		}+        +        return length < items_per_row * rows;+    }+     	public void move_up () { 		first_visible -= items_per_row; 		selected += items_per_row; 		 		if (first_visible < 0) {+            selected -= items_per_row; 			first_visible = 0; 			view_offset_y = 0;-			-			while (selected < 0) {-				selected += items_per_row;-			}-		}+        } 	}  	public void move_down () {-		first_visible += items_per_row;-		selected -= items_per_row;+        if (!at_bottom ()) {+            first_visible += items_per_row;+            selected -= items_per_row;+        } 	} 	 	public override void scroll_wheel (double x, double y, double dx, double dy) {@@ -335,18 +348,22 @@ public class OverView : FontDisplay { 			}						 		} else { 			if (at_bottom ()) {-				if (view_offset_y > -2 * OverViewItem.height) {+				if (view_offset_y > -2 * OverViewItem.height && !all_characters_in_view ()) { 					view_offset_y += pixel_delta; 				} 			} else { 				view_offset_y += pixel_delta; 				while (view_offset_y < -OverViewItem.height) {-					view_offset_y += OverViewItem.height;-					move_down ();+                    view_offset_y += OverViewItem.height;+                    move_down (); 				} 			} 		}-		+                +        if (view_offset_y < -2 * OverViewItem.height) {+            view_offset_y = -2 * OverViewItem.height;+        }+         		update_item_list (); 		update_scrollbar (); 		hide_menu ();	@@ -450,6 +467,7 @@ public class OverView : FontDisplay { 	public void display_all_available_glyphs () { 		all_available = true; +        view_offset_y = 0; 		first_visible = 0; 		selected = 0; 		@@ -699,7 +717,8 @@ public class OverView : FontDisplay { 	public void scroll_top () { 		selected = 0; 		first_visible = 0;-		+		view_offset_y = 0;+         		update_item_list (); 		 		if (visible_items.size != 0) {

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112