This commit is contained in:
silas
2018-09-18 13:22:20 +02:00
parent 013783322f
commit d029ea130b
28 changed files with 23291 additions and 5339 deletions

View File

@@ -22,7 +22,7 @@
</div>
</div>
<div class='show-when-won flex-center height-20'>
<button class='button' id='continue-button' data-translation="continue"></button>
<button class='button max-width' id='continue-button' data-translation="continue"></button>
</div>
</div>
</div>

View File

@@ -56,7 +56,7 @@ export class LevelSite extends AbstractSite {
let wonText = this.findBy("#won-text");
let scaleHelper = new ScaleHelper();
scaleHelper.scaleToFull(continueButton, continueButton.parentElement);
scaleHelper.scaleToFull(continueButton, continueButton.parentElement, false, true);
scaleHelper.scaleToFull(wonText, wonText.parentElement);
this.levelCounterAction.setTitle(this.levelCounter);
@@ -70,6 +70,7 @@ export class LevelSite extends AbstractSite {
let currentLevelInfo = localStorage.getItem("currentLevel");
if (currentLevelInfo !== null) {
currentLevelInfo = JSON.parse(currentLevelInfo);
console.log("LevelID: ", currentLevelInfo["id"]);
const db = WordRotatorDb.getInstance();
const levelJson = await db.loadLevel(currentLevelInfo["id"]);

View File

@@ -9,7 +9,6 @@ export class SynchronizeSite extends AbstractSite {
super(siteManager, "html/application/sync.html");
}
async onConstruct(args) {
let res = await super.onConstruct(args);
await this.loadLevels();
@@ -22,7 +21,6 @@ export class SynchronizeSite extends AbstractSite {
}
async loadLevels() {
const dateLastSync = Helper.nonNull(localStorage.getItem("date-last-sync"), 0);
const db = WordRotatorDb.getInstance();
@@ -53,6 +51,9 @@ export class SynchronizeSite extends AbstractSite {
let levels = await Promise.all(levelPromises);
await db.saveManyLevels(levels);
localStorage.setItem("date-last-sync", newLastSync);
if (newLastSync != null && newLastSync !== "null")
{
localStorage.setItem("date-last-sync", newLastSync);
}
}
}

View File

@@ -4,7 +4,8 @@ import {DelayPromise} from "../../../../../../js/lib/pwa-assets";
export class ParentSegment extends Segment {
static initListener(){
window.addEventListener("mousedown", (e) => {
ParentSegment.mouseDownTarget = e.originalTarget;
ParentSegment.mouseDownTarget = e.target;
// ParentSegment.mouseDownTarget = e.originalTarget;
});
window.addEventListener("mouseup", (e) => {
ParentSegment.mouseDownTarget = null;
@@ -38,7 +39,9 @@ export class ParentSegment extends Segment {
}
};
this.mouseupListener = function(e){
if (ParentSegment.mouseDownTarget !== null && self.element.contains(ParentSegment.mouseDownTarget) && self.element.contains(e.originalTarget))
console.log("mouseup", e);
// if (ParentSegment.mouseDownTarget !== null && self.element.contains(ParentSegment.mouseDownTarget) && self.element.contains(e.originalTarget))
if (ParentSegment.mouseDownTarget !== null && self.element.contains(ParentSegment.mouseDownTarget) && self.element.contains(e.target))
{
self.rotate();
e.stopPropagation();
@@ -134,12 +137,19 @@ export class ParentSegment extends Segment {
}
_updateElement() {
let layer = this._getLayer();
if (layer >= 2)
{
this.element.classList.add("layer-"+layer);
}
const childContainer = this.element.querySelector(".child-container");
childContainer.removeAllChildren();
this._updateRotationClass();
const self = this;
// const self = this;
// this.element.onclick = function (e) {
// self.rotate();
// e.stopPropagation();
@@ -159,5 +169,13 @@ export class ParentSegment extends Segment {
}
}
}
_getLayer(){
if (this.children.length >= 1 && this.children[0] && this.children[0] instanceof ParentSegment)
{
return this.children[0]._getLayer()+1;
}
return 1;
}
}
ParentSegment.initListener();