Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing mousemove x/y tracking when the dom is in a scroll capable window #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/floorplanner/floorplanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module BP3D.Floorplanner {
/** how much will we move a corner to make a wall axis aligned (cm) */
const snapTolerance = 25;

/**
/**
* The Floorplanner implements an interactive tool for creation of floorplans.
*/
export class Floorplanner {
Expand Down Expand Up @@ -174,8 +174,8 @@ module BP3D.Floorplanner {
this.rawMouseX = event.clientX;
this.rawMouseY = event.clientY;

this.mouseX = (event.clientX - this.canvasElement.offset().left) * this.cmPerPixel + this.originX * this.cmPerPixel;
this.mouseY = (event.clientY - this.canvasElement.offset().top) * this.cmPerPixel + this.originY * this.cmPerPixel;
this.mouseX = (event.clientX - this.canvasElement.offset().left + event.view.scrollX) * this.cmPerPixel + this.originX * this.cmPerPixel;
this.mouseY = (event.clientY - this.canvasElement.offset().top + event.view.scrollY) * this.cmPerPixel + this.originY * this.cmPerPixel;

// update target (snapped position of actual mouse)
if (this.mode == floorplannerModes.DRAW || (this.mode == floorplannerModes.MOVE && this.mouseDown)) {
Expand Down Expand Up @@ -295,4 +295,4 @@ module BP3D.Floorplanner {
return (y - this.originY * this.cmPerPixel) * this.pixelsPerCm;
}
}
}
}