screenPoint is not giving me the correct cursor position.

848
5
10-13-2010 03:56 PM
timgogl
New Contributor II
i am trying to show an infowindow, and have no issues doing so, the problem seems to be a conflict between a dijit i am using and the infoWindow.

i am using a menubar dijit above my map. but the info window offsets(below the cursor) exactly the height of my menubar.

when i comment out the code that builds the menubar, the infoWindow lines up perfectly. with the menubar i get the offset.

has anyone run into this? or heard about a way to work around this?

thanks, any thoughts or comments are greatly appreciated.
cheers.
lowgas
0 Kudos
5 Replies
timgogl
New Contributor II
ok, well i believe a worked it out.

i just put in an adjusted Point in the show() method.

var p = new esri.geometry.Point({'x':e.screenPoint.x+1,'y':e.screenPoint.y-18});
map.infoWindow.show(p, map.getInfoWindowAnchor(p));


that seems to have done the trick.

thanks for looking.
0 Kudos
TimRourke
New Contributor
We ran into this problem after resizing or repositioning the map or browser. What worked then was to force a map resize and reposition before getting/putting any points in the map. If that applies, I can dig up the code pretty quickly if you need it.
0 Kudos
timgogl
New Contributor II
thanks. the issue was not the points showing up in the correct spot. looking at the layers on the map, those all look correct. the problem was the  info window not actually appearing at the correct location in relation to the cursor click event.
the solution i posted above 'appears' to fix the problem, however, i am not sure that it is actually working, since today i cannot seem to pick up any results from my attempts to run task.IdentifyTask.

heh. i will keep plugging away at this and see what turns up. now that you have brought this back to my attention, i think it may be the same situation that i had with the info window.
0 Kudos
timgogl
New Contributor II
it looks like that may be the case tim,

if you wouln't mind digging up that code, i would really appreciate it. heh. i really have a lot of reading to do in the api it looks like.
thanks and cheers!
0 Kudos
timgogl
New Contributor II
ok.
just figured i would post this incase anyone else comes across any similar situation.

so, my html is set up so:

    <body class=" claro ">
  <div id="mainWindow">
   <div id="toolbar"></div>   
   <div id="map_canvas"></div>   
   <div id="info_panel"></div>   
  </div>
    </body> 


my problem was occurring because in my style tag, i did not have a height value specified for my toolbar tag.

once i put a height value in my css for the toolbar div, the map corrected itself.
0 Kudos