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

BiG-CZ: List Popup #2314

Merged
merged 9 commits into from
Oct 6, 2017
Merged

BiG-CZ: List Popup #2314

merged 9 commits into from
Oct 6, 2017

Conversation

arottersman
Copy link

@arottersman arottersman commented Sep 29, 2017

Overview

When BiG-CZ shapes overlapped we were only able to display the topmost layer. Add a popup that allows browsing details of all the shapes at the clicked point.

Connects #2282

Demo

Multipage

h1d0kybyd2

Single page

screen shot 2017-09-29 at 5 03 44 pm

Notes

gk1zolrtuu

I left the height dynamic for now. When there's only a single item on a page, the above height "jumping" happens. I'm not sure what's desirable @jfrankl

Testing Instructions

  • Pull this branch and bundle
  • Spend some time searching and clicking the results of various catalogs
    • If there's a single shape under your click, the details popup should show
    • If multiple, the list popup should show
    • You should still be able to highlight features by hovering over the sidebar items
    • Searching, switching catalogs, and opening the details of a result should close the popup

@arottersman arottersman changed the title WIP Arr/bigcz layered popup BiG-CZ: List Popup Oct 2, 2017
Copy link
Member

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

This works really well! The code is nice and neat, and the commit message packaging is done in a very accessible and easy to understand manner. Great job!

Regarding the height thing, I agree it is annoying and potentially disruptive, but at the very end of a page list. I think that's a small enough use case for us to not worry about at this time. The only design alternative I can think of is padding the results, but the whitespace may be more awkward than the height change.

Here are a few issues I noticed though:

  1. Hovering on items in the popup list does not highlight them on the map or the sidebar. It should, since it all other interactions work the same.
  2. Clicking on item in the list and then reaching the detail popup does not highlight the item on the map or the sidebar. It should.
  3. Hovering on an item in the sidebar hides the popup. This should not happen. Clicking should hide it, but hovering should not.
  4. In many cases, the title is not useful enough to differentiate in the first few characters that are shown for each item. I wonder if we should have two lines for the titles before (dot dot dot)ing them. This could use the input of @ajrobbins and @jfrankl

I'll take another look once 1, 2, 3 above have been addressed.

},

