[OpenLayers-Users] How to use the getMousePosition() in theOpenLayers.Control.SelectFeature's event handler function?

ahwangyuwei ahwangyuwei at sina.com
Thu Jun 9 03:37:20 EDT 2011


 Hello:
      I am using the openlayers2.8. 
      I want to add a popup about the feature at the mouse click position, and I saw that I can use the OpenLayers.Control.SelectFeature to select feature and hightlight the feature. I have met a problem How to get the mouse's click postion in the event("featurehighlighted") hanlder  function ("report"). I try this:
   var report = function(e) {
                //OpenLayers.Console.log(e.type, e.feature.id);
                map.addPopup(new OpenLayers.Popup.FramedCloud(
                        "chicken", 
                        map.getLonLatFromPixel(e.object.events.getMousePosition(e.object.handlers.feature.evt)),
                        null,
                        "<div>ss</div>",
                        null,
                        true
                    ));       
                 
            };But In getMousePosition()  a error occurred: "this.element is null".I want to ask: How to get the click position?  What is the function getMousePosition's parameters ?
Looking forward to your help.Help me.Thank you.
                                                                      Wang 
                                                                      


2011-06-09 



ahwangyuwei 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110609/dc6e01d4/attachment.html


More information about the Users mailing list