create sizer that sets item size with flex-basis

works with the flex-grow we set initially for the sub lists
This commit is contained in:
Bruno Windels
2018-10-18 15:51:22 +02:00
parent a910f46c5b
commit 39ab3d86bd
3 changed files with 11 additions and 3 deletions
+2 -1
View File
@@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import {Sizer} from "./sizer";
import {Sizer, FlexSizer} from "./sizer";
import {FixedDistributor, CollapseDistributor, PercentageDistributor} from "./distributors";
import {Resizer} from "./resizer";
module.exports = {
Resizer,
Sizer,
FlexSizer,
FixedDistributor,
CollapseDistributor,
PercentageDistributor,
+8 -1
View File
@@ -97,4 +97,11 @@ class Sizer {
}
}
module.exports = {Sizer};
class FlexSizer extends Sizer {
setItemSize(item, size) {
item.style.flexGrow = '0';
item.style.flexBasis = `${Math.round(size)}px`;
}
}
module.exports = {Sizer, FlexSizer};