something that looks like stopping in the end of playlist, grid layout visual vix

This commit is contained in:
Blue 2019-01-27 20:32:19 +03:00
parent 6e933257b1
commit 35a9abc7d7
2 changed files with 87 additions and 19 deletions

View File

@ -251,7 +251,11 @@ var Player = Controller.inherit({
if (next && next.enabled) { if (next && next.enabled) {
next.activate(); next.activate();
} else { } 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 target = pos + span;
var minSize = 0; var minSize = 0;
var maxSize = 0; var maxSize = 0;
var flexibleColls = [];
for (j = pos; j < target; ++j) { for (j = pos; j < target; ++j) {
minSize += this._cols[j].min; minSize += this._cols[j].min;
maxSize += this._cols[j].max; maxSize += this._cols[j].max;
} if (this._cols[j].min < this._cols[j].max) {
if (e.child._o.minWidth > minSize) { flexibleColls.push(this._cols[j]);
var portion = (e.child._o.minWidth - minSize) / span;
for (j = pos; j < target; ++j) {
this._cols[j].min += portion;
} }
} }
if (e.child._o.maxWidth < maxSize) {
var portion = (maxSize - e.child._o.maxWidth) / span; var leftMin = e.child._o.minWidth - minSize;
for (j = pos; j < target; ++j) { if (leftMin > 0) {
this._cols[j].max -= portion; 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 target = pos + span;
var minSize = 0; var minSize = 0;
var maxSize = 0; var maxSize = 0;
var flexibleRows = [];
for (j = pos; j < target; ++j) { for (j = pos; j < target; ++j) {
minSize += this._rows[j].min; minSize += this._rows[j].min;
maxSize += this._rows[j].max; maxSize += this._rows[j].max;
} if (this._rows[j].min < this._rows[j].max) {
if (e.child._o.minHeight > minSize) { flexibleRows.push(this._rows[j]);
var portion = (e.child._o.minHeight - minSize) / span;
for (j = pos; j < target; ++j) {
this._rows[j].min += portion;
} }
} }
if (e.child._o.maxHeight < maxSize) { var leftMin = e.child._o.minHeigh - minSize;
var portion = (maxSize - e.child._o.maxHeight) / span; if (leftMin > 0) {
for (j = pos; j < target; ++j) { while (leftMin > 0 && flexibleRows.length > 0) {
this._rows[j].max -= portion; 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;
}
} }
} }
} }