// Get a list of results intersecting the clicked point
intersectingFeatures = _.reduce(
Copy link
Member

Choose a reason for hiding this comment

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

Prefer using _.filter instead of _.reduce:

intersectingFeatures = _.filter(e.target._layers, intersectsClickBounds);

layer.setStyle(dataCatalogActiveStyle);
result.set('active', true);

layer.on('popupclose', function() {
Copy link
Member

Choose a reason for hiding this comment

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

Is this event handler taken off at any point? Or do they just pile on with more and more clicks?

Copy link
Author

Choose a reason for hiding this comment

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

They were probably piling, good catch. I'm changing this to once

@rajadain rajadain added the BigCZ label Oct 2, 2017
@rajadain
Copy link
Member

rajadain commented Oct 2, 2017

Great job on attaching demo gifs for every use case too 👌

@ajrobbins
Copy link

In many cases, the title is not useful enough to differentiate in the first few characters that are shown for each item. I wonder if we should have two lines for the titles before (dot dot dot)ing them. This could use the input of @ajrobbins and @jfrankl

I think the existing treatment is sufficient, since we don't know what format the title will take (the examples shown here are only one kind of result)

@rajadain
Copy link
Member

rajadain commented Oct 2, 2017

This is one example of important information being cutoff:

image

the first result is for Maryland, the second for Pennsylvania, but that's hard to make out.

@ajrobbins
Copy link

That's a good example of it not accommodating important information. However, the same could be true if we have two lines, since there is no standardization on the result titles coming in from the API.

@arottersman
Copy link
Author

Thanks, @rajadain. Those were good points. I've pushed some additional fixups + commits to address. Properly linking the popup state and map + sidebar was unexpectedly difficult, but I think it's working now (issue described in commit message).

@rajadain
Copy link
Member

rajadain commented Oct 4, 2017

Taking another look at this.

@rajadain
Copy link
Member

rajadain commented Oct 4, 2017

With changes in the latest commit, there seems to be a regression: if a CINERGI shape is too big for the map, it's gold border (which should convert to regular blue) does not "stick" as it should when the details view is open:

2017-10-04 14 22 41

@rajadain
Copy link
Member

rajadain commented Oct 4, 2017

Another one: if a popup is open and its corresponding sidebar element is (correctly) highlighted, and I zoom the map, the popup closes but the highlight gets stuck, and then can't be unhighlighted:

2017-10-04 14 26 19

@rajadain
Copy link
Member

rajadain commented Oct 4, 2017

For WDC, if a popup is open for a single element, hovering on others keeps the yellow highlight of the popup-element there. That is, there are two highlighted elements on the map: one for the popup and another for the sidebar element on which the user is hovering.

For the multi-popups, this does not happen. Hovering on any element in the sidebar removes the highlight of the popup element. This should not happen:

2017-10-04 14 29 08

@rajadain
Copy link
Member

rajadain commented Oct 4, 2017

I'll take another look once these issues have been addressed.

@arottersman
Copy link
Author

Will push a fix soon for the 3rd comment about WDC. I'm having trouble recreating the other two issues described.

With changes in the latest commit, there seems to be a regression: if a CINERGI shape is too big for the map, it's gold border (which should convert to regular blue) does not "stick" as it should when the details view is open:

Here's the blue border I see on the details view:

screen shot 2017-10-05 at 8 55 18 am

Another one: if a popup is open and its corresponding sidebar element is (correctly) highlighted, and I zoom the map, the popup closes but the highlight gets stuck, and then can't be unhighlighted

Here's what happens when I zoom

vbf3jadxvl

@arottersman
Copy link
Author

arottersman commented Oct 5, 2017

@rajadain and I looked together IRL, and he wasn't making up those bugs!

I've squashed down the fixups and added a commit that adds a popupclose listener for the list popup. I think it's mostly fixed the first two issues. The third issue will require a greater refactor; I'll write up a separate card.

Here's a brief recap

With changes in the latest commit, there seems to be a regression: if a CINERGI shape is too big for the map, it's gold border (which should convert to regular blue) does not "stick" as it should when the details view is open

This was recreatable by going to the details view from the list, and then hovering over the map (the highlight would disappear). The popupclose commit seems to have fixed this, though the detail highlight still doesn't show up on FF until you've panned/zoomed the map. I'll make a card.

EDIT: @rajadain showed me this did not fix it. Making an issue

Another one: if a popup is open and its corresponding sidebar element is (correctly) highlighted, and I zoom the map, the popup closes but the highlight gets stuck, and then can't be unhighlighted

We were also able to recreate this together by going from list popup -> detail popup, then closing the popup. I believe it's fixed now.

For WDC, if a popup is open for a single element, hovering on others keeps the yellow highlight of the popup-element there. That is, there are two highlighted elements on the map: one for the popup and another for the sidebar element on which the user is hovering.

For the multi-popups, this does not happen.

This is the one I'll be making an issue for. We currently set the active styling directly on the popup layer, instead of using the map state. We can't do this for the list popup because the popup is on the map, not a specific layer.

@arottersman
Copy link
Author

@rajadain, is it worthwhile to rebase this on develop?

@rajadain
Copy link
Member

rajadain commented Oct 6, 2017

In the interest of not adding things to the release/1.20.0 branch that don't belong there, I would say yes, we should rebase and retarget to develop. Thanks for catching that

@arottersman arottersman changed the base branch from release/1.20.0 to develop October 6, 2017 16:30
Alice Rottersman added 5 commits October 6, 2017 12:32
* Previously we didn't fill the Cinergi boxes, so clicks only registered on
  their borders

* Transparently fill the boxes so we can capture all intersecting clicks
* Previously only the topmost catalog feature would fire a click event

* We want to show all intersected layers per click, move the popup binding into
  an on click handler on the whole FeatureGroup

* Clicks that only intersect a single feature show popups the same as before

* Clicks that intersect multiple features, just log them to the console for now
* Create a new popup view that first shows a list view of all click-intersected
  results. If a list item is clicked, shows the selected result's detail view
Alice Rottersman added 4 commits October 6, 2017 12:34
* The list popups are directly on the map, not tied to any particular layer.
  Close them manually when the catalog is switched or we enter a detail view
* Use Backbone Pageable Collection to paginate popover list view
  when results > 3 items
* Highlight the sidebar list item and map element
  when hovering a popup list

* This involved changing the way we add the "ring" highlight to
  the map when the shape is outside the viewport bounds for
  CINERGI
      - Before we were using jquery to add a "highlight" class
        to the map container. This caused additional mouseenter
        and mouseleave events to fire on the popup list element.
        The cursor and highlighting would flicker
      - Switch to adding a whole DOM element to show the "highlight"
        ring. This does not cause additional mouse events to fire.
@arottersman
Copy link
Author

Rebased on develop, and updated target.

@rajadain
Copy link
Member

rajadain commented Oct 6, 2017

Waiting on #2351 to fix the build, after which this should pass ...

@rajadain
Copy link
Member

rajadain commented Oct 6, 2017

@azavea-bot rebuild

@rajadain
Copy link
Member

rajadain commented Oct 6, 2017

Taking another look to confirm

Copy link
Member

@rajadain rajadain left a comment

Choose a reason for hiding this comment

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

+1 tested. This works well, and we have follow up issues #2335 and #2336 for the rest.

Great work translating the designs and nailing the execution.

@rajadain rajadain assigned arottersman and unassigned rajadain Oct 6, 2017
@arottersman
Copy link
Author

Thanks for all your help with this, and uncovering those bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants