From c3ca41b3bef9bcfc764f6c86256c37f95fdd46b3 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Mon, 9 Jun 2008 19:11:03 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Layer/Text.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/OpenLayers/Layer/Text.js b/lib/OpenLayers/Layer/Text.js index 23aab6bc26..17e815ca7b 100644 --- a/lib/OpenLayers/Layer/Text.js +++ b/lib/OpenLayers/Layer/Text.js @@ -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);