Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rightclicking on Div (infobox) is Disabled. How do I enable it

I am using the Infobox plugin for Google Maps V3 API. http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/docs/reference.html

Problem: When I rightclick on the infobox div, nothing happens. Same goes for any div that is the child of the parent infobox div. However I have an input box that contains some text that I want to be able to select and rightclick copy.

How can this be done if I cannot rightclick on it? More importantly, how can I enable right clicking?

Example

http://google-maps-utility-library-v3.googlecode.com/svn/trunk/infobox/examples/infobox-basic.html


JS Code Does not work

var infoboxOptions = {
    content: boxText,
    disableAutoPan: true,
    maxWidth: 0,
    pixelOffset: new google.maps.Size(0, 0),
    zIndex: null,
    infoBoxClearance: new google.maps.Size(5, 5),
    closeBoxURL: '',
    isHidden: true,
    pane: "floatPane",
    enableEventPropagation: false,
    contextmenu: true
    };
like image 970
Nyxynyx Avatar asked Dec 26 '11 05:12

Nyxynyx


3 Answers

I modifed the infobox.js code to get it working.

Changed this:

    this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);

to this:

    this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", cancelHandler);

DISCLAIMER: this may have other ill effects I am not aware of as I didn't test it thoroughly, but it works in my case.

like image 179
johntrepreneur Avatar answered Nov 07 '22 05:11

johntrepreneur


Just add "contextmenu: true" to the set of options

like image 29
Fenec Avatar answered Nov 07 '22 05:11

Fenec


I pulled this from the infobox.js source:

  • @property {boolean} enableEventPropagation Propagate mousedown, click, dblclick,
  • and contextmenu events in the InfoBox (default is false to mimic the behavior
  • of a google.maps.InfoWindow). Set this property to true if the InfoBox
  • is being used as a map label. iPhone note: This property setting has no effect; events are
  • always propagated.

Looks like setting your enableEventPropagation property to true should do the trick!

like image 1
Andrew Avatar answered Nov 07 '22 07:11

Andrew