forked from kscience/visionforge
Merge pull request #43 from kiruma524/kiruma524-orbitcontrols
Update OrbitControls.kt
This commit is contained in:
commit
32dad9d8b5
@ -59,13 +59,13 @@ class OrbitControls internal constructor(camera: Camera, canvas: SubScene, spec:
|
|||||||
|
|
||||||
private val ry = Rotate(0.0, Rotate.Y_AXIS)
|
private val ry = Rotate(0.0, Rotate.Y_AXIS)
|
||||||
|
|
||||||
private val translate = Translate()
|
private val rz = Rotate(0.0, Rotate.Z_AXIS)
|
||||||
|
|
||||||
//private val rz = Rotate(180.0, Rotate.Z_AXIS)
|
private val translate = Translate()
|
||||||
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
camera.transforms.setAll(ry, rx, translate)
|
camera.transforms.setAll(rx, ry, rz, translate)
|
||||||
update()
|
update()
|
||||||
val listener = InvalidationListener {
|
val listener = InvalidationListener {
|
||||||
update()
|
update()
|
||||||
@ -143,8 +143,8 @@ class OrbitControls internal constructor(camera: Camera, canvas: SubScene, spec:
|
|||||||
mouseOldY = mousePosY
|
mouseOldY = mousePosY
|
||||||
mousePosX = me.sceneX
|
mousePosX = me.sceneX
|
||||||
mousePosY = me.sceneY
|
mousePosY = me.sceneY
|
||||||
mouseDeltaX = mousePosX - mouseOldX
|
mouseDeltaX = mouseOldX - mousePosX
|
||||||
mouseDeltaY = mousePosY - mouseOldY
|
mouseDeltaY = mouseOldY - mousePosY
|
||||||
|
|
||||||
val modifier = when {
|
val modifier = when {
|
||||||
me.isControlDown -> CONTROL_MULTIPLIER
|
me.isControlDown -> CONTROL_MULTIPLIER
|
||||||
@ -176,4 +176,4 @@ class OrbitControls internal constructor(camera: Camera, canvas: SubScene, spec:
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Camera.orbitControls(canvas: SubScene, spec: CameraSpec) =
|
fun Camera.orbitControls(canvas: SubScene, spec: CameraSpec) =
|
||||||
OrbitControls(this, canvas, spec)
|
OrbitControls(this, canvas, spec)
|
||||||
|
Loading…
Reference in New Issue
Block a user