ignore minSize if parent is too small

This commit is contained in:
Nathan Cahill 2018-11-06 09:48:52 -07:00
parent 22a1c4cc65
commit 9f0c5bf123
2 changed files with 5 additions and 1 deletions

View File

@ -62,7 +62,7 @@ var Split = require('split.js')
The [UMD](https://github.com/umdjs/umd) build is also available on [unpkg](http://unpkg.com/):
```html
<script src="https://unpkg.com/split.js/split.min.js"></script>
<script src="https://unpkg.com/split.js/dist/split.min.js"></script>
```
You can find the library on `window.Split`.

View File

@ -381,6 +381,10 @@ const Split = (idsOption, options = {}) => {
return sizesToTrim
}
if (minSizes.reduce((a, b) => a + b, 0) > parentSize) {
return sizesToTrim
}
// Keep track of the excess pixels, the amount of pixels over the desired percentage
// Also keep track of the elements with pixels to spare, to decrease after if needed
let excessPixels = 0