Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit b924dcc

Browse files
authored
Merge pull request #4950 from matrix-org/travis/room-list/cleanup-resizing
Remove now-dead code from sublist resizing
2 parents e6c7e7c + cfc39dc commit b924dcc

File tree

2 files changed

+6
-36
lines changed

2 files changed

+6
-36
lines changed

src/components/views/rooms/RoomSublist2.tsx

+4-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as React from "react";
2020
import { createRef } from "react";
2121
import { Room } from "matrix-js-sdk/src/models/room";
2222
import classNames from 'classnames';
23-
import {RovingAccessibleButton, RovingTabIndexWrapper} from "../../../accessibility/RovingTabIndex";
23+
import { RovingAccessibleButton, RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
2424
import { _t } from "../../../languageHandler";
2525
import AccessibleButton from "../../views/elements/AccessibleButton";
2626
import RoomTile2 from "./RoomTile2";
@@ -36,12 +36,12 @@ import RoomListStore from "../../../stores/room-list/RoomListStore2";
3636
import { ListAlgorithm, SortAlgorithm } from "../../../stores/room-list/algorithms/models";
3737
import { DefaultTagID, TagID } from "../../../stores/room-list/models";
3838
import dis from "../../../dispatcher/dispatcher";
39+
import defaultDispatcher from "../../../dispatcher/dispatcher";
3940
import NotificationBadge from "./NotificationBadge";
4041
import { ListNotificationState } from "../../../stores/notifications/ListNotificationState";
4142
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
4243
import { Key } from "../../../Keyboard";
43-
import defaultDispatcher from "../../../dispatcher/dispatcher";
44-
import {ActionPayload} from "../../../dispatcher/payloads";
44+
import { ActionPayload } from "../../../dispatcher/payloads";
4545
import { Enable, Resizable } from "re-resizable";
4646
import { Direction } from "re-resizable/lib/resizer";
4747
import { polyfillTouchEvent } from "../../../@types/polyfill";
@@ -130,8 +130,7 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
130130
private calculateInitialHeight() {
131131
const requestedVisibleTiles = Math.max(Math.floor(this.layout.visibleTiles), this.layout.minVisibleTiles);
132132
const tileCount = Math.min(this.numTiles, requestedVisibleTiles);
133-
const height = this.layout.tilesToPixelsWithPadding(tileCount, this.padding);
134-
return height;
133+
return this.layout.tilesToPixelsWithPadding(tileCount, this.padding);
135134
}
136135

137136
private get padding() {

src/stores/room-list/ListLayout.ts

+2-31
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ import { TagID } from "./models";
1818

1919
const TILE_HEIGHT_PX = 44;
2020

21-
// this comes from the CSS where the show more button is
22-
// mathematically this percent of a tile when floating.
23-
//const RESIZER_BOX_FACTOR = 0.78;
24-
const RESIZER_BOX_FACTOR = 0;
25-
2621
interface ISerializedListLayout {
2722
numTiles: number;
2823
showPreviews: boolean;
@@ -82,36 +77,12 @@ export class ListLayout {
8277
}
8378

8479
public get minVisibleTiles(): number {
85-
return 1 + RESIZER_BOX_FACTOR;
80+
return 1;
8681
}
8782

8883
public get defaultVisibleTiles(): number {
8984
// This number is what "feels right", and mostly subject to design's opinion.
90-
return 5 + RESIZER_BOX_FACTOR;
91-
}
92-
93-
public setVisibleTilesWithin(newVal: number, maxPossible: number) {
94-
maxPossible = maxPossible + RESIZER_BOX_FACTOR;
95-
if (newVal > maxPossible) {
96-
this.visibleTiles = maxPossible;
97-
} else {
98-
this.visibleTiles = newVal;
99-
}
100-
}
101-
102-
public calculateTilesToPixelsMin(maxTiles: number, n: number, possiblePadding: number): number {
103-
// Only apply the padding if we're about to use maxTiles as we need to
104-
// plan for the padding. If we're using n, the padding is already accounted
105-
// for by the resizing stuff.
106-
let padding = 0;
107-
if (maxTiles < n) {
108-
padding = possiblePadding;
109-
}
110-
return this.tilesToPixels(Math.min(maxTiles, n)) + padding;
111-
}
112-
113-
public tilesWithResizerBoxFactor(n: number): number {
114-
return n + RESIZER_BOX_FACTOR;
85+
return 5;
11586
}
11687

11788
public tilesWithPadding(n: number, paddingPx: number): number {

0 commit comments

Comments
 (0)