reinstate GizmoInputHandler
This commit is contained in:
@@ -1,371 +1,371 @@
|
|||||||
// import 'dart:async';
|
import 'dart:async';
|
||||||
// import 'dart:math';
|
import 'dart:math';
|
||||||
// import 'package:thermion_dart/thermion_dart.dart';
|
import 'package:thermion_dart/thermion_dart.dart';
|
||||||
|
|
||||||
// class _Gizmo {
|
class _Gizmo {
|
||||||
// final ThermionViewer viewer;
|
final ThermionViewer viewer;
|
||||||
|
|
||||||
// final GizmoAsset _gizmo;
|
final GizmoAsset _gizmo;
|
||||||
|
|
||||||
// final transformUpdates = StreamController<({Matrix4 transform})>.broadcast();
|
final transformUpdates = StreamController<({Matrix4 transform})>.broadcast();
|
||||||
|
|
||||||
// Axis? _active;
|
Axis? _active;
|
||||||
// final GizmoType type;
|
final GizmoType type;
|
||||||
|
|
||||||
// _Gizmo(this._gizmo, this.viewer, this.type);
|
_Gizmo(this._gizmo, this.viewer, this.type);
|
||||||
|
|
||||||
// static Future<_Gizmo> forType(ThermionViewer viewer, GizmoType type) async {
|
static Future<_Gizmo> forType(ThermionViewer viewer, GizmoType type) async {
|
||||||
// final view = await viewer.view;
|
final view = await viewer.view;
|
||||||
// return _Gizmo(await viewer.createGizmo(view, type), viewer, type);
|
return _Gizmo(await viewer.getGizmo(type), viewer, type);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future dispose() async {
|
Future dispose() async {
|
||||||
// await transformUpdates.close();
|
await transformUpdates.close();
|
||||||
// await viewer.destroyAsset(_gizmo);
|
await viewer.destroyAsset(_gizmo);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future hide() async {
|
Future hide() async {
|
||||||
// final scene = await viewer.view.getScene();
|
final scene = await viewer.view.getScene();
|
||||||
// await scene.remove(_gizmo);
|
await scene.remove(_gizmo);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future reveal() async {
|
Future reveal() async {
|
||||||
// final scene = await viewer.view.getScene();
|
final scene = await viewer.view.getScene();
|
||||||
// await scene.add(_gizmo);
|
await scene.add(_gizmo);
|
||||||
// gizmoTransform = await _gizmo.getWorldTransform();
|
gizmoTransform = await _gizmo.getWorldTransform();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// double _getAngleBetweenVectors(Vector2 v1, Vector2 v2) {
|
double _getAngleBetweenVectors(Vector2 v1, Vector2 v2) {
|
||||||
// // Normalize vectors to ensure consistent rotation regardless of distance from center
|
// Normalize vectors to ensure consistent rotation regardless of distance from center
|
||||||
// v1.normalize();
|
v1.normalize();
|
||||||
// v2.normalize();
|
v2.normalize();
|
||||||
|
|
||||||
// // Calculate angle using atan2
|
// Calculate angle using atan2
|
||||||
// double angle = atan2(v2.y, v2.x) - atan2(v1.y, v1.x);
|
double angle = atan2(v2.y, v2.x) - atan2(v1.y, v1.x);
|
||||||
|
|
||||||
// // Ensure angle is between -π and π
|
// Ensure angle is between -π and π
|
||||||
// if (angle > pi) angle -= 2 * pi;
|
if (angle > pi) angle -= 2 * pi;
|
||||||
// if (angle < -pi) angle += 2 * pi;
|
if (angle < -pi) angle += 2 * pi;
|
||||||
|
|
||||||
// return angle;
|
return angle;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// void checkHover(int x, int y) async {
|
void checkHover(int x, int y) async {
|
||||||
// _gizmo.pick(x, y, handler: (result, coords) async {
|
_gizmo.pick(x, y, handler: (result, coords) async {
|
||||||
// switch (result) {
|
switch (result) {
|
||||||
// case GizmoPickResultType.None:
|
case GizmoPickResultType.None:
|
||||||
// await _gizmo.unhighlight();
|
await _gizmo.unhighlight();
|
||||||
// _active = null;
|
_active = null;
|
||||||
// break;
|
break;
|
||||||
// case GizmoPickResultType.AxisX:
|
case GizmoPickResultType.AxisX:
|
||||||
// _active = Axis.X;
|
_active = Axis.X;
|
||||||
// case GizmoPickResultType.AxisY:
|
case GizmoPickResultType.AxisY:
|
||||||
// _active = Axis.Y;
|
_active = Axis.Y;
|
||||||
// case GizmoPickResultType.AxisZ:
|
case GizmoPickResultType.AxisZ:
|
||||||
// _active = Axis.Z;
|
_active = Axis.Z;
|
||||||
// default:
|
default:
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Matrix4? gizmoTransform;
|
Matrix4? gizmoTransform;
|
||||||
|
|
||||||
// void _updateTransform(Vector2 currentPosition, Vector2 delta) async {
|
void _updateTransform(Vector2 currentPosition, Vector2 delta) async {
|
||||||
// if (type == GizmoType.translation) {
|
if (type == GizmoType.translation) {
|
||||||
// await _updateTranslation(currentPosition, delta);
|
await _updateTranslation(currentPosition, delta);
|
||||||
// } else if (type == GizmoType.rotation) {
|
} else if (type == GizmoType.rotation) {
|
||||||
// await _updateRotation(currentPosition, delta);
|
await _updateRotation(currentPosition, delta);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// await _gizmo.setTransform(gizmoTransform!);
|
await _gizmo.setTransform(gizmoTransform!);
|
||||||
|
|
||||||
// transformUpdates.add((transform: gizmoTransform!));
|
transformUpdates.add((transform: gizmoTransform!));
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future<void>? _updateTranslation(
|
Future<void>? _updateTranslation(
|
||||||
// Vector2 currentPosition, Vector2 delta) async {
|
Vector2 currentPosition, Vector2 delta) async {
|
||||||
// var view = await viewer.view;
|
var view = await viewer.view;
|
||||||
// var camera = await viewer.getActiveCamera();
|
var camera = await viewer.getActiveCamera();
|
||||||
// var viewport = await view.getViewport();
|
var viewport = await view.getViewport();
|
||||||
// var projectionMatrix = await camera.getProjectionMatrix();
|
var projectionMatrix = await camera.getProjectionMatrix();
|
||||||
// var viewMatrix = await camera.getViewMatrix();
|
var viewMatrix = await camera.getViewMatrix();
|
||||||
// var inverseViewMatrix = await camera.getModelMatrix();
|
var inverseViewMatrix = await camera.getModelMatrix();
|
||||||
// var inverseProjectionMatrix = projectionMatrix.clone()..invert();
|
var inverseProjectionMatrix = projectionMatrix.clone()..invert();
|
||||||
|
|
||||||
// // get gizmo position in screenspace
|
// get gizmo position in screenspace
|
||||||
// var gizmoPositionWorldSpace = gizmoTransform!.getTranslation();
|
var gizmoPositionWorldSpace = gizmoTransform!.getTranslation();
|
||||||
// Vector4 gizmoClipSpace = projectionMatrix *
|
Vector4 gizmoClipSpace = projectionMatrix *
|
||||||
// viewMatrix *
|
viewMatrix *
|
||||||
// Vector4(gizmoPositionWorldSpace.x, gizmoPositionWorldSpace.y,
|
Vector4(gizmoPositionWorldSpace.x, gizmoPositionWorldSpace.y,
|
||||||
// gizmoPositionWorldSpace.z, 1.0);
|
gizmoPositionWorldSpace.z, 1.0);
|
||||||
|
|
||||||
// var gizmoNdc = gizmoClipSpace / gizmoClipSpace.w;
|
var gizmoNdc = gizmoClipSpace / gizmoClipSpace.w;
|
||||||
|
|
||||||
// var gizmoScreenSpace = Vector2(((gizmoNdc.x / 2) + 0.5) * viewport.width,
|
var gizmoScreenSpace = Vector2(((gizmoNdc.x / 2) + 0.5) * viewport.width,
|
||||||
// viewport.height - (((gizmoNdc.y / 2) + 0.5) * viewport.height));
|
viewport.height - (((gizmoNdc.y / 2) + 0.5) * viewport.height));
|
||||||
|
|
||||||
// gizmoScreenSpace += delta;
|
gizmoScreenSpace += delta;
|
||||||
|
|
||||||
// gizmoNdc = Vector4(((gizmoScreenSpace.x / viewport.width) - 0.5) * 2,
|
gizmoNdc = Vector4(((gizmoScreenSpace.x / viewport.width) - 0.5) * 2,
|
||||||
// (((gizmoScreenSpace.y / viewport.height)) - 0.5) * -2, gizmoNdc.z, 1.0);
|
(((gizmoScreenSpace.y / viewport.height)) - 0.5) * -2, gizmoNdc.z, 1.0);
|
||||||
|
|
||||||
// var gizmoViewSpace = inverseProjectionMatrix * gizmoNdc;
|
var gizmoViewSpace = inverseProjectionMatrix * gizmoNdc;
|
||||||
// gizmoViewSpace /= gizmoViewSpace.w;
|
gizmoViewSpace /= gizmoViewSpace.w;
|
||||||
|
|
||||||
// var newPosition = (inverseViewMatrix * gizmoViewSpace).xyz;
|
var newPosition = (inverseViewMatrix * gizmoViewSpace).xyz;
|
||||||
|
|
||||||
// Vector3 worldSpaceDelta = newPosition - gizmoTransform!.getTranslation();
|
Vector3 worldSpaceDelta = newPosition - gizmoTransform!.getTranslation();
|
||||||
// worldSpaceDelta.multiply(_active!.asVector());
|
worldSpaceDelta.multiply(_active!.asVector());
|
||||||
|
|
||||||
// gizmoTransform!
|
gizmoTransform!
|
||||||
// .setTranslation(gizmoTransform!.getTranslation() + worldSpaceDelta);
|
.setTranslation(gizmoTransform!.getTranslation() + worldSpaceDelta);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future<void>? _updateRotation(Vector2 currentPosition, Vector2 delta) async {
|
Future<void>? _updateRotation(Vector2 currentPosition, Vector2 delta) async {
|
||||||
// var camera = await viewer.view.getCamera();
|
var camera = await viewer.view.getCamera();
|
||||||
// var viewport = await viewer.view.getViewport();
|
var viewport = await viewer.view.getViewport();
|
||||||
// var projectionMatrix = await camera.getProjectionMatrix();
|
var projectionMatrix = await camera.getProjectionMatrix();
|
||||||
// var viewMatrix = await camera.getViewMatrix();
|
var viewMatrix = await camera.getViewMatrix();
|
||||||
|
|
||||||
// // Get gizmo center in screen space
|
// Get gizmo center in screen space
|
||||||
// var gizmoPositionWorldSpace = gizmoTransform!.getTranslation();
|
var gizmoPositionWorldSpace = gizmoTransform!.getTranslation();
|
||||||
// Vector4 gizmoClipSpace = projectionMatrix *
|
Vector4 gizmoClipSpace = projectionMatrix *
|
||||||
// viewMatrix *
|
viewMatrix *
|
||||||
// Vector4(gizmoPositionWorldSpace.x, gizmoPositionWorldSpace.y,
|
Vector4(gizmoPositionWorldSpace.x, gizmoPositionWorldSpace.y,
|
||||||
// gizmoPositionWorldSpace.z, 1.0);
|
gizmoPositionWorldSpace.z, 1.0);
|
||||||
|
|
||||||
// var gizmoNdc = gizmoClipSpace / gizmoClipSpace.w;
|
var gizmoNdc = gizmoClipSpace / gizmoClipSpace.w;
|
||||||
// var gizmoScreenSpace = Vector2(((gizmoNdc.x / 2) + 0.5) * viewport.width,
|
var gizmoScreenSpace = Vector2(((gizmoNdc.x / 2) + 0.5) * viewport.width,
|
||||||
// viewport.height - (((gizmoNdc.y / 2) + 0.5) * viewport.height));
|
viewport.height - (((gizmoNdc.y / 2) + 0.5) * viewport.height));
|
||||||
|
|
||||||
// // Calculate vectors from gizmo center to previous and current mouse positions
|
// Calculate vectors from gizmo center to previous and current mouse positions
|
||||||
// var prevVector = (currentPosition - delta) - gizmoScreenSpace;
|
var prevVector = (currentPosition - delta) - gizmoScreenSpace;
|
||||||
// var currentVector = currentPosition - gizmoScreenSpace;
|
var currentVector = currentPosition - gizmoScreenSpace;
|
||||||
|
|
||||||
// // Calculate rotation angle based on the active axis
|
// Calculate rotation angle based on the active axis
|
||||||
// double rotationAngle = 0.0;
|
double rotationAngle = 0.0;
|
||||||
// switch (_active) {
|
switch (_active) {
|
||||||
// case Axis.X:
|
case Axis.X:
|
||||||
// // For X axis, project onto YZ plane
|
// For X axis, project onto YZ plane
|
||||||
// var prev = Vector2(prevVector.y, -prevVector.x);
|
var prev = Vector2(prevVector.y, -prevVector.x);
|
||||||
// var curr = Vector2(currentVector.y, -currentVector.x);
|
var curr = Vector2(currentVector.y, -currentVector.x);
|
||||||
// rotationAngle = _getAngleBetweenVectors(prev, curr);
|
rotationAngle = _getAngleBetweenVectors(prev, curr);
|
||||||
// break;
|
break;
|
||||||
// case Axis.Y:
|
case Axis.Y:
|
||||||
// // For Y axis, project onto XZ plane
|
// For Y axis, project onto XZ plane
|
||||||
// var prev = Vector2(prevVector.x, -prevVector.y);
|
var prev = Vector2(prevVector.x, -prevVector.y);
|
||||||
// var curr = Vector2(currentVector.x, -currentVector.y);
|
var curr = Vector2(currentVector.x, -currentVector.y);
|
||||||
// rotationAngle = _getAngleBetweenVectors(prev, curr);
|
rotationAngle = _getAngleBetweenVectors(prev, curr);
|
||||||
// break;
|
break;
|
||||||
// case Axis.Z:
|
case Axis.Z:
|
||||||
// // For Z axis, use screen plane directly
|
// For Z axis, use screen plane directly
|
||||||
// rotationAngle = -1 * _getAngleBetweenVectors(prevVector, currentVector);
|
rotationAngle = -1 * _getAngleBetweenVectors(prevVector, currentVector);
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Create rotation matrix based on the active axis
|
// Create rotation matrix based on the active axis
|
||||||
// var rotationMatrix = Matrix4.identity();
|
var rotationMatrix = Matrix4.identity();
|
||||||
// switch (_active) {
|
switch (_active) {
|
||||||
// case Axis.X:
|
case Axis.X:
|
||||||
// rotationMatrix.setRotationX(rotationAngle);
|
rotationMatrix.setRotationX(rotationAngle);
|
||||||
// break;
|
break;
|
||||||
// case Axis.Y:
|
case Axis.Y:
|
||||||
// rotationMatrix.setRotationY(rotationAngle);
|
rotationMatrix.setRotationY(rotationAngle);
|
||||||
// break;
|
break;
|
||||||
// case Axis.Z:
|
case Axis.Z:
|
||||||
// rotationMatrix.setRotationZ(rotationAngle);
|
rotationMatrix.setRotationZ(rotationAngle);
|
||||||
// break;
|
break;
|
||||||
// default:
|
default:
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Apply rotation to the current transform
|
// Apply rotation to the current transform
|
||||||
// gizmoTransform = gizmoTransform! * rotationMatrix;
|
gizmoTransform = gizmoTransform! * rotationMatrix;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// class GizmoInputHandler extends InputHandler {
|
class GizmoInputHandler extends InputHandler {
|
||||||
// final ThermionViewer viewer;
|
final ThermionViewer viewer;
|
||||||
|
|
||||||
// late final _gizmos = <GizmoType, _Gizmo>{};
|
late final _gizmos = <GizmoType, _Gizmo>{};
|
||||||
|
|
||||||
// _Gizmo? _active;
|
_Gizmo? _active;
|
||||||
|
|
||||||
// ThermionEntity? _attached;
|
ThermionEntity? _attached;
|
||||||
|
|
||||||
// Future attach(ThermionEntity entity) async {
|
Future attach(ThermionEntity entity) async {
|
||||||
// if (_attached != null) {
|
if (_attached != null) {
|
||||||
// await detach();
|
await detach();
|
||||||
// }
|
}
|
||||||
// _attached = entity;
|
_attached = entity;
|
||||||
// if (_active != null) {
|
if (_active != null) {
|
||||||
// await FilamentApp.instance!.setParent(_attached!, _active!._gizmo.entity);
|
await FilamentApp.instance!.setParent(_attached!, _active!._gizmo.entity);
|
||||||
// await _active!.reveal();
|
await _active!.reveal();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future<Matrix4?> getGizmoTransform() async {
|
Future<Matrix4?> getGizmoTransform() async {
|
||||||
// return _active?.gizmoTransform;
|
return _active?.gizmoTransform;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future detach() async {
|
Future detach() async {
|
||||||
// if (_attached == null) {
|
if (_attached == null) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// await FilamentApp.instance!.setParent(_attached!, null);
|
await FilamentApp.instance!.setParent(_attached!, null);
|
||||||
// await _active?.hide();
|
await _active?.hide();
|
||||||
// _attached = null;
|
_attached = null;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// final _initialized = Completer<bool>();
|
final _initialized = Completer<bool>();
|
||||||
|
|
||||||
// final _transformController = StreamController<Matrix4>.broadcast();
|
final _transformController = StreamController<Matrix4>.broadcast();
|
||||||
// Stream<Matrix4> get transformUpdated => _transformController.stream;
|
Stream<Matrix4> get transformUpdated => _transformController.stream;
|
||||||
|
|
||||||
// final _pickResultController = StreamController<ThermionEntity?>.broadcast();
|
final _pickResultController = StreamController<ThermionEntity?>.broadcast();
|
||||||
// Stream<ThermionEntity?> get onPickResult => _pickResultController.stream;
|
Stream<ThermionEntity?> get onPickResult => _pickResultController.stream;
|
||||||
|
|
||||||
// GizmoInputHandler({required this.viewer, required GizmoType initialType}) {
|
GizmoInputHandler({required this.viewer, required GizmoType initialType}) {
|
||||||
// initialize().then((_) {
|
initialize().then((_) {
|
||||||
// setGizmoType(initialType);
|
setGizmoType(initialType);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// GizmoType? getGizmoType() {
|
GizmoType? getGizmoType() {
|
||||||
// return _active?.type;
|
return _active?.type;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future setGizmoType(GizmoType? type) async {
|
Future setGizmoType(GizmoType? type) async {
|
||||||
// if (type == null) {
|
if (type == null) {
|
||||||
// await detach();
|
await detach();
|
||||||
// _active?.hide();
|
_active?.hide();
|
||||||
// _active = null;
|
_active = null;
|
||||||
// } else {
|
} else {
|
||||||
// _active?.hide();
|
_active?.hide();
|
||||||
// _active = _gizmos[type]!;
|
_active = _gizmos[type]!;
|
||||||
// _active!.reveal();
|
_active!.reveal();
|
||||||
// if (_attached != null) {
|
if (_attached != null) {
|
||||||
// await attach(_attached!);
|
await attach(_attached!);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Future initialize() async {
|
Future initialize() async {
|
||||||
// if (_initialized.isCompleted) {
|
if (_initialized.isCompleted) {
|
||||||
// throw Exception("Already initialized");
|
throw Exception("Already initialized");
|
||||||
// }
|
}
|
||||||
// await viewer.initialized;
|
await viewer.initialized;
|
||||||
|
|
||||||
// _gizmos[GizmoType.translation] =
|
_gizmos[GizmoType.translation] =
|
||||||
// await _Gizmo.forType(viewer, GizmoType.translation);
|
await _Gizmo.forType(viewer, GizmoType.translation);
|
||||||
// _gizmos[GizmoType.rotation] =
|
_gizmos[GizmoType.rotation] =
|
||||||
// await _Gizmo.forType(viewer, GizmoType.rotation);
|
await _Gizmo.forType(viewer, GizmoType.rotation);
|
||||||
// await setGizmoType(GizmoType.translation);
|
await setGizmoType(GizmoType.translation);
|
||||||
// for (final gizmo in _gizmos.values) {
|
for (final gizmo in _gizmos.values) {
|
||||||
// gizmo.transformUpdates.stream.listen((update) {
|
gizmo.transformUpdates.stream.listen((update) {
|
||||||
// _transformController.add(update.transform);
|
_transformController.add(update.transform);
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
// _initialized.complete(true);
|
_initialized.complete(true);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future dispose() async {
|
Future dispose() async {
|
||||||
// _gizmos[GizmoType.rotation]!.dispose();
|
_gizmos[GizmoType.rotation]!.dispose();
|
||||||
// _gizmos[GizmoType.translation]!.dispose();
|
_gizmos[GizmoType.translation]!.dispose();
|
||||||
// _gizmos.clear();
|
_gizmos.clear();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// InputAction? getActionForType(InputType gestureType) {
|
InputAction? getActionForType(InputType gestureType) {
|
||||||
// if (gestureType == InputType.LMB_DOWN) {
|
if (gestureType == InputType.LMB_DOWN) {
|
||||||
// return InputAction.PICK;
|
return InputAction.PICK;
|
||||||
// }
|
}
|
||||||
// throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<bool> get initialized => _initialized.future;
|
Future<bool> get initialized => _initialized.future;
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void keyDown(PhysicalKey key) {}
|
void keyDown(PhysicalKey key) {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void keyUp(PhysicalKey key) {}
|
void keyUp(PhysicalKey key) {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onPointerDown(Vector2 localPosition, bool isMiddle) async {
|
Future<void>? onPointerDown(Vector2 localPosition, bool isMiddle) async {
|
||||||
// if (!_initialized.isCompleted) {
|
if (!_initialized.isCompleted) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// if (isMiddle) {
|
if (isMiddle) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// await viewer.pick(localPosition.x.toInt(), localPosition.y.toInt(),
|
await viewer.view.pick(localPosition.x.toInt(), localPosition.y.toInt(),
|
||||||
// (result) async {
|
(result) async {
|
||||||
// if (_active?._gizmo.isNonPickable(result.entity) == true ||
|
if (_active?._gizmo.isNonPickable(result.entity) == true ||
|
||||||
// result.entity == FILAMENT_ENTITY_NULL) {
|
result.entity == FILAMENT_ENTITY_NULL) {
|
||||||
// _pickResultController.add(null);
|
_pickResultController.add(null);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// if (_active?._gizmo.isGizmoEntity(result.entity) != true) {
|
if (_active?._gizmo.isGizmoEntity(result.entity) != true) {
|
||||||
// _pickResultController.add(result.entity);
|
_pickResultController.add(result.entity);
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onPointerHover(Vector2 localPosition, Vector2 delta) async {
|
Future<void>? onPointerHover(Vector2 localPosition, Vector2 delta) async {
|
||||||
// if (!_initialized.isCompleted) {
|
if (!_initialized.isCompleted) {
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// _active?.checkHover(localPosition.x.floor(), localPosition.y.floor());
|
_active?.checkHover(localPosition.x.floor(), localPosition.y.floor());
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onPointerMove(
|
Future<void>? onPointerMove(
|
||||||
// Vector2 localPosition, Vector2 delta, bool isMiddle) async {
|
Vector2 localPosition, Vector2 delta, bool isMiddle) async {
|
||||||
// if (!isMiddle && _active?._active != null) {
|
if (!isMiddle && _active?._active != null) {
|
||||||
// final scaledDelta = Vector2(
|
final scaledDelta = Vector2(
|
||||||
// delta.x,
|
delta.x,
|
||||||
// delta.y,
|
delta.y,
|
||||||
// );
|
);
|
||||||
// _active!._updateTransform(localPosition, scaledDelta);
|
_active!._updateTransform(localPosition, scaledDelta);
|
||||||
// return;
|
return;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onPointerScroll(
|
Future<void>? onPointerScroll(
|
||||||
// Vector2 localPosition, double scrollDelta) async {}
|
Vector2 localPosition, double scrollDelta) async {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onPointerUp(bool isMiddle) async {}
|
Future<void>? onPointerUp(bool isMiddle) async {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onScaleEnd(int pointerCount, double velocity) {}
|
Future<void>? onScaleEnd(int pointerCount, double velocity) {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onScaleStart(
|
Future<void>? onScaleStart(
|
||||||
// Vector2 focalPoint, int pointerCount, Duration? sourceTimestamp) {}
|
Vector2 focalPoint, int pointerCount, Duration? sourceTimestamp) {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// Future<void>? onScaleUpdate(
|
Future<void>? onScaleUpdate(
|
||||||
// Vector2 focalPoint,
|
Vector2 focalPoint,
|
||||||
// Vector2 focalPointDelta,
|
Vector2 focalPointDelta,
|
||||||
// double horizontalScale,
|
double horizontalScale,
|
||||||
// double verticalScale,
|
double verticalScale,
|
||||||
// double scale,
|
double scale,
|
||||||
// int pointerCount,
|
int pointerCount,
|
||||||
// double rotation,
|
double rotation,
|
||||||
// Duration? sourceTimestamp) {}
|
Duration? sourceTimestamp) {}
|
||||||
|
|
||||||
// @override
|
@override
|
||||||
// void setActionForType(InputType gestureType, InputAction gestureAction) {
|
void setActionForType(InputType gestureType, InputAction gestureAction) {
|
||||||
// throw UnimplementedError();
|
throw UnimplementedError();
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user