Skip to content

Commit be759f8

Browse files
committed
fix scroll center after #4
1 parent 8e39cf6 commit be759f8

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

js/main.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -652,8 +652,8 @@ class PainterroProc {
652652
this.colorPicker.handleMouseMove(e);
653653
this.zoomHelper.handleMouseMove(e);
654654
this.curCord = [
655-
(e.clientX - this.toolContainer.documentOffsetLeft) + this.scroller.scrollLeft,
656-
(e.clientY - this.toolContainer.documentOffsetTop) + this.scroller.scrollTop,
655+
(e.clientX - this.wrapper.documentOffsetLeft) + this.scroller.scrollLeft,
656+
(e.clientY - this.wrapper.documentOffsetTop) + this.scroller.scrollTop,
657657
];
658658
const scale = this.getScale();
659659
this.curCord = [this.curCord[0] * scale, this.curCord[1] * scale];
@@ -690,9 +690,9 @@ class PainterroProc {
690690
this.select.adjustPosition();
691691
if (this.zoom) {
692692
this.scroller.scrollLeft = (this.curCord[0] / this.getScale()) -
693-
(e.clientX - this.toolContainer.documentOffsetLeft);
693+
(e.clientX - this.wrapper.documentOffsetLeft);
694694
this.scroller.scrollTop = (this.curCord[1] / this.getScale()) -
695-
(e.clientY - this.toolContainer.documentOffsetTop);
695+
(e.clientY - this.wrapper.documentOffsetTop);
696696
}
697697
e.preventDefault();
698698
}

0 commit comments

Comments
 (0)