mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 04:21:57 +03:00
fix lint
This commit is contained in:
parent
6fdcebb876
commit
8d3347bcfb
4 changed files with 20 additions and 9 deletions
|
@ -14,7 +14,7 @@ const ResizeHandle = (props) => {
|
|||
classNames.push('mx_ResizeHandle_reverse');
|
||||
}
|
||||
return (
|
||||
<div className={classNames.join(' ')}/>
|
||||
<div className={classNames.join(' ')} />
|
||||
);
|
||||
};
|
||||
|
||||
|
|
|
@ -46,15 +46,14 @@ class CollapseDistributor extends FixedDistributor {
|
|||
}
|
||||
|
||||
resize(offset) {
|
||||
let newSize = this.sizeFromOffset(offset);
|
||||
const newSize = this.sizeFromOffset(offset);
|
||||
const isCollapsedSize = newSize < this.toggleSize;
|
||||
if (isCollapsedSize && !this.isCollapsed) {
|
||||
this.isCollapsed = true;
|
||||
if (this.onCollapsed) {
|
||||
this.onCollapsed(true, this.item);
|
||||
}
|
||||
}
|
||||
else if (!isCollapsedSize && this.isCollapsed) {
|
||||
} else if (!isCollapsedSize && this.isCollapsed) {
|
||||
if (this.onCollapsed) {
|
||||
this.onCollapsed(false, this.item);
|
||||
}
|
||||
|
|
|
@ -101,6 +101,7 @@ export class Resizer {
|
|||
const vertical = resizeHandle.classList.contains(this.classNames.vertical);
|
||||
const reverse = resizeHandle.classList.contains(this.classNames.reverse);
|
||||
|
||||
// eslint-disable-next-line new-cap
|
||||
const sizer = new this.sizerCtor(this.container, vertical, reverse);
|
||||
|
||||
const items = this._getResizableItems();
|
||||
|
@ -108,6 +109,7 @@ export class Resizer {
|
|||
// if reverse, resize the item after the handle instead of before, so + 1
|
||||
const itemIndex = items.indexOf(prevItem) + (reverse ? 1 : 0);
|
||||
const item = items[itemIndex];
|
||||
// eslint-disable-next-line new-cap
|
||||
const distributor = new this.distributorCtor(
|
||||
sizer, item, this.distributorCfg,
|
||||
items, this.container);
|
||||
|
|
|
@ -39,7 +39,10 @@ class Sizer {
|
|||
item.style.flexGrow = Math.round(percent * 1000);
|
||||
}
|
||||
|
||||
/** returns how far the edge of the item is from the edge of the container */
|
||||
/**
|
||||
@param {Element} item the dom element being resized
|
||||
@return {number} how far the edge of the item is from the edge of the container
|
||||
*/
|
||||
getItemOffset(item) {
|
||||
const offset = (this.vertical ? item.offsetTop : item.offsetLeft) - this._getOffset();
|
||||
if (this.reverse) {
|
||||
|
@ -49,17 +52,20 @@ class Sizer {
|
|||
}
|
||||
}
|
||||
|
||||
/** returns the width/height of an item in the container */
|
||||
/**
|
||||
@param {Element} item the dom element being resized
|
||||
@return {number} the width/height of an item in the container
|
||||
*/
|
||||
getItemSize(item) {
|
||||
return this.vertical ? item.offsetHeight : item.offsetWidth;
|
||||
}
|
||||
|
||||
/** returns the width/height of the container */
|
||||
/** @return {number} the width/height of the container */
|
||||
getTotalSize() {
|
||||
return this.vertical ? this.container.offsetHeight : this.container.offsetWidth;
|
||||
}
|
||||
|
||||
/** container offset to offsetParent */
|
||||
/** @return {number} container offset to offsetParent */
|
||||
_getOffset() {
|
||||
return this.vertical ? this.container.offsetTop : this.container.offsetLeft;
|
||||
}
|
||||
|
@ -72,7 +78,11 @@ class Sizer {
|
|||
}
|
||||
}
|
||||
|
||||
/** returns the position of cursor at event relative to the edge of the container */
|
||||
/**
|
||||
@param {MouseEvent} event the mouse event
|
||||
@return {number} the distance between the cursor and the edge of the container,
|
||||
along the applicable axis (vertical or horizontal)
|
||||
*/
|
||||
offsetFromEvent(event) {
|
||||
const pos = this.vertical ? event.pageY : event.pageX;
|
||||
if (this.reverse) {
|
||||
|
|
Loading…
Reference in a new issue