OpenLayers OpenLayers

Ticket #1571: text.patch

File text.patch, 1.4 kB (added by tschaub, 7 months ago)

don't create icon offset with NaN

  • lib/OpenLayers/Layer/Text.js

    old new  
    170170            }         
    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,  
    178188                    feature.style.graphicYOffset);