Added simpleLevel

This commit is contained in:
silas
2018-05-22 10:28:17 +02:00
parent cae3ef29ea
commit f7cbd1da71
9 changed files with 173 additions and 45 deletions

View File

@@ -2766,7 +2766,7 @@ class Segment{
}
isSolved(){
return this.rotation === 0;
return (this.rotation === 0);
}
rotate(){};
@@ -2793,15 +2793,14 @@ class ParentSegment extends Segment {
rotate() {
this.rotation += 90;
this.rotation %= 360;
this._updateRotationClass();
}
applyRotations(rotations)
{
applyRotations(rotations) {
// debugger;
this.rotation = rotations[0];
rotations.splice(0,1);
rotations.splice(0, 1);
for (let i = 0, n = this.children.length; i < n; i++) {
rotations = this.children[i].applyRotations(rotations);
}
@@ -2829,10 +2828,30 @@ class ParentSegment extends Segment {
this._updateElement();
}
_updateRotationClass(){
_updateRotationClass() {
// this.style.transform = "rotate("+this.rotation+"deg)";
this.element.classList.remove(this.class);
this.class = "rotate-" + this.rotation;
if (this.class === "rotate-0")
{
this.class = "rotate-360";
}
this.element.classList.add(this.class);
// if (this.rotation === 0) {
// const self = this;
// self.element.classList.add("no-transition");
//
// setTimeout(() => {
// if (self.class === "rotate-0") {
// requestAnimationFrame(()=>{
//
// self.element.classList.remove("rotate-0");
// self.element.classList.remove("no-transition");
// });
// }
// }, 250);
// }
}
_updateElement() {
@@ -2907,7 +2926,10 @@ class Level {
setWords(words)
{
this.words = words;
this.words = [];
for (let i = 0, n = words.length; i < n; i++) {
this.words.push(words[i].toUpperCase());
}
}
setStartRotations(rotations)