Resize chart on menu toggle

This commit is contained in:
Bartek Fabiszewski 2020-01-30 23:15:25 +01:00
parent 9417d75632
commit f9ae256a9f
4 changed files with 29 additions and 14 deletions

View File

@ -301,19 +301,18 @@ label[for=user] {
} }
#bottom { #bottom {
position: absolute; position: relative;
z-index: 10000; z-index: 10000;
display: none; display: none;
} }
#chart { #chart {
font-family: "Open Sans", Verdana, sans-serif; font-family: "Open Sans", Verdana, sans-serif;
position: fixed; position: absolute;
right: 0; right: 0;
bottom: -15px; bottom: -15px;
left: 0; left: 0;
height: 200px; height: 200px;
margin-right: 165px;
padding: 0 10px; padding: 0 10px;
opacity: 0.8; opacity: 0.8;
background-color: white; background-color: white;
@ -321,9 +320,9 @@ label[for=user] {
#chart-close { #chart-close {
font-size: 0.8em; font-size: 0.8em;
position: fixed; position: absolute;
z-index: 10001; z-index: 10001;
right: 175px; right: 15px;
bottom: 160px; bottom: 160px;
cursor: pointer; cursor: pointer;
color: #5070af; color: #5070af;

View File

@ -43,7 +43,8 @@ export default class ChartViewModel extends ViewModel {
pointSelected: null, pointSelected: null,
chartVisible: false, chartVisible: false,
buttonVisible: false, buttonVisible: false,
onChartToggle: null onChartToggle: null,
onMenuToggle: null
}); });
this.state = state; this.state = state;
/** @type {PlotData} */ /** @type {PlotData} */
@ -123,6 +124,9 @@ export default class ChartViewModel extends ViewModel {
this.model.onChartToggle = () => { this.model.onChartToggle = () => {
this.model.chartVisible = !this.model.chartVisible; this.model.chartVisible = !this.model.chartVisible;
}; };
this.model.onMenuToggle = () => {
this.chart.update();
};
} }
/** /**

View File

@ -310,11 +310,17 @@ export default class TrackViewModel extends ViewModel {
this.model.autoReload = false; this.model.autoReload = false;
} }
/**
* @param {HTMLElement} el
* @param {boolean} visible
*/
static setMenuVisible(el, visible) { static setMenuVisible(el, visible) {
if (visible) { if (el) {
el.classList.remove('menu-hidden'); if (visible) {
} else { el.classList.remove('menu-hidden');
el.classList.add('menu-hidden'); } else {
el.classList.add('menu-hidden');
}
} }
} }

View File

@ -131,11 +131,17 @@ export default class UserViewModel extends ViewModel {
} }
} }
/**
* @param {HTMLElement} el
* @param {boolean} visible
*/
static setMenuVisible(el, visible) { static setMenuVisible(el, visible) {
if (visible) { if (el) {
el.classList.remove('menu-hidden'); if (visible) {
} else { el.classList.remove('menu-hidden');
el.classList.add('menu-hidden'); } else {
el.classList.add('menu-hidden');
}
} }
} }