Skip to content

Commit

Permalink
v1.0.0-alpha.9, fix zooming when container placed not at the top of page
Browse files Browse the repository at this point in the history
  • Loading branch information
Ni55aN committed Aug 29, 2018
1 parent dc8d58d commit 98a601f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rete",
"version": "1.0.0-alpha.8",
"version": "1.0.0-alpha.9",
"description": "JavaScript framework",
"main": "build/rete.min.js",
"types": "src/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions src/view/zoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ export class Zoom {
var rect = this.el.getBoundingClientRect();
var delta = (e.wheelDelta ? e.wheelDelta / 120 : - e.deltaY / 3) * this.intensity;

var ox = (rect.left - e.pageX) * delta;
var oy = (rect.top - e.pageY) * delta;
var ox = (rect.left - e.clientX) * delta;
var oy = (rect.top - e.clientY) * delta;

this.onzoom(delta, ox, oy);
}

touches(e) {

let [x1, y1] = [e.touches[0].pageX, e.touches[0].pageY];
let [x2, y2] = [e.touches[1].pageX, e.touches[1].pageY];
let [x1, y1] = [e.touches[0].clientX, e.touches[0].clientY];
let [x2, y2] = [e.touches[1].clientX, e.touches[1].clientY];
let distance = Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));

return {
Expand Down

0 comments on commit 98a601f

Please sign in to comment.