Skip to content

Commit

Permalink
fix scroll center after #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ivictbor committed Aug 18, 2017
1 parent 8e39cf6 commit be759f8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -652,8 +652,8 @@ class PainterroProc {
this.colorPicker.handleMouseMove(e);
this.zoomHelper.handleMouseMove(e);
this.curCord = [
(e.clientX - this.toolContainer.documentOffsetLeft) + this.scroller.scrollLeft,
(e.clientY - this.toolContainer.documentOffsetTop) + this.scroller.scrollTop,
(e.clientX - this.wrapper.documentOffsetLeft) + this.scroller.scrollLeft,
(e.clientY - this.wrapper.documentOffsetTop) + this.scroller.scrollTop,
];
const scale = this.getScale();
this.curCord = [this.curCord[0] * scale, this.curCord[1] * scale];
Expand Down Expand Up @@ -690,9 +690,9 @@ class PainterroProc {
this.select.adjustPosition();
if (this.zoom) {
this.scroller.scrollLeft = (this.curCord[0] / this.getScale()) -
(e.clientX - this.toolContainer.documentOffsetLeft);
(e.clientX - this.wrapper.documentOffsetLeft);
this.scroller.scrollTop = (this.curCord[1] / this.getScale()) -
(e.clientY - this.toolContainer.documentOffsetTop);
(e.clientY - this.wrapper.documentOffsetTop);
}
e.preventDefault();
}
Expand Down

0 comments on commit be759f8

Please sign in to comment.