ContextMenu Issue (no prevoius solutions work)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

ContextMenu Issue (no prevoius solutions work)

rtaylor
This post has NOT been accepted by the mailing list yet.
I'm trying to surpress the right click context menu because it interferes with my own right click menu. I'm using OpenLayers with ExtJS.

I've tried several solutions, preventDefault, stopPropagation, stopEvent, nocontextmenu solution, etc... NONE of these have worked.

Here is my code:

mapView.map.events.register('mousedown', mapView.map, Ext.bind(this.onMouseClick, this));

onMouseClick: function(e)
{
        if (OpenLayers.Event.isRightClick(e))
        {
                if(e.preventDefault)
                {
                        e.preventDefault();
                }
                if(e.stopPropagation)
                {
                        e.stopPropagation();
                }
                var control = this.getRightClickController();
                control.show(e);
        }
},

//RightClickController
show: function(e)
{
        var view = this.getRightClickView(); // my menu
        view.showAt(e.xy);
},

Is the issue that the event is an OpenLayers event?

I only have the problem of the Browser Context Menu popping up if I am calling showAt(e.xy), if I just call show(), I don't have this problem but the menu only appears in the center of the screen.

I'm also open to solutions for calling just 'show()' and then moving the menu to the mousePosition.

Thanks.