Skip to content

Commit

Permalink
Fixed initial points order.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderby committed Mar 3, 2017
1 parent 2fc3ba2 commit 052a09f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/elements/element.point.js
Expand Up @@ -157,8 +157,14 @@ const Point = {
.attr('opacity', 1);
};

const fibers = screenModel.toFibers()
.sort((a, b) => screenModel.group(a[0]).localeCompare(screenModel.group(b[0])));
const fibers = screenModel.toFibers();
this._getGroupOrder = (() => {
var map = fibers.reduce((map, f, i) => {
map.set(f, i);
return map;
}, new Map());
return ((g) => map.get(g));
})();

const frameGroups = options
.container
Expand Down Expand Up @@ -337,7 +343,7 @@ const Point = {
});
const compareFilterThenGroupId = utils.createMultiSorter(
(a, b) => (filters.get(a) - filters.get(b)),
(a, b) => groups.get(a).localeCompare(groups.get(b))
(a, b) => (this._getGroupOrder(a) - this._getGroupOrder(b))
);
utilsDom.sortChildren(container.node(), (a, b) => {
if (a.tagName === 'g' && b.tagName === 'g') {
Expand Down

0 comments on commit 052a09f

Please sign in to comment.