Skip to content

Commit

Permalink
trying to make zooming stay centered
Browse files Browse the repository at this point in the history
  • Loading branch information
Mortis69 committed May 17, 2014
1 parent 99155f1 commit 85e4aa0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion View.cxx
Expand Up @@ -21,6 +21,14 @@ int View::handle(int event)
{
mousex = Fl::event_x() - x() - 1;
mousey = Fl::event_y() - y() - 2;
if(mousex < 0)
mousex = 0;
if(mousex > w() - 1)
mousex = w() - 1;
if(mousey < 0)
mousey = 0;
if(mousey > h() - 1)
mousey = h() - 1;
imgx = mousex / zoom + ox;
imgy = mousey / zoom + oy;
int button = Fl::event_button();
Expand Down Expand Up @@ -67,7 +75,6 @@ int View::handle(int event)
return 1;
case FL_MOUSEWHEEL:
moving = 0;
double oldzoom = zoom;
if(Fl::event_dy() >= 0)
{
zoom /= 2;
Expand Down

0 comments on commit 85e4aa0

Please sign in to comment.