kothic / kothic-js

Kothic JS — a full-featured JavaScript map rendering engine using HTML5 Canvas
http://kothic.org
BSD 2-Clause "Simplified" License
452 stars 46 forks source link

z-index issues #63

Open DerDakon opened 8 years ago

DerDakon commented 8 years ago

There are at least 2 z-index issues, which probably need a combined solution, so I report them in one issue:

braandl commented 8 years ago

styledFeatures.sort(function (a, b) { return a.zIndex < b.zIndex ? -1 : a.zIndex > b.zIndex ? 1 : 0; });

does fix the z-index problems. I don't understand why it was comparing the fill-color and color keys?

DerDakon commented 8 years ago

This could have been written even simpler as return a.zIndex - b.zIndex. But this does not solve the problem, as the sorting already works. It's the algorithm in which order things are drawn and how it interacts with "allow-overlap: true".