mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
Try variable resizing
This commit is contained in:
parent
30027a6556
commit
83df79aab9
2 changed files with 7 additions and 2 deletions
|
@ -77,7 +77,8 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
private onResize = (e: React.MouseEvent, data: ResizeCallbackData) => {
|
||||
const tileDiff = e.movementY < 0 ? -1 : +1;
|
||||
const direction = e.movementY < 0 ? -1 : +1;
|
||||
const tileDiff = this.props.layout.pixelsToTiles(Math.abs(e.movementY)) * direction;
|
||||
this.props.layout.visibleTiles += tileDiff;
|
||||
this.forceUpdate(); // because the layout doesn't trigger a re-render
|
||||
};
|
||||
|
@ -254,7 +255,7 @@ export default class RoomSublist2 extends React.Component<IProps, IState> {
|
|||
axis="y"
|
||||
minConstraints={[-1, minTilesPx]}
|
||||
maxConstraints={[-1, maxTilesPx]}
|
||||
draggableOpts={{grid: [-1, layout.tileHeight]}}
|
||||
draggableOpts={{grid: [-1, 1]}}
|
||||
resizeHandles={handles}
|
||||
onResize={this.onResize}
|
||||
className="mx_RoomSublist2_resizeBox"
|
||||
|
|
|
@ -57,6 +57,10 @@ export class ListLayout {
|
|||
return n * this.tileHeight;
|
||||
}
|
||||
|
||||
public pixelsToTiles(px: number): number {
|
||||
return px / this.tileHeight;
|
||||
}
|
||||
|
||||
private serialize(): ISerializedListLayout {
|
||||
return {
|
||||
numTiles: this.visibleTiles,
|
||||
|
|
Loading…
Reference in a new issue