Skip to content

Commit

Permalink
Merge pull request #1893 from geoadmin/fix_contextpopup
Browse files Browse the repository at this point in the history
Fix contextpopup
  • Loading branch information
gjn committed Nov 25, 2014
2 parents e03b436 + d1dd5ed commit dc532f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
15 changes: 6 additions & 9 deletions src/components/BrowserSnifferService.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
move: 'mousemove',
end: 'mouseup',
over: 'mouseover',
out: 'mouseout'
out: 'mouseout',
menu: 'contextmenu'
},
touch: {
start: 'touchstart',
Expand All @@ -70,23 +71,19 @@
move: 'MSPointerMove',
end: 'MSPointerUp',
over: 'MSPointerOver',
out: 'MSPointerOut'
out: 'MSPointerOut',
menu: 'contextmenu'
},
pointer: {
start: 'pointerdown',
move: 'pointermove',
end: 'pointerup',
over: 'pointerover',
out: 'pointerout'
out: 'pointerout',
menu: 'contextmenu'
}
};

if ($window.oncontextmenu) {
events.mouse.menu = 'contextmenu';
events.msPointer.menu = 'contextmenu';
events.pointer.menu = 'contextmenu';
}

var eventsKeys = events.mouse;
if (usePointerEvents) {
eventsKeys = events.pointer;
Expand Down
9 changes: 3 additions & 6 deletions src/components/contextpopup/ContextPopupDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
event.stopPropagation();
event.preventDefault();

//On Max, left-click with ctrlKey also fires
//On Mac, left-click with ctrlKey also fires
//the 'contextmenu' event. But this conflicts
//with selectByRectangl feature (in featuretree
//with selectByRectangle feature (in featuretree
//directive). So we bail out here if
//ctrlKey is pressed
if (event.ctrlKey) {
Expand Down Expand Up @@ -155,10 +155,7 @@
};


if (gaBrowserSniffer.events.menu) {
// On surface tablet a 'contextmenu' event is triggered
// on long press.
// Listen to contextmenu events from the viewport.
if (!gaBrowserSniffer.mobile && gaBrowserSniffer.events.menu) {
$(map.getViewport()).on(gaBrowserSniffer.events.menu, handler);
element.on(gaBrowserSniffer.events.menu, 'a', function(e) {
e.stopPropagation();
Expand Down

0 comments on commit dc532f5

Please sign in to comment.