Commit 5aa7d144 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

general overlays are always above user overlays

parent 9d07245f
......@@ -114,6 +114,16 @@ AliasInfoWindow.prototype.createChartDiv = function (params) {
var promises = [];
var self = this;
overlays.sort(function (overlayA, overlayB) {
if (overlayA.getPublicOverlay() !== overlayB.getPublicOverlay()) {
if (overlayA.getPublicOverlay()) {
return -1;
}
return 1;
}
return overlayA.getOrder() - overlayB.getOrder();
});
overlays.forEach(function (overlay, i) {
promises.push(overlay.getFullAliasById(self.getAlias().getId()).then(function (data) {
var rowDiv = document.createElement("div");
......
......@@ -427,6 +427,37 @@ describe('AliasInfoWindow', function () {
assert.ok(div);
});
});
it("overlay order", function () {
var map = helper.createCustomMap();
var alias = helper.createAlias(map);
var aliasWindow = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
var overlay1 = helper.createOverlay();
overlay1.setOrder(2);
var overlay2 = helper.createOverlay();
overlay2.setPublicOverlay(true);
overlay2.setOrder(10);
var overlay3 = helper.createOverlay();
overlay3.setPublicOverlay(true);
overlay3.setOrder(9);
var overlay4 = helper.createOverlay();
overlay4.setOrder(1);
var overlays = [overlay1, overlay2, overlay3, overlay4];
return aliasWindow.createChartDiv({overlays: overlays}).then(function (htmlDiv) {
var overlay1Position = htmlDiv.innerHTML.indexOf(overlay1.getName());
var overlay2Position = htmlDiv.innerHTML.indexOf(overlay2.getName());
var overlay3Position = htmlDiv.innerHTML.indexOf(overlay3.getName());
var overlay4Position = htmlDiv.innerHTML.indexOf(overlay4.getName());
assert.ok(overlay3Position < overlay2Position);
assert.ok(overlay2Position < overlay4Position);
assert.ok(overlay4Position < overlay1Position);
});
});
});
it("createVcfString ", function () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment