The text format conditionally sets values for feature.style.graphicXOffset and graphicYOffset. If these are not defined in parsing, we confirm that using the non-identity operator with undefined. Later, it might make sense to confirm these values are actually numeric (see #1441). This keeps an icon.offset from inadvertently getting created with NaN values later on. r=elemoine (closes #1571)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@7334 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
Tim Schaub
2008-06-09 19:11:03 +00:00
parent de6ce111c9
commit c3ca41b3be

View File

@@ -170,9 +170,19 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
}
// FIXME: At the moment, we only use this if we have an
// externalGraphic, because icon has no setOffset API Method.
if (feature.style.graphicXOffset !== null
&& feature.style.graphicYOffset !== null) {
// externalGraphic, because icon has no setOffset API Method.
/**
* FIXME FIRST!!
* The Text format does all sorts of parseFloating
* The result of a parseFloat for a bogus string is NaN. That
* means the three possible values here are undefined, NaN, or a
* number. The previous check was an identity check for null. This
* means it was failing for all undefined or NaN. A slightly better
* check is for undefined. An even better check is to see if the
* value is a number (see #1441).
*/
if (feature.style.graphicXOffset !== undefined
&& feature.style.graphicYOffset !== undefined) {
iconOffset = new OpenLayers.Pixel(
feature.style.graphicXOffset,
feature.style.graphicYOffset);