Skip to content
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

Geocoding widget #1157

Merged
merged 59 commits into from
Oct 23, 2013
Merged

Geocoding widget #1157

merged 59 commits into from
Oct 23, 2013

Conversation

kring
Copy link
Member

@kring kring commented Sep 18, 2013

image

There's a lot more I could do here, but I think it's reasonable to merge it into master in its current state.

I suspect the most controversial thing here is the location of the new widget in the Viewer. I originally had it in the top left, but @emackey made the excellent point that we should reserve that for app-specific functionality.

This branch includes all the bingKey changes as well, so the diff will get simpler once that branch is merged.

@mramato
Copy link
Contributor

mramato commented Sep 18, 2013

I'll get this party started. I absolutely hate the location in the upper right. I have two thoughts:

  1. In the Cesium Viewer application, it should be in the upper left. It's an app so there's no reason to reserve space for others. Eventually we'll have to incorporate it with the data source browser somehow.
  2. In the Viewer widget, I see two options.
    • Don't include it at all, in my opinion it's kind of outside the scope of what the Viewer widget is for (a base to build applications. What are the chances that someone wants to have a custom UI in their application and at the same time keep our stock geocoding widget behavior?
    • Include it in the widget in the upper left and people can easily use CSS to move it if they want to use the upper left or they can simply pass in false to the constructor to make it go away.

The upper left is the natural best fit and that's where it should go.

Now with that out of the way, I'll spend some time this week looking at the code and playing with the widget.

@kring
Copy link
Member Author

kring commented Sep 19, 2013

Ha, well, give it some time. It grew on me quite a bit.

I think we're really used to something like that being in the upper left. But that's because we're thinking of apps like Google Maps, where that widget practically is the application. It makes sense for it to be in the most prominent location - the upper left. In Cesium, geocoding is useful, but it's not what we're all about. It makes sense to me to de-emphasize it by moving it elsewhere. And it's pragmatic, too.

At one point I had it to the left of the buttons, instead of above them. I liked that better, but it didn't work well on mobile, at least in portrait mode. I could see putting it back there and making it narrower, and then using some CSS magic to make it wider when it's selected.

I definitely think this belongs in the Viewer widget though. Sure, it may not be useful in every app - that's why you can turn off all the widgets in the viewer, including this one - but it's certainly at least as likely to be useful as the imagery layer picker. Also, it's my understanding that the Viewer widget is supposed to pretty much be our Cesium Viewer app, in widget form, so it doesn't make sense to me to have it on by default in Cesium Viewer, but not in the Viewer widget.

Incorporating it with the data source browser in the future makes sense to me.

Another idea is to demote it to just a button in the Viewer widget. Hit the button and the input box appears below the row of buttons. I'm not sure if I like that better, but it's in line with my theory that geocoding should be de-emphasized in Cesium relative to other mapping apps.

@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 19, 2013

This shouldn't hold up this pull request, but flying from the north pole to the south pole creates a strange flight. I know, I test the craziest things. CC @bagnell

@pjcozzi pjcozzi mentioned this pull request Sep 19, 2013
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 19, 2013

Not really my area but to help move us along...

I don't like that the Chrome FPS covers it up in the upper-right, but that is not our problem. The FPS always covers things up.

I do like that it is near the home button, which is pretty similar functionality. As @kring suggested, I suspect it would look better as a single line across the top when screen real estate permits - most sane cases I imagine. If it's a reasonable amount of work, this would be worth seeing.

Again, not my area, but I would expect this to be in both the viewer widget and the viewer app. I thought the app was just an instance of the widget. If an app doesn't need it, they just remove it like we did for the other buttons for the Orbital app (I suppose; @mramato wrote the code).

@kring
Copy link
Member Author

kring commented Sep 19, 2013

Here's what it looks like next to the buttons at the top, and with a smaller input box:

image

If anyone wants to play with this live I can check it in. Just a tiny tweak to the CSS to change between this and the original layout.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

I'm going to make a few changes to this, I can open a PR if you want, but it's basically just making the focus behavior work like our other widgets.

Fix CHANGES
Move `padding-left` to wide and hover classes so that collapsed version is the right size
Add `hasFocus` binding and document listeners so that the text box disappears in all expected situations.
Cleanup knockout property declarations.
Using the `hasFocus` binding with a knockout-es5 property seems to cause issues.  Instead, bind directly to a low-level observable.
@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

Okay, I fixed a bunch of stuff; give it a try and let me know what you think.

@shunter For some reason the GeocoderViewModel spec fails when run under coverage but passes normally. Any ideas?

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

@shunter never mind, it's working now.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

I think this is just about ready but...

  1. There's a minor knockout issue with the hasFocus binding and es5 knockout properties, but I need to look more into it. It might be a knockout bug. fixed by not using knockout for this part now
  2. On mobile, touches do not affect focus like I would expect, but this is minor for now. This is a hover issue, I'm not sure there's anything we can do about it for now
  3. One thing that would be nice to have is a single button to clear the text field if there's any content in it, but I guess that can wait until later.
  4. Another random thought, should hitting the home button clear the geocoder?

For some reason this still doesn't work as expected on mobile.  I think our touch handling in the cameara may be eating the event.
@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

It just occurred to me that none of our other widgets active on hover (SceneModePicker, BaseLayerPicker) should be be consistent? The main problem is that hover gives us issues on mobile (to the point where I would recommend we get rid of hover completely for Geocoder and require a click). Thoughts?

@emackey
Copy link
Contributor

emackey commented Oct 23, 2013

Text-entry widgets are traditionally a little different than drop-down widgets. I think the current behavior is good.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

My only real issue with the current behavior is the mobile issue. I think we can work around this by removing the hover affect for touch-enabled devices, but it's not critical for this PR.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

Okay, I'm done tweaking this unless anyone has anymore feedback. @emackey, let us know when you are done as well and then @shunter can do the final review and merge.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

Another random thought, we need to expose an even for detecting when the generate flight is complete, this way a user can perform some action (such as setting the camera transform so rotation is around the geolocated position). This can be in a future PR, I just wanted to mention it here. Once this is in master, I'll write up separate Github issues for any ideas in this PR that didn't make it in.

* @type {Boolean}
* @default false
*/
knockout.defineProperty(this, 'isSearchInProgress', {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sadly, jsDoc doesn't pick this up, it's not smart enough to parse knockout.defineProperty.

Same comment for searchText, flightDuration, etc.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good catch, I'll fix it.

@emackey
Copy link
Contributor

emackey commented Oct 23, 2013

This branch looks good. 👍

@shunter can you review & merge? Thanks!

@shunter
Copy link
Contributor

shunter commented Oct 23, 2013

It looks like somewhere along the line, the magnifying glass icon lost its click handler, so clicking it does nothing. I assume this was a mistake?

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

I'm looking at it now.

@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

I'm not sure how it ever worked, should be fixed now.

@emackey
Copy link
Contributor

emackey commented Oct 23, 2013

FWIW, it worked by submitting the form. Maybe the button should be a real button not a span, and set .type='submit' ? Or just merge this 😄

shunter added a commit that referenced this pull request Oct 23, 2013
@shunter shunter merged commit 21ee7f8 into master Oct 23, 2013
@shunter shunter deleted the geocodingWidget branch October 23, 2013 15:36
@mramato
Copy link
Contributor

mramato commented Oct 23, 2013

Now none of us have to get @pjcozzi anything for Christmas 😄

@mramato mramato mentioned this pull request Oct 23, 2013
9 tasks
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.

6 participants