firefox needs e.pageX not e.x (#906)
This commit is contained in:
parent
f516e1e73d
commit
9ad4684825
1 changed files with 4 additions and 4 deletions
|
@ -2477,8 +2477,8 @@ Extras.Classes.Navigation = new Class({
|
||||||
sy = this.canvas.scaleOffsetY;
|
sy = this.canvas.scaleOffsetY;
|
||||||
|
|
||||||
//Basically this is just a duplication of the Util function pixelsToCoords, it finds the canvas coordinate of the mouse pointer
|
//Basically this is just a duplication of the Util function pixelsToCoords, it finds the canvas coordinate of the mouse pointer
|
||||||
var pointerCoordX = (e.x - p.x - s.width / 2 - ox) * (1 / sx),
|
var pointerCoordX = (e.pageX - p.x - s.width / 2 - ox) * (1 / sx),
|
||||||
pointerCoordY = (e.y - p.y - s.height / 2 - oy) * (1 / sy);
|
pointerCoordY = (e.pageY - p.y - s.height / 2 - oy) * (1 / sy);
|
||||||
|
|
||||||
//This translates the canvas to be centred over the mouse pointer, then the canvas is zoomed as intended.
|
//This translates the canvas to be centred over the mouse pointer, then the canvas is zoomed as intended.
|
||||||
this.canvas.translate(-pointerCoordX,-pointerCoordY);
|
this.canvas.translate(-pointerCoordX,-pointerCoordY);
|
||||||
|
@ -2491,8 +2491,8 @@ Extras.Classes.Navigation = new Class({
|
||||||
oy = this.canvas.translateOffsetY,
|
oy = this.canvas.translateOffsetY,
|
||||||
sx = this.canvas.scaleOffsetX,
|
sx = this.canvas.scaleOffsetX,
|
||||||
sy = this.canvas.scaleOffsetY;
|
sy = this.canvas.scaleOffsetY;
|
||||||
var newX = (e.x - p.x - s.width / 2 - ox) * (1 / sx),
|
var newX = (e.pageX - p.x - s.width / 2 - ox) * (1 / sx),
|
||||||
newY = (e.y - p.y - s.height / 2 - oy) * (1 / sy);
|
newY = (e.pageY - p.y - s.height / 2 - oy) * (1 / sy);
|
||||||
|
|
||||||
//Translate the canvas to put the pointer back over top the same coordinate it was over before
|
//Translate the canvas to put the pointer back over top the same coordinate it was over before
|
||||||
this.canvas.translate(newX-pointerCoordX,newY-pointerCoordY);
|
this.canvas.translate(newX-pointerCoordX,newY-pointerCoordY);
|
||||||
|
|
Loading…
Reference in a new issue