Make legend hiding work
This commit is contained in:
1 parent
2fc3aa8160
commit
6b6b6c838f
3 files changed
+24
-1
No files matched your search
@@ -43,6 +43,17 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
for(let thisSetting of settingEntries){
|
||||
addSettingEntry(thisSetting, settingsPanel);
|
||||
}
|
||||
const legend = document.getElementById('legend');
|
||||
const legendButton = document.getElementById('legendButton');
|
||||
const legendArrow = legendButton.children[0];
|
||||
let legendState = true;
|
||||
let legendButtonEvent = e => {
|
||||
legendArrow.style.transform = `rotate(${legendState ? 180 : 0}deg) translateY(${legendState ? -3 : 3}px)`;
|
||||
legend.style.transform = `translateX(${legendState ? 0 : legendButton.clientWidth-legend.clientWidth}px)`;
|
||||
legendState = !legendState;
|
||||
};
|
||||
legendButton.addEventListener('click', legendButtonEvent);
|
||||
legendButtonEvent();
|
||||
});
|
||||
|
||||
function addSettingEntry(thisSetting, parent, indent=0){
|
||||
|
||||
Reference in new issue
Block a user