-
Notifications
You must be signed in to change notification settings - Fork 215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom frame axes options: scale, dashed lines and no pan&zoom frame #208
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,12 @@ | |
* @param userZoomSpeed (optional) - the speed for zooming | ||
* @param userRotateSpeed (optional) - the speed for rotating | ||
* @param autoRotate (optional) - if the orbit should auto rotate | ||
* @param autoRotate (optional) - the speed for auto rotating | ||
* @param autoRotateSpeed (optional) - the speed for auto rotating | ||
* @param displayPanAndZoomFrame - whether to display a frame when panning/zooming | ||
* (defaults to true) | ||
* @param lineTypePanAndZoomFrame - line type for the frame that is displayed when | ||
* panning/zooming. Only has effect when | ||
* displayPanAndZoomFrame is set to true. | ||
*/ | ||
ROS3D.OrbitControls = function(options) { | ||
THREE.EventDispatcher.call(this); | ||
|
@@ -29,7 +34,10 @@ ROS3D.OrbitControls = function(options) { | |
this.userRotateSpeed = options.userRotateSpeed || 1.0; | ||
this.autoRotate = options.autoRotate; | ||
this.autoRotateSpeed = options.autoRotateSpeed || 2.0; | ||
|
||
this.displayPanAndZoomFrame = (options.displayPanAndZoomFrame === undefined) ? | ||
true : | ||
!!options.displayPanAndZoomFrame; | ||
this.lineTypePanAndZoomFrame = options.dashedPanAndZoomFrame || 'full'; | ||
// In ROS, z is pointing upwards | ||
this.camera.up = new THREE.Vector3(0, 0, 1); | ||
|
||
|
@@ -61,17 +69,19 @@ ROS3D.OrbitControls = function(options) { | |
}; | ||
var state = STATE.NONE; | ||
|
||
// add the axes for the main coordinate frame | ||
this.axes = new ROS3D.Axes({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And line490-492 |
||
shaftRadius : 0.025, | ||
headRadius : 0.07, | ||
headLength : 0.2 | ||
}); | ||
// initially not visible | ||
scene.add(this.axes); | ||
this.axes.traverse(function(obj) { | ||
obj.visible = false; | ||
headLength : 0.2, | ||
lineType: this.lineTypePanAndZoomFrame | ||
}); | ||
if (this.displayPanAndZoomFrame) { | ||
// initially not visible | ||
scene.add(this.axes); | ||
this.axes.traverse(function(obj) { | ||
obj.visible = false; | ||
}); | ||
} | ||
|
||
/** | ||
* Handle the mousedown 3D event. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few duplicated lines here - can you refactor the code to move them outside the if-else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are not duplicated, but inside a for loop. The de-duplication would make reasoning about this harder.