Skip to content

Improve viewer camera #236

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

Merged
merged 54 commits into from
Sep 14, 2012
Merged

Improve viewer camera #236

merged 54 commits into from
Sep 14, 2012

Conversation

mramato
Copy link
Contributor

@mramato mramato commented Sep 12, 2012

The Viewer widget has a simple tracking capability which tracks an object when you right-click on it. This only worked in 3D mode and has been recently broken. I created a new utility object, DynamicObjectView which makes it easy to track an object across scene modes.

  1. Right-click on an object in viewer.
  2. When you switch modes, you'll stay locked onto the thing you are tracking (though transitions aren't supported yet).
  3. If you change the view in one mode, it will be reflected to have a similar view in the new mode.
  4. Added a viewFrom property to CZML which is an east-north-up Cartesian that gives the client a recommended camera position when zooming to the object.
  5. @bagnell fixed a bunch of issues that were uncovered while I was working in this branch.

This whole process has also exposed many issues with our current camera API that will be addressed in future pull requests, DynamicObjectView is a little overly complicated because of this and unit tests for the new object is light for now.

mramato and others added 30 commits August 20, 2012 22:31
…work on DynamicObjectView, though its currently a mess.
1. Make lookAt query parameter work again in Viewer
2. Fix several crashes in DynamicObjectView
3. Fix crash in BoundingRectangle and make BoundingSphere work the same way.
Conflicts:
	Source/Core/BoundingRectangle.js
	Specs/Core/BoundingRectangleSpec.js
	Specs/Core/BoundingSphereSpec.js
…template, since all 3 are required, a template doesn't make sense.
Conflicts:
	Source/Widgets/Dojo/CesiumViewerWidget.js
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

I'm able to right-click anywhere on the globe with pretty strange results.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

I can zoom in/out when viewing the facility, but not when viewing the satellites.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

The Home View button restores a 2D view to 3D. I believe it always did that. Is that the right behavior? I would expect it to change views, but not scene modes.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

I can zoom in/out when viewing the facility, but not when viewing the satellites.

This is in simple.czml. It's odd though - sometimes I can zoom, but usually I can't.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

Added a viewFrom property to CZML which is an east-north-up Cartesian that gives the client a recommended camera position when zooming to the object.

I'm not sure about this property. What is the long-term plan? East-north-up is a decent default, but it is not going to work in many air and space situations, when we really want the object's body frame. Is there a longer-term plan to be able to overview east-north-up?

@@ -63,6 +63,24 @@ define([
throw new DeveloperError('projection is required.');
}

/**
* If true, allows the user to pan around the map. If false, the camera stays locked at the current position.
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm confused - is this enableTranslate or enablePan. Panning is more than translating, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Two me they mean the same thing (in 2D) but I could be wrong. I can change the wording but can you explain the difference to me?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh right, this is only on the 2D controller. Translate and pan are the same here.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

@shunter want to look at the DynamicScene changes?

up = arguments[2];
} else {
return;
Camera.prototype.lookAt = function(eye, target, up) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good change. I looked at this function pretty recently, and thought we should get right of using arguments. This is very early code.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

Not that I'm the right person to ask, but the scene-level camera changes are OK with me. There's a bunch of allocations in new code. Is the plan to remove them now or later?

@mramato
Copy link
Contributor Author

mramato commented Sep 13, 2012

I plan on replacing right-click with a single left-click pop-up. This pop-up will ultimately be the balloon for the object as well as other context-sensitive actions. I'm trying to avoid double-clicks so that things can work on mobile as well. I left it the way it was for now because I didn't want to worry about UI and camera behavior at the same time.

@mramato
Copy link
Contributor Author

mramato commented Sep 13, 2012

Can you elaborate on "strange results" One right-click should track and the other should stop tracking.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

Can you elaborate on "strange results" One right-click should track and the other should stop tracking.

When it stops tracking, the user is left in the object's old frame - doesn't seem useful.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

I plan on replacing right-click with a single left-click pop-up. This pop-up will ultimately be the balloon for the object as well as other context-sensitive actions. I'm trying to avoid double-clicks so that things can work on mobile as well. I left it the way it was for now because I didn't want to worry about UI and camera behavior at the same time.

Zoom is so common that it is going to require a shortcut like double-click or double-tap. A context menu will be nice for listing tasks, but we also need to optimize for the common case. Right click is like a secret handshake; the only people that know to do it are the people that were told. I'm pretty sure @kring just hacked it in for a demo.

@mramato
Copy link
Contributor Author

mramato commented Sep 13, 2012

Zooming in and out for satellites works for me, of course if I'm really close it takes a while to zoom out.

@mramato
Copy link
Contributor Author

mramato commented Sep 13, 2012

Good call on the home button, I've been meaning to change it. I'll update it now.

@mramato
Copy link
Contributor Author

mramato commented Sep 13, 2012

The viewFrom is a temporary property for now, a stop gap to enable some demos until we figure out how we want everything to work "for realz"

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 13, 2012

Zooming in and out for satellites works for me, of course if I'm really close it takes a while to zoom out.

Hmm. Perhaps it was the speed because I can't reproduce it now, but it really seemed like it was locked, not just slow to start. I'll let you know if I come across it again.

@mramato
Copy link
Contributor Author

mramato commented Sep 14, 2012

  1. The home button now maintains the current scene mode. The code to do it is more complicated than it needs to be, but one of the main points of this exercise was to expose these kinds of issues. It will be simplified when we better abstract the camera API.
  2. Change zoom-to from right-click to left-double-click. I also changed the behavior so that once you are tracking something, the way to un-track is to either double-click on something else or hit the home button. Double clicking on empty space no longer stops tracking. I think this is much more usable.
  3. You had made a comment on memory allocations; the camera needs a huge amount of cleanup and API overhaul, so I'm not concerned about them yet, they'll get cleaned up on a file-by-file basis as we refactor the API.

@mramato
Copy link
Contributor Author

mramato commented Sep 14, 2012

Assuming I didn't miss anything, this is ready for another round of review.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 14, 2012

These changes are good with me.

@shunter want to look at the DynamicScene code changes and merge?

@@ -226,7 +226,7 @@ define([
billboard.setShow(true);

position = positionProperty.getValueCartesian(time, position);
if (position !== 'undefined') {
if (typeof position !== 'undefined') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I did a grep and found a similar mistake in DynamicBillboardVisualizer. Want to fix that too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. I've been meaning to write a general regex to find these, did you have one, or did you just do a simple search and happen to find it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a single regex, but: grep -r "'undefined'" Source/ | grep -v typeof

Copy link
Contributor

Choose a reason for hiding this comment

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

I should mention that there's still a similar mistake in CentralBody, but all that's changing anyway soon so it's not worth bothering with.

@shunter
Copy link
Contributor

shunter commented Sep 14, 2012

Looks good.

shunter added a commit that referenced this pull request Sep 14, 2012
@shunter shunter merged commit da591fa into master Sep 14, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants