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

View file

@ -35,7 +35,7 @@ import RoomListStore from '../../../stores/RoomListStore';
import GroupStore from '../../../stores/GroupStore'; import GroupStore from '../../../stores/GroupStore';
import ResizeHandle from '../elements/ResizeHandle'; import ResizeHandle from '../elements/ResizeHandle';
import {Resizer, CollapseDistributor} from '../../../resizer' import {Resizer, FixedDistributor, FlexSizer} from '../../../resizer'
const HIDE_CONFERENCE_CHANS = true; const HIDE_CONFERENCE_CHANS = true;
const STANDARD_TAGS_REGEX = /^(m\.(favourite|lowpriority|server_notice)|im\.vector\.fake\.(invite|recent|direct|archived))$/; const STANDARD_TAGS_REGEX = /^(m\.(favourite|lowpriority|server_notice)|im\.vector\.fake\.(invite|recent|direct|archived))$/;

View file

@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import {Sizer} from "./sizer"; import {Sizer, FlexSizer} from "./sizer";
import {FixedDistributor, CollapseDistributor, PercentageDistributor} from "./distributors"; import {FixedDistributor, CollapseDistributor, PercentageDistributor} from "./distributors";
import {Resizer} from "./resizer"; import {Resizer} from "./resizer";
module.exports = { module.exports = {
Resizer, Resizer,
Sizer, Sizer,
FlexSizer,
FixedDistributor, FixedDistributor,
CollapseDistributor, CollapseDistributor,
PercentageDistributor, PercentageDistributor,

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};