chore!: rename controller to viewer in gesture detector widgets
This commit is contained in:
@@ -15,14 +15,14 @@ class ThermionGestureDetector extends StatelessWidget {
|
||||
///
|
||||
/// The content to display below the gesture detector/listener widget.
|
||||
/// This will usually be a ThermionWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
|
||||
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
|
||||
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [Filamentviewer].
|
||||
///
|
||||
final Widget? child;
|
||||
|
||||
///
|
||||
/// The [controller] attached to the [ThermionWidget] you wish to control.
|
||||
/// The [viewer] attached to the [ThermionWidget] you wish to control.
|
||||
///
|
||||
final ThermionViewer controller;
|
||||
final ThermionViewer viewer;
|
||||
|
||||
///
|
||||
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:
|
||||
@@ -47,7 +47,7 @@ class ThermionGestureDetector extends StatelessWidget {
|
||||
|
||||
const ThermionGestureDetector(
|
||||
{Key? key,
|
||||
required this.controller,
|
||||
required this.viewer,
|
||||
this.child,
|
||||
this.showControlOverlay = false,
|
||||
this.enableCamera = true,
|
||||
@@ -60,7 +60,7 @@ class ThermionGestureDetector extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: controller.initialized,
|
||||
future: viewer.initialized,
|
||||
builder: (_, initialized) {
|
||||
if (initialized.data != true) {
|
||||
return child ?? Container();
|
||||
@@ -69,7 +69,7 @@ class ThermionGestureDetector extends StatelessWidget {
|
||||
Platform.isWindows ||
|
||||
Platform.isMacOS) {
|
||||
return ThermionGestureDetectorDesktop(
|
||||
controller: controller,
|
||||
viewer: viewer,
|
||||
child: child,
|
||||
showControlOverlay: showControlOverlay,
|
||||
enableCamera: enableCamera,
|
||||
@@ -77,7 +77,7 @@ class ThermionGestureDetector extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
return ThermionGestureDetectorMobile(
|
||||
controller: controller,
|
||||
viewer: viewer,
|
||||
child: child,
|
||||
showControlOverlay: showControlOverlay,
|
||||
enableCamera: enableCamera,
|
||||
|
||||
@@ -10,14 +10,14 @@ import 'package:vector_math/vector_math_64.dart' as v64;
|
||||
|
||||
class ThermionGestureDetectorDesktop extends StatefulWidget {
|
||||
final Widget? child;
|
||||
final ThermionViewer controller;
|
||||
final ThermionViewer viewer;
|
||||
final bool showControlOverlay;
|
||||
final bool enableCamera;
|
||||
final bool enablePicking;
|
||||
|
||||
const ThermionGestureDetectorDesktop({
|
||||
Key? key,
|
||||
required this.controller,
|
||||
required this.viewer,
|
||||
this.child,
|
||||
this.showControlOverlay = false,
|
||||
this.enableCamera = true,
|
||||
@@ -37,7 +37,7 @@ class _ThermionGestureDetectorDesktopState
|
||||
super.initState();
|
||||
_gestureHandler = ThermionGestureHandler(
|
||||
enableCamera: widget.enableCamera,
|
||||
enablePicking: widget.enablePicking, viewer: widget.controller,
|
||||
enablePicking: widget.enablePicking, viewer: widget.viewer,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class _ThermionGestureDetectorDesktopState
|
||||
if (widget.enableCamera != oldWidget.enableCamera ||
|
||||
widget.enablePicking != oldWidget.enablePicking) {
|
||||
_gestureHandler = ThermionGestureHandler(
|
||||
viewer: widget.controller,
|
||||
viewer: widget.viewer,
|
||||
enableCamera: widget.enableCamera,
|
||||
enablePicking: widget.enablePicking,
|
||||
);
|
||||
|
||||
@@ -11,14 +11,14 @@ class ThermionGestureDetectorMobile extends StatefulWidget {
|
||||
///
|
||||
/// The content to display below the gesture detector/listener widget.
|
||||
/// This will usually be a ThermionWidget (so you can navigate by directly interacting with the viewport), but this is not necessary.
|
||||
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [FilamentController].
|
||||
/// It is equally possible to render the viewport/gesture controls elsewhere in the widget hierarchy. The only requirement is that they share the same [Filamentviewer].
|
||||
///
|
||||
final Widget? child;
|
||||
|
||||
///
|
||||
/// The [controller] attached to the [ThermionWidget] you wish to control.
|
||||
/// The [viewer] attached to the [ThermionWidget] you wish to control.
|
||||
///
|
||||
final ThermionViewer controller;
|
||||
final ThermionViewer viewer;
|
||||
|
||||
///
|
||||
/// If true, an overlay will be shown with buttons to toggle whether pointer movements are interpreted as:
|
||||
@@ -45,7 +45,7 @@ class ThermionGestureDetectorMobile extends StatefulWidget {
|
||||
|
||||
const ThermionGestureDetectorMobile(
|
||||
{Key? key,
|
||||
required this.controller,
|
||||
required this.viewer,
|
||||
this.child,
|
||||
this.showControlOverlay = false,
|
||||
this.enableCamera = true,
|
||||
@@ -98,14 +98,14 @@ class _ThermionGestureDetectorMobileState
|
||||
void _setFunction() {
|
||||
switch (gestureType) {
|
||||
case GestureType.rotateCamera:
|
||||
_functionStart = widget.controller.rotateStart;
|
||||
_functionUpdate = widget.controller.rotateUpdate;
|
||||
_functionEnd = widget.controller.rotateEnd;
|
||||
_functionStart = widget.viewer.rotateStart;
|
||||
_functionUpdate = widget.viewer.rotateUpdate;
|
||||
_functionEnd = widget.viewer.rotateEnd;
|
||||
break;
|
||||
case GestureType.panCamera:
|
||||
_functionStart = widget.controller.panStart;
|
||||
_functionUpdate = widget.controller.panUpdate;
|
||||
_functionEnd = widget.controller.panEnd;
|
||||
_functionStart = widget.viewer.panStart;
|
||||
_functionUpdate = widget.viewer.panUpdate;
|
||||
_functionEnd = widget.viewer.panEnd;
|
||||
break;
|
||||
// TODO
|
||||
case GestureType.panBackground:
|
||||
@@ -143,7 +143,7 @@ class _ThermionGestureDetectorMobileState
|
||||
return;
|
||||
}
|
||||
|
||||
widget.controller.pick(
|
||||
widget.viewer.pick(
|
||||
d.globalPosition.dx.toInt(), d.globalPosition.dy.toInt());
|
||||
},
|
||||
onDoubleTap: () {
|
||||
@@ -158,13 +158,13 @@ class _ThermionGestureDetectorMobileState
|
||||
}
|
||||
if (d.pointerCount == 2 && widget.enableCamera) {
|
||||
_scaling = true;
|
||||
await widget.controller.zoomBegin();
|
||||
await widget.viewer.zoomBegin();
|
||||
} else if (!_scaling && widget.enableCamera) {
|
||||
if (_rotateOnPointerMove) {
|
||||
widget.controller.rotateStart(
|
||||
widget.viewer.rotateStart(
|
||||
d.localFocalPoint.dx, d.localFocalPoint.dy);
|
||||
} else {
|
||||
widget.controller
|
||||
widget.viewer
|
||||
.panStart(d.localFocalPoint.dx, d.localFocalPoint.dy);
|
||||
}
|
||||
}
|
||||
@@ -176,7 +176,7 @@ class _ThermionGestureDetectorMobileState
|
||||
}
|
||||
if (d.pointerCount == 2 && widget.enableCamera) {
|
||||
if (d.horizontalScale != _lastScale) {
|
||||
widget.controller.zoomUpdate(
|
||||
widget.viewer.zoomUpdate(
|
||||
d.localFocalPoint.dx,
|
||||
d.localFocalPoint.dy,
|
||||
d.horizontalScale > _lastScale ? 0.1 : -0.1);
|
||||
@@ -184,10 +184,10 @@ class _ThermionGestureDetectorMobileState
|
||||
}
|
||||
} else if (!_scaling && widget.enableCamera) {
|
||||
if (_rotateOnPointerMove) {
|
||||
widget.controller
|
||||
widget.viewer
|
||||
.rotateUpdate(d.focalPoint.dx, d.focalPoint.dy);
|
||||
} else {
|
||||
widget.controller
|
||||
widget.viewer
|
||||
.panUpdate(d.focalPoint.dx, d.focalPoint.dy);
|
||||
}
|
||||
}
|
||||
@@ -199,12 +199,12 @@ class _ThermionGestureDetectorMobileState
|
||||
}
|
||||
|
||||
if (d.pointerCount == 2 && widget.enableCamera) {
|
||||
widget.controller.zoomEnd();
|
||||
widget.viewer.zoomEnd();
|
||||
} else if (!_scaling && widget.enableCamera) {
|
||||
if (_rotateOnPointerMove) {
|
||||
widget.controller.rotateEnd();
|
||||
widget.viewer.rotateEnd();
|
||||
} else {
|
||||
widget.controller.panEnd();
|
||||
widget.viewer.panEnd();
|
||||
}
|
||||
}
|
||||
_scaling = false;
|
||||
|
||||
Reference in New Issue
Block a user