add ignore parameter for Gizmo

This commit is contained in:
Nick Fisher
2024-06-01 12:43:25 +08:00
parent 5337269f83
commit 8536dfae01

View File

@@ -16,7 +16,10 @@ class Gizmo extends AbstractGizmo {
FilamentEntity? _activeEntity; FilamentEntity? _activeEntity;
bool get isActive => _activeAxis != null; bool get isActive => _activeAxis != null;
Gizmo(this.x, this.y, this.z, this.controller) { final Set<FilamentEntity> ignore;
Gizmo(this.x, this.y, this.z, this.controller,
{this.ignore = const <FilamentEntity>{}}) {
controller.pickResult.listen(_onPickResult); controller.pickResult.listen(_onPickResult);
} }
@@ -45,6 +48,10 @@ class Gizmo extends AbstractGizmo {
} }
void _onPickResult(FilamentPickResult result) async { void _onPickResult(FilamentPickResult result) async {
if (ignore.contains(result)) {
detach();
return;
}
if (result.entity == x || result.entity == y || result.entity == z) { if (result.entity == x || result.entity == y || result.entity == z) {
_activeAxis = result.entity; _activeAxis = result.entity;
} else { } else {