UNPKG

flash-section-list

Version:
29 lines (28 loc) 699 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; class LayoutManager { constructor({ horizontal, accuracy = 2 }) { this.horizontal = horizontal; this.accuracy = accuracy; } getSize(layout) { return this.horizontal ? layout?.width : layout?.height; } isChanged(a, b) { const sizeA = this.getSize(a); const sizeB = this.getSize(b); if (sizeA === undefined || sizeB === undefined) return true; return Math.abs(sizeA - sizeB) > this.accuracy; } getSizeProperty() { return this.horizontal ? 'width' : 'height'; } } exports.default = LayoutManager; //# sourceMappingURL=LayoutManager.js.map