Clone in a terminal:
Commit 88ccbe2
Johan Mattsson - 2014-07-13T16:54:32+00:00
88ccbe2b4b76cc6c9b50a9acc067e37f0490434djohan.mattsson.m@gmail.com

Move view

Changed files (3)

Diff

diff --git a/libbirdfont/FontDisplay.vala b/libbirdfont/FontDisplay.valaindex 77b036e..ca2bf0f 100644--- a/libbirdfont/FontDisplay.vala+++ b/libbirdfont/FontDisplay.vala@@ -77,7 +77,7 @@ public abstract class FontDisplay : GLib.Object { 	public virtual void zoom_min () { 	} 	-	public virtual void center_at (double x, double y) {+	public virtual void move_view (double x, double y) { 	} 	 	public virtual void reset_zoom () {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 6bb3d99..b653ac5 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -48,7 +48,7 @@ public class Glyph : FontDisplay { 	double zoom_y2 = 0; 	bool zoom_area_is_visible = false; 	-	bool move_view = false;+	bool view_is_moving = false; 	public double move_offset_x = 0; 	public double move_offset_y = 0; @@ -637,7 +637,7 @@ public class Glyph : FontDisplay { 	public override void motion_notify (double x, double y) { 		Tool t = MainWindow.get_toolbox ().get_current_tool (); 		-		if (move_view && KeyBindings.has_ctrl ()) {+		if (view_is_moving && KeyBindings.has_ctrl ()) { 			move_view_offset  (x, y); 			return; 		}@@ -651,7 +651,7 @@ public class Glyph : FontDisplay { 	 	public override void button_release (int button, double ex, double ey) { 		bool line_moving = false;-		move_view = false;+		view_is_moving = false; 		 		foreach (Line line in get_all_help_lines ()) { 			if (!line.set_move (false)) {@@ -722,7 +722,7 @@ public class Glyph : FontDisplay { 		} 			 		if (KeyBindings.has_ctrl ()) {-			move_view = true;+			view_is_moving = true; 			move_offset_x = view_offset_x; 			move_offset_y = view_offset_y; 		} else {@@ -1866,9 +1866,9 @@ public class Glyph : FontDisplay { 		return Font.to_hex_code (unichar_code); 	} 	-	public override void center_at (double x, double y) {-		view_offset_x = view_offset_x + (x - (allocation.width / 2.0) / view_zoom); -		view_offset_y = view_offset_y + (y - (allocation.height / 2.0) / view_zoom);+	public override void move_view (double x, double y) {+		view_offset_x += x / view_zoom; +		view_offset_y += y / view_zoom; 	} } diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex cc20ba8..be1547a 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -34,12 +34,12 @@ public class TabContent : GLib.Object { 		GlyphCanvas.current_display.zoom_out (); 	} 	-	public static void center_at (double x, double y) {+	public static void move_view (double x, double y) { 		if (MenuTab.suppress_event) { 			return; 		} 		-		GlyphCanvas.current_display.center_at (x, y);+		GlyphCanvas.current_display.move_view (x, y); 	} 	 	public static bool has_scrollbar () {

Contact

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