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

Replace radial menu with a context menu #3753

Merged
merged 29 commits into from
Feb 25, 2017
Merged

Replace radial menu with a context menu #3753

merged 29 commits into from
Feb 25, 2017

Conversation

kepta
Copy link
Collaborator

@kepta kepta commented Jan 13, 2017

Todo

  • Fix the tooltip
  • Remove the redundant variables for adjusting the position of svgs in edit_menu.js
  • Fix the failing test cases

(closes #3671 )

@kepta kepta added the wip Work in progress label Jan 13, 2017
@bhousel
Copy link
Member

bhousel commented Jan 18, 2017

Hey @samanpwbb can you check the screenshot here #3671 (comment)
and let us know if you have any thoughts?

@samanpwbb
Copy link
Member

samanpwbb commented Jan 19, 2017

I think the whole form can be vertically condensed, and simplified. I would lose the semitransparent background – it's distracting and less legible than a solid background. If you make the background solid, you will be able to remove the round fills from under the action icons, which will allow you to cut a good amount of vertical space from the design. End result will be cleaner looking and easier to use.

@kepta kepta removed the wip Work in progress label Feb 7, 2017
@kepta
Copy link
Collaborator Author

kepta commented Feb 7, 2017

@bhousel I feel this is done.
This test iD.behaviorSelect "before each" hook for "refuse to enter select mode with no ids": randomly fails on travis. :/

right2

Could you review it ?
I have kept the radial_menu.js for semver reasons, ( related question: what should I do with the css styles named radial_menu, currently edit_menu.js uses them ? )
I hope I am not missing any test cases like I did for the nominatim patch.

@kepta
Copy link
Collaborator Author

kepta commented Feb 7, 2017

I tried a white style. Notice the slimmer height of each operation and a disable cursor.
white

cc: @samanpwbb @rasagy

@kepta
Copy link
Collaborator Author

kepta commented Feb 8, 2017

As per talk with @rasagy, he suggested on removing the operations which are always disabled.
This would help reduce the height of context menu.
We took a bunch of screenshots.

screen shot 2017-02-08 at 12 33 42 pm

In this example, the button would always be disabled.
screen shot 2017-02-08 at 12 34 00 pm
screen shot 2017-02-08 at 12 34 19 pm

vvv These examples need to show the operation.
screen shot 2017-02-08 at 12 36 46 pm
screen shot 2017-02-08 at 11 13 42 am

@kepta kepta force-pushed the edit_menu branch 2 times, most recently from c540e89 to df71690 Compare February 8, 2017 08:08
@bhousel
Copy link
Member

bhousel commented Feb 8, 2017

As per talk with @rasagy, he suggested on removing the operations which are always disabled.
This would help reduce the height of context menu.
We took a bunch of screenshots.

I know that the disabled icons were always there for discoverability. I still think messages like "This feature can't be made circular because it's not a loop" are important for users to see.

Maybe we can just make the icons smaller? This menu doesn't need to be so much bigger than the browser's default contextmenu.

I really like the light style! 👍

@slhh
Copy link
Contributor

slhh commented Feb 9, 2017

@bhousel
Discoverability is important, but we don't need to overdo it. Always showing every operation seems to be too much, but this doesn't mean that we should always hide disabled operations.
We should always think about what is really required to make the specific operation sufficiently discoverable.

For example "Circularize":
Someone who is not working with nearly circular features doesn't need "Circularize".
Someone who is working with such will eventually select such a feature and discover the "Circularize" operation, even if it is shown in case of nearly circular closed features only.

I still think messages like "This feature can't be made circular because it's not a loop" are important for users to see.

Showing this message can be limited to the case of a nearly closed, nearly circular way.

Maybe we can just make the icons smaller? This menu doesn't need to be so much bigger than the browser's default contextmenu.

Doesn't this make the icons too unspecific? Otherwise I would agree.
Maybe we can reduce the height of the menu rows, but place the icons aligned in two colums alternatingly (zigzag pattern).

@kepta kepta force-pushed the edit_menu branch 3 times, most recently from b8f4928 to 308917e Compare February 9, 2017 10:07
Fixed

- On reselecting multiple entities, right click doesn’t discard selection

- On selecting new entity, right click discards previous selection
- Preserved shift selection for both left & right click
@rasagy
Copy link

rasagy commented Feb 9, 2017

I know that the disabled icons were always there for discoverability. I still think messages like "This feature can't be made circular because it's not a loop" are important for users to see.

@bhousel I think the idea was not to hide all the disabled icons, but only ones that didn’t seem relevant for a particular feature. On exploring a bit with @kepta, we realized that this already happens. Here’s what we felt: actions that might be disabled due to the feature not being in the screen should be shown, since they explain why something can’t be done, but actions that won’t be possible for a feature (straight road would never be able to Circularize), it only adds more confusion.

Do you think there are more cases — like Circularize for straight roads — that would be disabled regardless of the context? If this isn’t common, then maybe we can take a quick call on hiding Circularize when it’s not relevant.

@bhousel
Copy link
Member

bhousel commented Feb 9, 2017

The iD architecture document mentions disabled operations a bit here: https://github.com/openstreetmap/iD/blob/master/ARCHITECTURE.md#operations-module

I don't know who the original author of this section was, but I think it's still important to show disabled operations for discoverability.

The menu is there for teaching in addition to using. So please keep Circularize on the menu, but disabled for straight roads.

@@ -23,6 +23,12 @@ export function behaviorSelect(context) {


function click() {
var rtClick = d3.event.type === 'contextmenu';
Copy link
Member

Choose a reason for hiding this comment

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

contextmenu is not quite right click. On a Mac it fires on mousedown, and on Windows it fires on mouseup.

The code here might be totally ok, this is just a reminder to myself to check the reselection behavior on Windows.

} else {
var point = context.mouse(),
viewport = geoExtent(context.projection.clipExtent()).polygon();
viewport = geoExtent(context.projection.clipExtent()).polygon(),
Copy link
Member

Choose a reason for hiding this comment

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

I have to check, I think there is a context.map().trimmedExtent() that can be used to get a smaller viewport avoiding UI controls around the edges.

Copy link
Collaborator Author

@kepta kepta Feb 10, 2017

Choose a reason for hiding this comment

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

Yes, it totally makes sense to use context.map().trimmedExtent().
I also created this context.map().trimmedExtentPadding(p) for the lane work, which accepts additional padding, should we have such a thing?

Copy link
Member

Choose a reason for hiding this comment

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

I also created this context.map().trimmedExtentPadding(p) for the lane work, which accepts additional padding, should we have such a thing?

Instead of adding another method, can we just have trimmedExtent accept an optional argument with a padding rect?

@@ -311,7 +311,7 @@ export function rendererMap(context) {
function resetTransform() {
if (!transformed) return false;

surface.selectAll('.radial-menu').interrupt().remove();
surface.selectAll('.edit-menu').interrupt().remove();
Copy link
Member

Choose a reason for hiding this comment

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

If we're going to keep .radial-menu around for backward compatibility and fork projects, we need to include it in the selector here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, so we will end up having two of these (one for radial, other for edit).
I am thinking if about all the cleaning that would need to be done for a major release ..

Copy link
Member

Choose a reason for hiding this comment

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

I think that is ok.. selectAll takes a CSS selector, so it can be written like:

surface.selectAll('.radial-menu, .edit-menu').interrupt().remove();

We can tell people that the radial menu is deprecated and will be removed in iD v3.

@@ -143,7 +143,7 @@ export function uiIntroPoint(context, reveal) {
context.history().on('change.intro', deleted);

setTimeout(function() {
var node = d3.select('.radial-menu-item-delete').node();
var node = d3.select('.edit-menu-item-delete').node();
Copy link
Member

Choose a reason for hiding this comment

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

Reminder to 1. keep radial-menu classes around for backward compat. 2. test what this actually does when we run through the tutorial.

@bhousel
Copy link
Member

bhousel commented Feb 10, 2017

I edited a lot with this today to test it out. Overall it's great.
I really don't miss the menu except in one situation, and that's when operations are disabled.

One example of this is: I'd draw a building and hit S to square the corners of it, and nothing would happen because too much of the building is off screen. Normally you would be able to see the menu with the disabled icons and realize that something is preventing you from running the command. But without a menu, I'd find myself wondering whether the command ran or not, and just keep hitting S, then eventually right-click to see the menu and realize what was going on.

This is a hard problem to solve elegantly. #1734 touches on this - "Better indication when an action is selected". That issue is, sometimes a user will do something by accident and not realize that the action happened. But now without a menu, it's also possible for a user to try to do something on purpose and not realize when the action didn't happen.

I'm thinking for keyed operations initiated by the user, we should maybe take the message that we already use for undo/redo (e.g. "Made an area circular") and flash it in the corner of the screen. If the operation is disabled, instead flash the disabled message "This can't be made circular because it isn't a loop".

Flash messages are really hard to get right, in a way that is tasteful, enjoyable, and delights the user instead of being annoying. But it would close #1734 and help us replace the visual clues that we lose by not popping up the context menu on every select. I'm going to prototype this idea and see how it turns out.

@kepta
Copy link
Collaborator Author

kepta commented Feb 10, 2017

@bhousel I like the idea of notifying the user that something is not allowed. In the Mac they play that famous sound when an operation is disabled.
I just want to make sure, by flash messages, we are not planning to blink or do something fancy to grab the users attention right?

I really like the way visual studio code shows alerts. They just overlay them on the top.
screen shot 2017-02-11 at 12 24 21 am

Maybe we could do something similar for iD? Showing the alert at the top (even if it hides something). Some of these alerts would go off and some wouldn't , depending on the severity.
This is also similar to how iOS shows notifications.

@bhousel
Copy link
Member

bhousel commented Feb 17, 2017

Latest version.. I like it! Thoughts @samanpwbb @kepta ?

footer_flash_w_icon

@kepta
Copy link
Collaborator Author

kepta commented Feb 17, 2017

@bhousel, I would love to see a different colour on it. (😅 pink looks good to me)

@bhousel bhousel mentioned this pull request Feb 17, 2017
@runnabot
Copy link

Deployed iD-runnable/edit_menu. View on Runnable.
From Runnable

@bhousel
Copy link
Member

bhousel commented Feb 17, 2017

Final stuff:

  • Show operation title above tooltip
  • Check contextmenu/right-click especially on Windows
  • Check contextmenu preventdefault (right click seems to bring up menu but not activate frame?)
    Update: I don't know how to fix this by simulating a click, not important now.
  • Preserve backward compatibility of radial menu
  • Update walkthrough
  • RTL

@bhousel bhousel merged commit bf71756 into master Feb 25, 2017
@bhousel
Copy link
Member

bhousel commented Feb 25, 2017

This was merged! 🎉
Thanks @kepta @rasagy @samanpwbb & @slhh!

@bhousel bhousel deleted the edit_menu branch February 25, 2017 20:33
@bhousel bhousel removed the wip Work in progress label Feb 25, 2017
@kepta
Copy link
Collaborator Author

kepta commented Feb 26, 2017 via email

@gmaclennan
Copy link
Contributor

Great work! Testing this in Chrome 56.0.2924.87 when I select an element and hit SPACE to bring up the edit menu, it appears in the top right of the screen, away from the selected element.

@bhousel
Copy link
Member

bhousel commented Feb 26, 2017

Great work! Testing this in Chrome 56.0.2924.87 when I select an element and hit SPACE to bring up the edit menu, it appears in the top right of the screen, away from the selected element.

Good catch, I notice that too.. I'll open a new issue for it..

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.

Radial Menu is full
7 participants