Skip to content

Commit ac2256d

Browse files
committed
fix position of pointer in brush tool and eraser pointer
1 parent b0c0063 commit ac2256d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/d2/EraserPointer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Vector } from 'cal';
22
import transposeEvents from '../utils/transposeEvents.js';
33
import { PIXEL_RATIO } from '../constants/general.js';
4+
import { convertEvent } from '../utils/pointerUtils.js';
45
// import createDebug from 'debug';
56
// const debug = createDebug('d3d:design:EraserPointer');
67

@@ -28,7 +29,7 @@ export default class EraserPointer {
2829
pointerMove(event) {
2930
this.showMouse = event.pointerType === 'mouse';
3031
if (this.erasing || this.showMouse) {
31-
this.mousePosition.set(event.clientX, event.clientY);
32+
this.mousePosition.copy(convertEvent(event.target, event));
3233
if (this.onChanged) this.onChanged();
3334
}
3435
}

src/d2/tools/BrushTool.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import BaseTool from './BaseTool.js';
22
import { Vector } from 'cal';
33
import { PIXEL_RATIO } from '../../constants/general.js';
4+
import { convertEvent } from '../../utils/pointerUtils.js';
45
// import createDebug from 'debug';
56
// const debug = createDebug('d3d:2d:tool:eraser');
67
export default class BrushTool extends BaseTool {
@@ -14,7 +15,7 @@ export default class BrushTool extends BaseTool {
1415
pointerMove(event) {
1516
this.showMouse = event.pointerType === 'mouse';
1617
if (this.showMouse) {
17-
this.mousePosition.set(event.clientX, event.clientY);
18+
this.mousePosition.copy(convertEvent(event.target, event));
1819
this.renderRequest();
1920
}
2021
}

0 commit comments

Comments
 (0)