Open xulman opened 3 years ago
I'll bump @skalarproduktraum on this one as well, since he wrote the smooth camera motion code.
Yeah, I checked this again, and it is kind of confusing for me to track what is going on with AnimatedCenteringBeforeArcBallControl
I'm confirming: the shift+drag (centering-then-rotate-around) centers much faster than the centering from dbl-clicking in the inspector
the patch is the following:
--- a/src/main/kotlin/sc/iview/Controls.kt
+++ b/src/main/kotlin/sc/iview/Controls.kt
@@ -240,13 +240,15 @@ open class Controls(val sciview: SciView) {
private fun enableArcBallControl() {
val h = inputHandler
- val target: Vector3f = sciview.activeNode?.position ?: Vector3f(0.0f, 0.0f, 0.0f)
+ // please REVIEW (I'm no good at Kotlin):
+ // the original `position` is deprecated, was underlined in IDE
+ val target: Vector3f = sciview.activeNode?.spatialOrNull()?.position ?: Vector3f(0.0f, 0.0f, 0.0f)
//setup ArcballCameraControl from scenery, register it with SciView's parameters
val cameraSupplier = { sciview.currentScene.findObserver() }
- val initAction = { _: Int, _: Int -> }
+ val initAction = { _: Int, _: Int -> sciview.centerOnActiveNode() } //DA FIX
val scrollAction = { _: Double, _: Boolean, _: Int, _:Int -> }
targetArcball = AnimatedCenteringBeforeArcBallControl(
initAction,
scrollAction,
this does the reasonably fast move to first make the active/selected obj in view centre and then runs the usual arcball on it; the issue was that the first part was skipped (scene jumped)
the initial movement itself may be cumbersome to some users, may be an optional tick in some future ControlsPref
I would have submitted PR right away, but I need
centerOnActiveNode()
should be optional (and guarded by some Controls
flag)@skalarproduktraum @moreApi see the above request for Kotlin feedback
The kotlin part looks good. I can't say anytging about the other question.
The kotlin part looks good. I can't say anytging about the other question.
Thank you @moreApi for the review
.... I was apparently lucky in my Kotlin syntax guessing ;-)
as for the second part, the current implementation of AnimatedCenteringBeforeArcBallControl
is basically only wrapping around ArcballCameraControl
and, if the former is plain-initiated, does nothing more than the later, brings no extra functionality....; my modification upgrades from the plain-initiation to one where one-time init-phase does call centerOnActiveNode()
before it passes control to the ArcballCameraControl
; apart from that it leaves the implementation of AnimatedCenteringBeforeArcBallControl
untouched
@xulman I'm familiar with what you're talking about and support the extra centerOnActiveNode()
call. I'm very used to "just click on the scene and wiggle your mouse around until the Node shows up" but it shouldn't be like that.
suppose I select/activate a node that is displayed in the corner of the scene, if I:
why is this not the same anymore?