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:
@@ -171,8 +171,18 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
|
|||||||
|
|
||||||
// FIXME: At the moment, we only use this if we have an
|
// FIXME: At the moment, we only use this if we have an
|
||||||
// externalGraphic, because icon has no setOffset API Method.
|
// externalGraphic, because icon has no setOffset API Method.
|
||||||
if (feature.style.graphicXOffset !== null
|
/**
|
||||||
&& feature.style.graphicYOffset !== null) {
|
* 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(
|
iconOffset = new OpenLayers.Pixel(
|
||||||
feature.style.graphicXOffset,
|
feature.style.graphicXOffset,
|
||||||
feature.style.graphicYOffset);
|
feature.style.graphicYOffset);
|
||||||
|
|||||||
Reference in New Issue
Block a user