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

Right click layerlist layer #211

Merged
merged 22 commits into from
Nov 8, 2015
Merged

Right click layerlist layer #211

merged 22 commits into from
Nov 8, 2015

Conversation

alukach
Copy link
Member

@alukach alukach commented Oct 26, 2015

In response to the comments on #205, here's a first-shot at adding right-click menu support for layers on the layerlist.

This entailed a bit of a refactor in the way menus currently worked. Each menu (left sidebar, operations menu, and right-click context-menu) was separated out into separate files and namespaces (dc.menus.left, dc.menus.geo, and dc.menus.layerContextMenu). A 'layerlist:added' signal was created to return newly added layers.

Currently, the right-click context menus only work on a single layer.

right-click-layer

There's still work to be done:

  • Add support for right-click operations on multiple selected layers.
  • Limit context-menu options based on layers selected (eg 'rename' would only apply to single layer selections but 'zoom to extent' could take many layers).
  • Write tests
  • Remove redundant operations from left sidebar (likely everything under 'Geo Actions').
  • Remove icons from layerlist layer item (the 'duplicate' operation should be moved to the right-click menu, the 'remove layer' operation should be removed). Should this be done?
  • Add 'right-click' tip to "Welcome to dropchop!" text

I'm opening this up to get feedback. Is this the right direction for DropChop?

'expand': dc.ops.file['expand'],
'combine': dc.ops.file['combine'],
'rename': dc.ops.file['rename'],
'remove': dc.ops.file['remove'],
Copy link
Member Author

Choose a reason for hiding this comment

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

This was written before I saw how #208 rewrote how functions were loaded with the Left Sidebar Menu. This could probably be refactored to more closely match that style for the sake of simplicity. One win that this style has is that it could allow operations to be pulled from different files.

@alukach
Copy link
Member Author

alukach commented Oct 26, 2015

Supporting multiple layers turned out to be easier than I expected.

right-click-layer

@mapsam
Copy link
Member

mapsam commented Oct 26, 2015

Wowowow this is great! I'm very much into the idea of splitting menus into their own file, since they are growing larger. This makes a lot more sense (i.e. feels more droppychoppy) as well - the left-hand "geo actions" felt a bit forced, and very unintuitive since it all related to the layers you had selected anyways. 👍 for pushing this 😃

@alukach
Copy link
Member Author

alukach commented Oct 26, 2015

@mapsam great, glad you're into it. Feel free to add some styling changes/suggestions to the menu.

Got validation on the context-menu operations completed:

right-click-layer

@alukach
Copy link
Member Author

alukach commented Nov 2, 2015

Update on this:

  • Removed icons on side of layers, add an ellipses to indicate "more options". Left-clicking on ellipses button triggers right-click event (for touch-screen users)
  • Added headers to the context-menu to allow the operations to be organized. Not sure about this feature, thoughts?
  • problem: Currently, it's possible for a context menu to go offscreen. This can occur when right-clicking on layers near the bottom of the layerlist. Not sure what to do about this, adding a scrollbar (and autosizing the context menu) seems difficult.

right-click-menu

@mapsam
Copy link
Member

mapsam commented Nov 2, 2015

This is looking really great.

I think the overflow issue can be solved by doing a little bit of math - checking the height of the menu and the window and ensuring it never generates beyond it. I'd be happy to work on this part sometime this week!

@alukach
Copy link
Member Author

alukach commented Nov 4, 2015

@mapsam feel free to take a crack on keeping the menu on the screen. I admit that I hadn't really thought about just comparing the div size and placement to the window size and to ensure that it stays on screen, that sounds like a solid solution.

@mapsam
Copy link
Member

mapsam commented Nov 4, 2015

I'll take a look - I'm in my last week out in Richmond for Code for America so might not get to it this week - feel free to try and merge in and I can take a crack in a separate branch!

@alukach
Copy link
Member Author

alukach commented Nov 7, 2015

right-click-menu2

Some style changes. Just to add some tests now...

@mapsam
Copy link
Member

mapsam commented Nov 7, 2015

Added the portion to calculate the menu location based on the window size. Seems to be working nicely. I'm a big fan of this menu system, it's much improved @alukach!

Not sure why my version is missing those style changes, but hopefully it didn't bork anything!

dropchop-contextmenuoverflow

@mapsam
Copy link
Member

mapsam commented Nov 7, 2015

@alukach whenever you think this is ready to roll, feel free to merge!

alukach added a commit that referenced this pull request Nov 8, 2015
@alukach alukach merged commit 210cb77 into master Nov 8, 2015
@mapsam mapsam deleted the right-click-layerlist-layer branch November 8, 2015 03:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants