mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-10-05 11:08:38 +02:00
20 lines
598 B
JavaScript
20 lines
598 B
JavaScript
|
import BaseTool from './BaseTool.js';
|
||
|
import * as actions from '../../actions/index.js';
|
||
|
|
||
|
export default class TextTool extends BaseTool {
|
||
|
constructor(dispatch, sceneSpaceContainer, renderRequest) {
|
||
|
super(dispatch, sceneSpaceContainer, renderRequest);
|
||
|
this.enableHitDetection = true;
|
||
|
}
|
||
|
tap({ position, intersections }) {
|
||
|
const textId = intersections.find(id => this.state.objectsById[id].type === 'TEXT');
|
||
|
|
||
|
this._dispatch(actions.d2textInit, position, textId);
|
||
|
}
|
||
|
update(state) {
|
||
|
if (state === this.state) return;
|
||
|
super.update(state);
|
||
|
this.state = state;
|
||
|
}
|
||
|
}
|