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

Add contextual menu on feature click in gmf-drawfeature #1021

Merged
merged 1 commit into from Apr 18, 2016

Conversation

adube
Copy link
Contributor

@adube adube commented Apr 12, 2016

This PR introduces the ngeo.Menu overlay, which consists in a contextual menu configurable with any number of actions. When an action is clicked, it dispatches an event. It can be closed with a close button, or automatically closed when an action is clicked (optional).

This PR also implements a ngeo.Menu in the gmf-drawfeature directive that is shown when a feature is clicked with the following actions:

  • Move (works, behaviour is the one from the spec)
  • Rotate (does nothing for now)
  • Delete (deletes the feature properly)

Todo

  • merge in one commit
  • add a marker at the center of the feature when the translate is active
  • confirm how we should manage the images required to style the center marker
  • only allow moving the feature ONCE (as specified in the spec)
  • rebase onto master once GMF draw feature directive #1001 is merged
  • use fontawesome instead of glyphicons
  • use bootstrap panel and list
  • wait for ol3 to review/merge the patch that allows filtering the translatable layers
  • file renamed translate.js
  • prevent Point and Text to show the contextual menu, at all.
  • Make sure the menu disappears when the feature is deselected
  • code review (by @fgravin)
  • travis pass

Live example

@adube adube force-pushed the gmf-drawfeature-menu branch 2 times, most recently from d6cf905 to 9c8d1e5 Compare April 12, 2016 15:59
@adube
Copy link
Contributor Author

adube commented Apr 12, 2016

@fgravin Ready for review.

*/
this.menu_ = new ngeo.Menu({
actions: [{
cls: 'glyphicon glyphicon-move',
Copy link
Member

Choose a reason for hiding this comment

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

We use Font Awesome or custom fonts

@fgravin
Copy link
Member

fgravin commented Apr 12, 2016

Looks good, but please could you use bootstrap styling for the overlay look.
See dropdown-menu class that should display something nicer.
Also, use font-awesome fonts instead of glyphcons.

@adube
Copy link
Contributor Author

adube commented Apr 12, 2016

@fgravin for the dropdown-menu of Bootstrap, I disagree. Have you looked at its style ? It's made to be shown with absolute positioning (to be a drop-down menu). This is not a drop down menu. It's a plain and simple menu. It would take a lot of dissembling of CSS we don't want. In addition, it doesn't support having an X button. Also, it doesn't support having a title like what we're looking for.

Thoughts ?

@adube
Copy link
Contributor Author

adube commented Apr 12, 2016

@fgravin I decided to include the "translate" interaction in this PR to have an additional menu item working. It's not yet completed, so you can put your review on hold, if you want.

@fgravin fgravin changed the title Add contextual menu on feature click in gmf-drawfeature (WIP) - Add contextual menu on feature click in gmf-drawfeature Apr 13, 2016
@pgiraud
Copy link
Contributor

pgiraud commented Apr 13, 2016

We should use bootstrap components and styles as much as possible instead of adding our own styles. The main goal behind this is to be able to customize the global styling, all in once.
What about using panels with list-groups?

http://www.codeply.com/go/Ai9qz7aVyG

@adube
Copy link
Contributor Author

adube commented Apr 13, 2016

+1

@adube adube force-pushed the gmf-drawfeature-menu branch 2 times, most recently from 53b23a4 to f747d85 Compare April 13, 2016 15:30
@adube adube changed the title (WIP) - Add contextual menu on feature click in gmf-drawfeature Add contextual menu on feature click in gmf-drawfeature Apr 13, 2016
@adube
Copy link
Contributor Author

adube commented Apr 13, 2016

@fgravin Ready for review.

@@ -0,0 +1,279 @@
goog.provide('ngeo.interaction.Translate');
Copy link
Member

Choose a reason for hiding this comment

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

Why transform for the file name ?

@fgravin
Copy link
Member

fgravin commented Apr 13, 2016

When you click on the arrow icon for the translation, it pans the map.

@fgravin
Copy link
Member

fgravin commented Apr 13, 2016

Looks good, keep going this way.
Some minor comments though

@adube
Copy link
Contributor Author

adube commented Apr 13, 2016

In order to prevent the map from being "panned" while dragging the center feature, I created a PR in OL3 that fixes this: openlayers/openlayers#5228

It features the possibility to define the layers you want to use as filter for the forEachFeatureAtPixel method. Let's wait for OL3 to review.

@adube adube force-pushed the gmf-drawfeature-menu branch 4 times, most recently from e68e70e to 73609b4 Compare April 14, 2016 13:02
@adube
Copy link
Contributor Author

adube commented Apr 14, 2016

The PR in OL3 has been merged. Ready for final review.

@pgiraud Would you please take care of finalizing the review ? The code itself has already been reviewed, but not the UI. Thanks.

@pgiraud
Copy link
Contributor

pgiraud commented Apr 15, 2016

I'll be happy to review this once #1016 is merged and the current pull request is rebased. I want to see it working with visual selection.
If it's not the case already, please make sure that the menu is hidden when a feature is deselected.

@adube adube force-pushed the gmf-drawfeature-menu branch 2 times, most recently from 76b9a00 to fd13dc9 Compare April 15, 2016 15:48
@adube
Copy link
Contributor Author

adube commented Apr 15, 2016

@pgiraud Ready for review. The live example is up-to-date.

@adube
Copy link
Contributor Author

adube commented Apr 18, 2016

I just rebased onto master.

@fgravin, you can pick this one up from @pgiraud and do the review, please.

@fgravin
Copy link
Member

fgravin commented Apr 18, 2016

What is new since my last comment ? For me it was good !
Also, to make review easier, please keep commit history within the PR. We can squash them in the end when it's ready to merge, but even better, github now provide a feature to auto squash all commits from a PR while merging it. So you don't even have to worry about this anymore.

Thanks

@adube
Copy link
Contributor Author

adube commented Apr 18, 2016

Excellent. Thanks.

What's new:

  • prevent text and point to show the drop down menu
  • make sure that the menu is closed on deselect

There's nothing much in terms of "code" to validate again.

@fgravin
Copy link
Member

fgravin commented Apr 18, 2016

OK LG, is it ready to merge ?

@adube
Copy link
Contributor Author

adube commented Apr 18, 2016

Yes.

@fgravin fgravin merged commit 2cb8371 into camptocamp:master Apr 18, 2016
@adube adube deleted the gmf-drawfeature-menu branch April 18, 2016 15:18
@sbrunner sbrunner added this to the Older milestone Aug 23, 2019
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.

None yet

4 participants