Skip to content

Commit

Permalink
Change default mouse handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
bagnell committed Jun 20, 2012
1 parent b3683b0 commit 22a5d63
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Source/Scene/Camera2DController.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ define([
this._maximumZoomRate = FAR;

this._translateHandler = new CameraEventHandler(canvas, CameraEventType.LEFT_DRAG);
this._zoomHandler = new CameraEventHandler(canvas, CameraEventType.RIGHT_DRAG);
this._zoomHandler = new CameraEventHandler(canvas, CameraEventType.MIDDLE_DRAG);
this._zoomWheel = new CameraEventHandler(canvas, CameraEventType.WHEEL);
this._twistHandler = new CameraEventHandler(canvas, CameraEventType.MIDDLE_DRAG);
this._twistHandler = new CameraEventHandler(canvas, CameraEventType.RIGHT_DRAG);

this._lastInertiaTranslateMovement = undefined;
this._lastInertiaZoomMovement = undefined;
Expand Down
7 changes: 4 additions & 3 deletions Source/Scene/CameraColumbusViewController.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ define([
// TODO: Shouldn't change private variables like this, need to be able to change event modifiers
// on controllers.
this._spindleController._spinHandler = this._spindleController._spinHandler && this._spindleController._spinHandler.destroy();
this._spindleController._spinHandler = new CameraEventHandler(canvas, CameraEventType.RIGHT_DRAG);
this._spindleController.mouseConstrainedZAxis = true;

this._freeLookController = new CameraFreeLookController(canvas, camera);
this._freeLookController.horizontalRotationAxis = Cartesian3.UNIT_Z;

this._transform = this._camera.transform.clone();

this._lastInertiaTranslateMovement = undefined;
}

Expand All @@ -83,6 +84,8 @@ define([
this._spindleController.update();
this._freeLookController.update();

this._updateReferenceFrame();

return true;
};

Expand All @@ -99,8 +102,6 @@ define([

var diff = startPlanePos.subtract(endPlanePos);
camera.position = camera.position.add(diff);

this._updateReferenceFrame();
};

CameraColumbusViewController.prototype._updateReferenceFrame = function() {
Expand Down
2 changes: 1 addition & 1 deletion Source/Scene/CameraSpindleController.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ define([
this._minimumRotateRate = 1.0 / 5000.0;

this._spinHandler = new CameraEventHandler(canvas, CameraEventType.LEFT_DRAG);
this._zoomHandler = new CameraEventHandler(canvas, CameraEventType.RIGHT_DRAG);
this._zoomHandler = new CameraEventHandler(canvas, CameraEventType.MIDDLE_DRAG);
this._zoomWheel = new CameraEventHandler(canvas, CameraEventType.WHEEL);

this._lastInertiaSpinMovement = undefined;
Expand Down

2 comments on commit 22a5d63

@emackey
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love these changes except for the deliberate swapping of MIDDLE and RIGHT buttons. Not only STK and Insight3D, but also Google Earth uses right-mouse for zoom in addition to middle wheel spin for zoom, and GE uses middle-drag for rotation around the look point. In GE this means you can use the wheel for both rotating and zooming without moving your finger to other buttons, and it feels useful and natural to me. Using the wheel for both zooming and zooming feels redundant to me.

I believe @mramato argued for the swap on the idea that assigning a single purpose to both spin and drag of the middle button would be friendly, but after trying it out I strongly disagree. Existing Cesium users are already accustomed to right-mouse-zoom, as well as GE and STK users. Also, people without a mouse wheel (who still own a shift key) need zoom much more than they need rotate (given pan on the left). It's very clear to me now that the default behavior should be right-zoom, middle-drag-rotate, and wheel-spin-zoom.

@mramato
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave it a try and I agree with @emackey that it is probably more natural to swap middle and right buttons.

Please sign in to comment.