From e0479407e282fda34737035172443330a4e3ca90 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Thu, 15 Oct 2020 16:55:11 -0400 Subject: [PATCH] Fixed side layers appearing multiple times --- changelog.md | 3 +++ js/layerSupport.js | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index b636724..7f6d84a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # The Modding Tree changelog: +# v2.0.1 10/15/20 +- Fixed side layers appearing multiple times. + ## v2.0 10/15/20 - Added progress bars, which are highly customizable and can be horizontal or vertical! - Added "side layers", displayed smaller and off to the side, and don't get reset by default. diff --git a/js/layerSupport.js b/js/layerSupport.js index ef27d29..5e82453 100644 --- a/js/layerSupport.js +++ b/js/layerSupport.js @@ -30,6 +30,7 @@ function updateLayers(){ LAYERS = Object.keys(layers); ROW_LAYERS = {} TREE_LAYERS = {} + OTHER_LAYERS = {} for (layer in layers){ layers[layer].layer = layer if (layers[layer].upgrades){ @@ -126,10 +127,12 @@ function updateLayers(){ else OTHER_LAYERS[row].push({layer: layer, position: position}) } + for (row in OTHER_LAYERS) { + OTHER_LAYERS[row].sort((a, b) => (a.position > b.position) ? 1 : -1) + } for (row in TREE_LAYERS) { TREE_LAYERS[row].sort((a, b) => (a.position > b.position) ? 1 : -1) } - updateHotkeys() }