Skip to content

Commit

Permalink
Adds check for queryable layer before handling link (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadayubi authored Apr 14, 2021
1 parent dbfdb31 commit 4ef236d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/mapml/features/feature.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,16 @@ export var Feature = L.Path.extend({
L.DomEvent.on(path, 'mousedown', () =>{ drag = false;}, this);
L.DomEvent.on(path, 'mousemove', () =>{ drag = true;}, this);
L.DomEvent.on(path, "mouseup", (e) => {
L.DomEvent.stop(e);
if(!drag) M.handleLink(link, leafletLayer);
let onTop = true, nextLayer = this.options._leafletLayer._layerEl.nextElementSibling;
while(nextLayer){
if(nextLayer.tagName && nextLayer.tagName.toUpperCase() === "LAYER-")
onTop = !(nextLayer.checked && nextLayer._layer.queryable);
nextLayer = nextLayer.nextElementSibling;
}
if(onTop) {
L.DomEvent.stop(e);
if (!drag) M.handleLink(link, leafletLayer);
}
}, this);
L.DomEvent.on(path, "keypress", (e) => {
L.DomEvent.stop(e);
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/core/featureLinks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jest.setTimeout(50000);
beforeAll(async () => {
browser = await playwright[browserType].launch({
headless: ISHEADLESS,
slowMo: 50,
slowMo: 100,
});
context = await browser.newContext();
page = await context.newPage();
Expand Down

0 comments on commit 4ef236d

Please sign in to comment.