mirror of
https://github.com/umap-project/umap.git
synced 2025-04-29 03:42:37 +02:00
chore: simplify contextmenu items (#2216)
Do not show generic map items when clicking on a feature. cf #2109 Click on map:  Click on feature: 
This commit is contained in:
commit
47364904bd
2 changed files with 12 additions and 4 deletions
|
@ -92,8 +92,9 @@ const FeatureMixin = {
|
||||||
|
|
||||||
onContextMenu: function (event) {
|
onContextMenu: function (event) {
|
||||||
DomEvent.stop(event)
|
DomEvent.stop(event)
|
||||||
const items = this._map.getContextMenuItems(event)
|
const items = this.feature
|
||||||
items.push('-', ...this.feature.getContextMenuItems(event))
|
.getContextMenuItems(event)
|
||||||
|
.concat(this._map.getContextMenuItems(event))
|
||||||
this._map.contextmenu.open(event.originalEvent, items)
|
this._map.contextmenu.open(event.originalEvent, items)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -1688,7 +1688,7 @@ U.Map = L.Map.extend({
|
||||||
this.loader.onAdd(this)
|
this.loader.onAdd(this)
|
||||||
},
|
},
|
||||||
|
|
||||||
getContextMenuItems: function (event) {
|
getOwnContextMenuItems: function (event) {
|
||||||
const items = []
|
const items = []
|
||||||
if (this.hasEditMode()) {
|
if (this.hasEditMode()) {
|
||||||
if (this.editEnabled) {
|
if (this.editEnabled) {
|
||||||
|
@ -1757,6 +1757,11 @@ U.Map = L.Map.extend({
|
||||||
action: () => this.search(),
|
action: () => this.search(),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
return items
|
||||||
|
},
|
||||||
|
|
||||||
|
getContextMenuItems: function (event) {
|
||||||
|
const items = []
|
||||||
if (this.options.urls.routing) {
|
if (this.options.urls.routing) {
|
||||||
items.push('-', {
|
items.push('-', {
|
||||||
label: L._('Directions from here'),
|
label: L._('Directions from here'),
|
||||||
|
@ -1773,7 +1778,9 @@ U.Map = L.Map.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
onContextMenu: function (event) {
|
onContextMenu: function (event) {
|
||||||
const items = this.getContextMenuItems(event)
|
const items = this.getOwnContextMenuItems(event).concat(
|
||||||
|
this.getContextMenuItems(event)
|
||||||
|
)
|
||||||
this.contextmenu.open(event.originalEvent, items)
|
this.contextmenu.open(event.originalEvent, items)
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue