OpenLayers OpenLayers

Ticket #1090 (closed bug: fixed)

Opened 1 year ago

Last modified 1 year ago

removeLayer doesn't reset layers z-index

Reported by: elemoine Assigned to: elemoine
Priority: minor Milestone: 2.6 Release
Component: Map Version: SVN
Keywords: Cc:
State:

Description

Map.removeLayer() moves layers in the Map.layers array, but do not change these layers' z-index values.

Example scenario:

Initial state: the map has one baselayer.

(1) add 3 overlays to the map. Overlay A gets z-index 330. Overlay B gets z-index 335. Overlay C gets z-index 340

(2) remove Overlay A and Overlay B from the map

(3) add Overlay D. Overlay D's layer index is 2 so it gets z-index 335.

Overlay D's z-index (335) is lower than Overlay C (340), even though Overlay D was added after Overlay C.

Attachments

patch-1090-A0.diff (1.8 kB) - added by elemoine on 10/15/07 15:19:52.
patch
patch-1090-r5325-A1.diff (1.8 kB) - added by elemoine on 12/02/07 08:30:12.
new patch that applies to current trunk
zindex.patch (2.1 kB) - added by tschaub on 12/12/07 15:01:06.
reset z-index on all layers after removing a layer

Change History

10/15/07 15:19:52 changed by elemoine

  • attachment patch-1090-A0.diff added.

patch

10/15/07 15:21:05 changed by elemoine

  • keywords set to review.

12/02/07 08:30:12 changed by elemoine

  • attachment patch-1090-r5325-A1.diff added.

new patch that applies to current trunk

12/12/07 15:00:10 changed by tschaub

Updated patch fails on trunk (due to a unit test that calls removeLayer on a map object that doesn't have the resetLayersZIndex method). New update to follow.

12/12/07 15:01:06 changed by tschaub

  • attachment zindex.patch added.

reset z-index on all layers after removing a layer

12/12/07 15:01:57 changed by tschaub

  • keywords changed from review to commit.
  • milestone set to 2.6 Release.

Eric, this is a great catch. Thanks.

Tests pass with the new patch. Please commit (if you also approve).

12/12/07 15:08:49 changed by elemoine

  • keywords deleted.
  • status changed from new to closed.
  • resolution set to fixed.

(In [5386]) removeLayer must reset layers z-index. Thanks tschaub for the review and the new patch. (closes #1090)