[OpenLayers-Users] Re: Mouse position coordinates
Graham Gauld
graham.gauld at aberdeenshire.gov.uk
Thu Aug 4 09:17:14 EDT 2011
For anybody interested...
I've tracked down the cause of the mouse pointer offset problem I was
having.
It seems to result from the OpenLayers map being inside an HTML <table>
element whose border attribute is set to the value '1' (e.g. <table
border="1"><tr><td><div id="map" style="width: 700px; height:
400px;"></div></td></tr></table>).
The solution is to set the 'border' value to zero. HTML tables are used to
structure the layout of my page, and every table in which the map <div> is
contained had to have its 'border' value set to zero.
For example:
----------------------------------------------------------------------------
| TABLE 1
|
|
|
|
----------------------------------------------------------------------- |
| | TABLE 2 (command buttons)
| |
|
----------------------------------------------------------------------- |
|
----------------------------------------------------------------------- |
| | TABLE 3 - contains map <div>
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
----------------------------------------------------------------------- |
|
----------------------------------------------------------------------- |
| | TABLE 4 (other content)
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
----------------------------------------------------------------------- |
----------------------------------------------------------------------------
In the above, tables 1 and 3 both had to have their 'border' value set to
zero.
I would be interested to hear if anybody knows why a non-zero value for the
'border' attribute might cause this problem, or of possible workarounds to
allow a border to be displayed around tables containing the map (my page
doesn't look right now without borders displayed).
Graham.
--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Mouse-position-coordinates-tp6625649p6652662.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
More information about the Users
mailing list