onPointerDown method
dynamic
onPointerDown(
- dynamic event
Implementation
onPointerDown(event) {
if (scope.enabled == false) return;
updatePointer(event);
_intersections.length = 0;
_raycaster.setFromCamera(_pointer, _camera);
_raycaster.intersectObjects(_objects, true, _intersections);
if (_intersections.isNotEmpty) {
_selected = (scope.transformGroup == true) ? _objects[0] : _intersections[0].object;
if (_selected != null) {
_plane.setFromNormalAndCoplanarPoint(
_camera.getWorldDirection(_plane.normal), _worldPosition.setFromMatrixPosition(_selected!.matrixWorld));
if (_raycaster.ray.intersectPlane(_plane, _intersection)) {
_inverseMatrix.copy(_selected!.parent?.matrixWorld ?? Matrix4()).invert();
_offset.copy(_intersection).sub(_worldPosition.setFromMatrixPosition(_selected!.matrixWorld));
}
}
// _domElement.style.cursor = 'move';
scope.dispatchEvent(Event({'type': 'dragstart', 'object': _selected}));
}
}