From 5dce63569db5e6ae803174653866233b3d2098df Mon Sep 17 00:00:00 2001 From: Darafei Praliaskouski Date: Thu, 28 Feb 2013 00:18:25 +0300 Subject: [PATCH] clamp z-indexes --- src/mapcss/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/mapcss/__init__.py b/src/mapcss/__init__.py index 05581da..9c3ed5d 100644 --- a/src/mapcss/__init__.py +++ b/src/mapcss/__init__.py @@ -325,6 +325,20 @@ class MapCSS(): if (previous==oDECLARATION): self.choosers.append(sc) sc= StyleChooser(self.scalepair) + try: + "clamp z-indexes, so they're tightly following integers" + zindex = set() + for chooser in self.choosers: + for stylez in chooser.styles: + zindex.add(float(stylez.get('z-index',0))) + zindex = list(zindex) + zindex.sort() + for chooser in self.choosers: + for stylez in chooser.styles: + if 'z-index' in stylez: + stylez['z-index'] = zindex.index(float(stylez.get('z-index',0))) + except TypeError: + pass