MainMenu angefangen

This commit is contained in:
silas
2018-09-22 16:50:24 +02:00
parent a6f7fa8c3e
commit 7393ea00ba
15 changed files with 789 additions and 637 deletions

View File

@@ -41,8 +41,6 @@ class ScaleHelper {
}
async _getNewFontSize(scale, fontElement, container, ignoreHeight, ignoreWidth, margin, fontWeight, setFontSize) {
margin = Helper.nonNull(margin, 10);
ignoreHeight = Helper.nonNull(ignoreHeight, false);
ignoreWidth = Helper.nonNull(ignoreWidth, false);
@@ -55,8 +53,6 @@ class ScaleHelper {
container.classList.add("no-transition");
}
// debugger;
let beforeFontSize = fontElement.style.fontSize;
let currentFontSize = 1;
let diff = 0;
@@ -83,8 +79,6 @@ class ScaleHelper {
diff = newDiff;
} while ((widthDiff > (1 - scale) * containerWidth || ignoreWidth) && (heightDiff > (1 - scale) * containerHeight || ignoreHeight));
console.log(setFontSize, currentFontSize, beforeFontSize, fontElement.style.fontSize, fontElement);
currentFontSize -= margin;
fontElement.style.fontSize = ((setFontSize) ? currentFontSize + "px" : beforeFontSize);

View File

@@ -1953,8 +1953,7 @@ class SiteManager {
this.titleElement = document.querySelector(".top-bar-title");
const defaultTitleElem = document.createElement("span");
while(this.titleElement.childNodes.length > 0)
{
while (this.titleElement.childNodes.length > 0) {
const child = this.titleElement.firstChild;
child.remove();
defaultTitleElem.appendChild(child);
@@ -1964,7 +1963,6 @@ class SiteManager {
element: defaultTitleElem,
title: document.title
};
console.log(this.defaultTitle);
let siteManager = this;
window.onpopstate = function (e) {
@@ -1997,11 +1995,10 @@ class SiteManager {
return this.defaultActions;
}
startSite(siteConstructor, paramsPromise) {
if (!(siteConstructor.prototype instanceof AbstractSite))
{
async startSite(siteConstructor, paramsPromise) {
if (!(siteConstructor.prototype instanceof AbstractSite)) {
throw {
"error": "wrong class given! Expected AbstractSite, given "+siteConstructor.name
"error": "wrong class given! Expected AbstractSite, given " + siteConstructor.name
};
}
@@ -2014,16 +2011,14 @@ class SiteManager {
let siteContainer = new SiteContainer(site, resolver);
this.siteDiv.removeAllChildren().appendChild(Helper.createLoadingSymbol());
let manager = this;
this.siteStartingPromise = new Promise(function (resolve) {
Promise.resolve(paramsPromise).then(function (params) {
siteContainer.setStartParameters(params);
return Promise.all([site.onConstruct(params), site.inflatePromise]);
}).then(function () {
site.actionMenu = site.createActionBarMenu(manager.buildActionBarMenu());
}).then(function () {
resolve(manager.show(siteContainer));
});
this.siteStartingPromise = Promise.resolve(paramsPromise).then(async (params) => {
siteContainer.setStartParameters(params);
await Promise.all([site.onConstruct(params), site.inflatePromise]);
site.actionMenu = site.createActionBarMenu(this.buildActionBarMenu());
return this.show(siteContainer);
}).catch((e) => {
console.error("site start error:", e);
});
return finishPromise;