Skip to content

Commit

Permalink
Merge pull request #38 from ohtake/restore-full-width-row
Browse files Browse the repository at this point in the history
Do not apply widowLayoutStyle to full width row
  • Loading branch information
pdokas authored Nov 6, 2017
2 parents d79dac7 + 52d495c commit 07b7a58
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/row.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Row.prototype = {
if (itemData.aspectRatio >= 1) {
// Close out the row with a full width photo
this.items.push(itemData);
this.completeLayout(rowWidthWithoutSpacing / itemData.aspectRatio, this.widowLayoutStyle);
this.completeLayout(rowWidthWithoutSpacing / itemData.aspectRatio, 'justify');
return true;
}
}
Expand All @@ -131,7 +131,7 @@ Row.prototype = {
// When there are no existing items, force acceptance of the new item and complete the layout.
// This is the pano special case.
this.items.push(merge(itemData));
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, this.widowLayoutStyle);
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, 'justify');
return true;

}
Expand All @@ -146,15 +146,15 @@ Row.prototype = {
if (Math.abs(newAspectRatio - targetAspectRatio) > Math.abs(previousAspectRatio - previousTargetAspectRatio)) {

// Row with new item is us farther away from target than row without; complete layout and reject item.
this.completeLayout(previousRowWidthWithoutSpacing / previousAspectRatio, this.widowLayoutStyle);
this.completeLayout(previousRowWidthWithoutSpacing / previousAspectRatio, 'justify');
return false;

} else {

// Row with new item is us closer to target than row without;
// accept the new item and complete the row layout.
this.items.push(merge(itemData));
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, this.widowLayoutStyle);
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, 'justify');
return true;

}
Expand All @@ -164,7 +164,7 @@ Row.prototype = {
// New aspect ratio / scaled row height is within tolerance;
// accept the new item and complete the row layout.
this.items.push(merge(itemData));
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, this.widowLayoutStyle);
this.completeLayout(rowWidthWithoutSpacing / newAspectRatio, 'justify');
return true;

}
Expand All @@ -188,7 +188,7 @@ Row.prototype = {
*
* @method completeLayout
* @param newHeight {Number} Set row height to this value.
* @param widowLayoutStyle {String} How should widows display? Supported: justify | center
* @param widowLayoutStyle {String} How should widows display? Supported: left | justify | center
*/
completeLayout: function (newHeight, widowLayoutStyle) {

Expand Down

0 comments on commit 07b7a58

Please sign in to comment.