OpenLayers OpenLayers

Ticket #1571 (closed bug: fixed)

Opened 6 months ago

Last modified 6 months ago

text layer/format is broken

Reported by: tschaub Assigned to: crschmidt
Priority: minor Milestone: 2.7 Release
Component: Layer.Text Version: 2.6
Keywords: Cc:
State: Complete

Description

The text format does all sorts of parseFloat. The result of a parseFloat is a number or NaN. The text layer then checks what is the result of these parseFloat calls with things like !== null. If the parseFloat was never reached, the values will be undefined. If the parseFloat was reached, the value will be a number or NaN. Never null. undefined !== null. The real check the text layer should be doing is testing if the value is numeric (see #1441).

The result of all this is that an icon gets created with an offset where x and y properties are NaN. Much later, this value is added to another number and set as a css value with units of "px". Previously, this *appeared* not to be a problem because the Ajax stuff was swallowing errors (don't ask me why, I've spent too much time in the IE debugger already). This weird bug raises it's head when applying the new Request stuff - which doesn't swallow errors.

Attachments

text.patch (1.4 kB) - added by tschaub on 06/05/08 18:43:34.
don't create icon offset with NaN

Change History

06/05/08 18:43:34 changed by tschaub

  • attachment text.patch added.

don't create icon offset with NaN

06/09/08 13:30:55 changed by tschaub

  • state set to Review.

06/09/08 13:34:00 changed by tschaub

This problem was introduced in r6946 - which was addressing #1467.

06/09/08 13:34:41 changed by tschaub

Tests pass in IE6/7 and FF.

06/09/08 15:04:03 changed by elemoine

  • state changed from Review to Commit.

06/09/08 15:11:03 changed by tschaub

  • status changed from new to closed.
  • state changed from Commit to Complete.
  • resolution set to fixed.

(In [7334]) 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)