mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 11:03:48 +01:00
fix position of pointer in brush tool and eraser pointer
This commit is contained in:
parent
b0c0063039
commit
ac2256d2c5
@ -1,6 +1,7 @@
|
|||||||
import { Vector } from 'cal';
|
import { Vector } from 'cal';
|
||||||
import transposeEvents from '../utils/transposeEvents.js';
|
import transposeEvents from '../utils/transposeEvents.js';
|
||||||
import { PIXEL_RATIO } from '../constants/general.js';
|
import { PIXEL_RATIO } from '../constants/general.js';
|
||||||
|
import { convertEvent } from '../utils/pointerUtils.js';
|
||||||
// import createDebug from 'debug';
|
// import createDebug from 'debug';
|
||||||
// const debug = createDebug('d3d:design:EraserPointer');
|
// const debug = createDebug('d3d:design:EraserPointer');
|
||||||
|
|
||||||
@ -28,7 +29,7 @@ export default class EraserPointer {
|
|||||||
pointerMove(event) {
|
pointerMove(event) {
|
||||||
this.showMouse = event.pointerType === 'mouse';
|
this.showMouse = event.pointerType === 'mouse';
|
||||||
if (this.erasing || this.showMouse) {
|
if (this.erasing || this.showMouse) {
|
||||||
this.mousePosition.set(event.clientX, event.clientY);
|
this.mousePosition.copy(convertEvent(event.target, event));
|
||||||
if (this.onChanged) this.onChanged();
|
if (this.onChanged) this.onChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import BaseTool from './BaseTool.js';
|
import BaseTool from './BaseTool.js';
|
||||||
import { Vector } from 'cal';
|
import { Vector } from 'cal';
|
||||||
import { PIXEL_RATIO } from '../../constants/general.js';
|
import { PIXEL_RATIO } from '../../constants/general.js';
|
||||||
|
import { convertEvent } from '../../utils/pointerUtils.js';
|
||||||
// import createDebug from 'debug';
|
// import createDebug from 'debug';
|
||||||
// const debug = createDebug('d3d:2d:tool:eraser');
|
// const debug = createDebug('d3d:2d:tool:eraser');
|
||||||
export default class BrushTool extends BaseTool {
|
export default class BrushTool extends BaseTool {
|
||||||
@ -14,7 +15,7 @@ export default class BrushTool extends BaseTool {
|
|||||||
pointerMove(event) {
|
pointerMove(event) {
|
||||||
this.showMouse = event.pointerType === 'mouse';
|
this.showMouse = event.pointerType === 'mouse';
|
||||||
if (this.showMouse) {
|
if (this.showMouse) {
|
||||||
this.mousePosition.set(event.clientX, event.clientY);
|
this.mousePosition.copy(convertEvent(event.target, event));
|
||||||
this.renderRequest();
|
this.renderRequest();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user