ajwillia-ms pushed a commit to branch master.

http://git.enlightenment.org/apps/terminology.git/commit/?id=ca96a35da73a3d6577885d5b0c129a1af0888465

commit ca96a35da73a3d6577885d5b0c129a1af0888465
Author: Andy Williams <a...@andywilliams.me>
Date:   Fri Jan 29 14:15:13 2016 +0000

    [zoom] Smooth the scaling of fonts when zooming
    
    Capture font size when gesture begins and correctly
    update scale based off that until gesture ends.
    
    Test plan:
    1) hold Ctrl and scroll the mouse wheel in then out
    in a single motion
    2) notice zooming continues in initial direction
    and accelerates towards the min or max
    
    With patch it will adjust more smoothly and also
    match the current zoom of the gesture.
    
    @fix
---
 src/bin/termio.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index ae2f131..57f99ea 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -93,6 +93,7 @@ struct _Termio
    unsigned char bottom_right : 1;
    unsigned char top_left : 1;
    unsigned char reset_sel : 1;
+   double gesture_zoom_start_size;
 };
 
 #define INT_SWAP(_a, _b) do {    \
@@ -4595,6 +4596,7 @@ _smart_cb_gest_zoom_start(void *data, void *event)
    config = sd->config;
    if (config)
      {
+        sd->gesture_zoom_start_size = (double)config->font.size;
         int sz = (double)config->font.size * p->zoom;
         sd->zoom_fontsize_start = config->font.size;
         if (sz != config->font.size)
@@ -4615,7 +4617,7 @@ _smart_cb_gest_zoom_move(void *data, void *event)
    config = sd->config;
    if (config)
      {
-        int sz = (double)config->font.size * p->zoom;
+        int sz = sd->gesture_zoom_start_size * p->zoom;
         if (sz != config->font.size)
           win_font_size_set(term_win_get(sd->term), sz);
      }
@@ -4634,7 +4636,8 @@ _smart_cb_gest_zoom_end(void *data, void *event)
    config = sd->config;
    if (config)
      {
-        int sz = (double)config->font.size * p->zoom;
+        int sz = sd->gesture_zoom_start_size * p->zoom;
+        sd->gesture_zoom_start_size = 0.0;
         if (sz != config->font.size)
           win_font_size_set(term_win_get(sd->term), sz);
      }

-- 


Reply via email to