Skip to content

Commit

Permalink
Fixed zoom in & zoom out issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vikash sharma committed Feb 5, 2020
1 parent 590a62b commit b7a000e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion dev/zoom-handler.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
var zoomHandler = {
scale: 1.0,
lastZoomState: null,
up: function(e) {
this.scale = this.lastZoomState !== 'up' ? 1 : this.scale;
this.scale += .01;
this.lastZoomState = 'up';
this.apply();
},
down: function(e) {
this.scale = this.lastZoomState !== 'down' ? 1 : this.scale;
this.scale -= .01;
this.lastZoomState = 'down';
this.apply();
},
apply: function() {
Expand All @@ -20,7 +25,7 @@ var zoomHandler = {
},
down: function(ctx) {
ctx.font = '22px Verdana';
ctx.strokeText('-', 15, 30);
ctx.strokeText('-', 10, 30);
}
}
};

0 comments on commit b7a000e

Please sign in to comment.