WIP Merging basic player to master #6

Merged
blue merged 17 commits from player into master 2019-02-01 22:32:52 +00:00
2 changed files with 87 additions and 19 deletions
Showing only changes of commit 35a9abc7d7 - Show all commits

View File

@ -251,7 +251,11 @@ var Player = Controller.inherit({
if (next && next.enabled) {
next.activate();
} else {
//todo kinda stop state?
this._fsm.manipulation("pause");
this._onSeekingStart();
this._onSeek(0);
this._onSeekingEnd(0);
this.controls[ItemType.straight.playPause].activate();
}
}
}

View File

@ -250,20 +250,52 @@
var target = pos + span;
var minSize = 0;
var maxSize = 0;
var flexibleColls = [];
for (j = pos; j < target; ++j) {
minSize += this._cols[j].min;
maxSize += this._cols[j].max;
}
if (e.child._o.minWidth > minSize) {
var portion = (e.child._o.minWidth - minSize) / span;
for (j = pos; j < target; ++j) {
this._cols[j].min += portion;
if (this._cols[j].min < this._cols[j].max) {
flexibleColls.push(this._cols[j]);
}
}
if (e.child._o.maxWidth < maxSize) {
var portion = (maxSize - e.child._o.maxWidth) / span;
for (j = pos; j < target; ++j) {
this._cols[j].max -= portion;
var leftMin = e.child._o.minWidth - minSize;
if (leftMin > 0) {
while (leftMin > 0 && flexibleColls.length > 0) {
var portion = leftMin / flexibleColls.length;
for (j = 0; j < flexibleColls.length; ++j) {
var lPortion = Math.min(flexibleColls[j].max, portion);
flexibleColls[j].min += lPortion;
leftMin -= lPortion;
if (flexibleColls[j].min === flexibleColls[j].max) {
flexibleColls.splice(j, 1);
break;
}
}
if (leftMin < 1) {
leftMin = 0;
}
}
}
var leftMax = maxSize - e.child._o.maxWidth
if (leftMax > 0) {
while (leftMax > 0 && flexibleColls.length > 0) {
var portion = leftMax / flexibleColls.length;
for (j = 0; j < flexibleColls.length; ++j) {
var lPortion = Math.max(flexibleColls[j].min, portion);
flexibleColls[j].max -= lPortion;
leftMax -= lPortion;
if (flexibleColls[j].min === flexibleColls[j].max) {
flexibleColls.splice(j, 1);
break;
}
}
if (leftMax < 1) {
leftMax = 0;
}
}
}
}
@ -275,20 +307,52 @@
var target = pos + span;
var minSize = 0;
var maxSize = 0;
var flexibleRows = [];
for (j = pos; j < target; ++j) {
minSize += this._rows[j].min;
maxSize += this._rows[j].max;
}
if (e.child._o.minHeight > minSize) {
var portion = (e.child._o.minHeight - minSize) / span;
for (j = pos; j < target; ++j) {
this._rows[j].min += portion;
if (this._rows[j].min < this._rows[j].max) {
flexibleRows.push(this._rows[j]);
}
}
if (e.child._o.maxHeight < maxSize) {
var portion = (maxSize - e.child._o.maxHeight) / span;
for (j = pos; j < target; ++j) {
this._rows[j].max -= portion;
var leftMin = e.child._o.minHeigh - minSize;
if (leftMin > 0) {
while (leftMin > 0 && flexibleRows.length > 0) {
var portion = leftMin / flexibleRows.length;
for (j = 0; j < flexibleRows.length; ++j) {
var lPortion = Math.min(flexibleRows[j].max, portion);
flexibleRows[j].min += lPortion;
leftMin -= lPortion;
if (flexibleRows[j].min === flexibleRows[j].max) {
flexibleRows.splice(j, 1);
break;
}
}
if (leftMin < 1) {
leftMin = 0;
}
}
}
var leftMax = maxSize - e.child._o.maxHeigh
if (leftMax > 0) {
while (leftMax > 0 && flexibleRows.length > 0) {
var portion = leftMax / flexibleRows.length;
for (j = 0; j < flexibleRows.length; ++j) {
var lPortion = Math.max(flexibleRows[j].min, portion);
flexibleRows[j].max -= lPortion;
leftMax -= lPortion;
if (flexibleRows[j].min === flexibleRows[j].max) {
flexibleRows.splice(j, 1);
break;
}
}
if (leftMax < 1) {
leftMax = 0;
}
}
}
}