Browse Source

fix position of pointer in brush tool and eraser pointer

pull/6/head
Casper Lamboo 4 years ago
parent
commit
ac2256d2c5
  1. 3
      src/d2/EraserPointer.js
  2. 3
      src/d2/tools/BrushTool.js

3
src/d2/EraserPointer.js

@ -1,6 +1,7 @@
import { Vector } from 'cal';
import transposeEvents from '../utils/transposeEvents.js';
import { PIXEL_RATIO } from '../constants/general.js';
import { convertEvent } from '../utils/pointerUtils.js';
// import createDebug from 'debug';
// const debug = createDebug('d3d:design:EraserPointer');
@ -28,7 +29,7 @@ export default class EraserPointer {
pointerMove(event) {
this.showMouse = event.pointerType === 'mouse';
if (this.erasing || this.showMouse) {
this.mousePosition.set(event.clientX, event.clientY);
this.mousePosition.copy(convertEvent(event.target, event));
if (this.onChanged) this.onChanged();
}
}

3
src/d2/tools/BrushTool.js

@ -1,6 +1,7 @@
import BaseTool from './BaseTool.js';
import { Vector } from 'cal';
import { PIXEL_RATIO } from '../../constants/general.js';
import { convertEvent } from '../../utils/pointerUtils.js';
// import createDebug from 'debug';
// const debug = createDebug('d3d:2d:tool:eraser');
export default class BrushTool extends BaseTool {
@ -14,7 +15,7 @@ export default class BrushTool extends BaseTool {
pointerMove(event) {
this.showMouse = event.pointerType === 'mouse';
if (this.showMouse) {
this.mousePosition.set(event.clientX, event.clientY);
this.mousePosition.copy(convertEvent(event.target, event));
this.renderRequest();
}
}

Loading…
Cancel
Save