Problem with Leaflet / Mapbox.js
I have a problem building an app with a leaflet map.
There is no click-event fired when clicking on a marker on the map. This is because angular-material is catching all click-events that are not from material itself.
Any idea how i could fix this?
Can you provide a Codepen or Plunker so we can help you debug?
Hi, I have made a small Codepen showing the problem. http://codepen.io/anon/pen/QwMEdq
It doesn't work because of this piece of code, but if i remove it every click gets fired twice.
document.addEventListener('click', function(ev) {
// Prevent clicks unless they're sent by material
if (!ev.$material) {
ev.preventDefault();
ev.stopPropagation();
}
}, true);
This issue popped up with mdGestures, and is similar to https://github.com/angular/material/issues/1326. Reviewing it with @ajoslin.
There are several ways to fix this, I'll have to think about it.
Leaflet will work on desktop now. On Wed, Jan 28, 2015 at 18:39 Marcy Sutton [email protected] wrote:
This issue popped up with mdGestures, and is the same issue as #1326 https://github.com/angular/material/issues/1326. Reviewing it with @ajoslin https://github.com/ajoslin.
— Reply to this email directly or view it on GitHub https://github.com/angular/material/issues/1300#issuecomment-71959183.
It may also work on mobile. Could you test it and report back your results? On Wed, Jan 28, 2015 at 19:39 Andrew Joslin [email protected] wrote:
Leaflet will work on desktop now. On Wed, Jan 28, 2015 at 18:39 Marcy Sutton [email protected] wrote:
This issue popped up with mdGestures, and is the same issue as #1326 https://github.com/angular/material/issues/1326. Reviewing it with @ajoslin https://github.com/ajoslin.
— Reply to this email directly or view it on GitHub https://github.com/angular/material/issues/1300#issuecomment-71959183.
I've tested on desktop and everything is working perfectly. Tests on mobile will follow.
Closing for now, let us know if there is still an issue.
@ajoslin @marcysutton I have this issue on both chrome and safari for iOS with v0.9.0-rc3.
Leaflet click events are firing on desktop, but nothing on mobile.
Firmware: iOS 8.3 Safari: 8 Chrome: v42.0.2311.47
For mobile solutions that are also using jQuery, you can now use $mdGestureProvider in
app = angular.module('MyApp', ['ngMaterial'])
.config(function( $mdGestureProvider ) {
$mdGestureProvider.skipClickHijack();
});
This will configure $mdGesture to not intercept clicks (stop propagation and prevent defaults).
If your issues persists, please open a new issue. Do not comment on this one.
That did the trick! Thanks a mil
@dg1202 - #ftw, excellent. Thanks for using Angular Material.
I had the same issue with Leaflet maps. This fix worked for me.
thx a ton...
I'm using Angular Leaflet Directive with Angular Material Design. The controls on the map on mobile devices don't work. If I use $mdGestureProvider.skipClickHijack();, what features of Material Design do I lose? Am I making a sacrifice?
@adam-s I just tried to use one of the md-swipe directives e.g md-swipe-right, and they do not work if I use the $mdGestureProvider.skipClickHijack();-call. I ended up using angular's ng-touch directive instead.