OpenLayers OpenLayers

Ticket #1778 (closed bug: fixed)

Opened 2 years ago

Last modified 1 year ago

Openlayers fails to draw features when the map's div container has directionallity "rtl" applied

Reported by: openlayers Assigned to: ahocevar
Priority: major Milestone: 2.8 Release
Component: general Version: 2.7
Keywords: Cc: dane.springmeyer@gmail.com
State: Complete

Description

If you have a OpenLayers Map displayed inside a div, and the div has dir="rtl", when you load features from a WFS server, they don't get properly drawn.

To reproduce, just create your div using:

<div dir="rtl" id="map" name="map"></div>

And create your map as usual (in javascript):

var map = new OpenLayers.Map("map");

( don't forget to add some WFS layer on top of the map )

This arises in arabian environments where dir="rtl" is common.

Attachments

ltr.patch (1.1 kB) - added by ahocevar on 01/10/09 06:44:23.

Change History

10/13/08 03:33:18 changed by openlayers

  • owner set to pgiraud.

10/13/08 03:34:03 changed by openlayers

  • owner changed from pgiraud to openlayers.
  • status changed from new to assigned.

10/13/08 03:35:34 changed by openlayers

  • owner changed from openlayers to tschaub.
  • status changed from assigned to new.
  • type changed from feature to bug.
  • milestone set to 2.8 Release.

(follow-up: ↓ 5 ) 01/10/09 06:44:02 changed by ahocevar

  • state set to Needs Discussion.

In principle, this can be easily fixed by adding dir="ltr" to each layer's div. The attached patch does this and fixes the issue.

It would, however, be interesting to hear why someone would set dir="ltr" on the map div. Probably because it is required to have controls with text inside the map div? If so, the proposed fix would be ok, but another way to fix is would be an option for OpenLayers.Control to set dir to "ltr", or even to make this locale dependant.

What do others think?

01/10/09 06:44:23 changed by ahocevar

  • attachment ltr.patch added.

(in reply to: ↑ 4 ) 01/10/09 06:51:04 changed by ahocevar

Replying to ahocevar:

It would, however, be interesting to hear why someone would set dir="ltr" on the map div.

This should of course read dir="rtl"

01/10/09 22:32:37 changed by openlayers

  • cc set to dane.springmeyer@gmail.com.

This issue has appeared in geodjango usage within the automatic Django Admin app. In this case the rtl was being set across the whole page.

FYI: http://code.djangoproject.com/ticket/9278

-Dane

03/18/09 12:16:32 changed by crschmidt

  • owner changed from tschaub to crschmidt.
  • status changed from new to assigned.
  • state changed from Needs Discussion to Review.

03/21/09 10:09:48 changed by crschmidt

  • owner changed from crschmidt to ahocevar.
  • status changed from assigned to new.
  • state changed from Review to Commit.

After discussion on #openlayers, I think this is the right choice:

1. It fixes the problem of vectors not working with an rtl map 2. It is perfectly reasonable that people could want rtl behavior in the layerswitcher and text inside the map, but not have broken vectors. 3. rtl text in vector layers in IE won't work, but that's life until someone gives us a real fix.

I've tested this patch and it does what it says on the tin. Andreas, thanks; please commit.

03/21/09 17:38:42 changed by ahocevar

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

(In [9114]) Fixed rendering issues in (vector) layers when map div has dir="rtl" set. r=crschmidt (closes #1778)