OpenLayers OpenLayers

Changeset 7334

Show
Ignore:
Timestamp:
06/09/08 15:11:03 (3 months ago)
Author:
tschaub
Message:

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)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/openlayers/lib/OpenLayers/Layer/Text.js

    r6946 r7334  
    171171             
    172172            // FIXME: At the moment, we only use this if we have an  
    173             // externalGraphic, because icon has no setOffset API Method.   
    174             if (feature.style.graphicXOffset !== null 
    175                 && feature.style.graphicYOffset !== null) { 
     173            // externalGraphic, because icon has no setOffset API Method. 
     174            /** 
     175             * FIXME FIRST!! 
     176             * The Text format does all sorts of parseFloating 
     177             * The result of a parseFloat for a bogus string is NaN.  That 
     178             * means the three possible values here are undefined, NaN, or a 
     179             * number.  The previous check was an identity check for null.  This 
     180             * means it was failing for all undefined or NaN.  A slightly better 
     181             * check is for undefined.  An even better check is to see if the 
     182             * value is a number (see #1441). 
     183             */ 
     184            if (feature.style.graphicXOffset !== undefined 
     185                && feature.style.graphicYOffset !== undefined) { 
    176186                iconOffset = new OpenLayers.Pixel( 
    177187                    feature.style.graphicXOffset,