Add contextmenu for map and markers#202
Conversation
…rols before adding event handlers This prevents click events (including contextmenu) from being passed on to other map handlers when clicking on the controls
Replace with marker specific menu that allows toggling of found state Needs testing on mobile
…he selected marker
| const pinIconSize = size * 0.5; // Size to draw the FA icon on a pin marker | ||
| const pinCentreYOffset = pinIconSize * -0.25; // Y offset from centre of icon to centre for a pin | ||
| const ptIconSize = size * 0.7; // Size to draw the FA icon on a point marker | ||
| const ptCentreYOffset = 0; // Y offset from centre of icon to centre for a pin | ||
| const ptCentreYOffset = pinIconSize * 0; // Y offset from centre of icon to centre for a pin |
There was a problem hiding this comment.
"Size" here is unit-less, which is a bit confusing for me. It seems to be a proportion of the original size, and not a specific size like "10 pixels". So for clarity I'd suggest renaming it to something like pinIconScalingFactor ?
In the line you modified, it's not clear why you're multiplying that scaling factor by another value to get a specific number of ... pixels? pts? It's not clear. But anyway, the code is converting a proportion to concrete units and it's not clear to me what's going on here.
| if(iconName == 'face-smile' || iconName == 'player.red'){ | ||
| console.log('playerstart'); | ||
| } |
There was a problem hiding this comment.
Nit: Use console.debug instead of console.log, to better communicate the intent.
|
|
||
| DomEvent.disableClickPropagation(this._container); | ||
|
|
There was a problem hiding this comment.
This is a customization of a 3rd-party vendored import, and so it's probably wise to earmark this as such (both here and at the top of the file) so that we know to port these forward in case we end up upgrading this library in the future.
| L.DomEvent.disableClickPropagation(container); | ||
|
|
There was a problem hiding this comment.
Ditto to my comment about library customizations.
Initially main map has 'add map pin' and markers can toggleFound and move player position - which updates the delta altitude values.
I created a fork of leaflet.contextmenu and updated a bunch of stuff, then integrated that into the project.