Apply corrections identified by SonarQube (#8457)
This commit is contained in:
parent
99cb83a9df
commit
964c60d086
73 changed files with 211 additions and 232 deletions
|
@ -44,7 +44,7 @@ export default class IRCTimelineProfileResizer extends React.Component<IProps, I
|
|||
|
||||
componentDidMount() {
|
||||
this.setState({
|
||||
IRCLayoutRoot: document.querySelector(".mx_IRCLayout") as HTMLElement,
|
||||
IRCLayoutRoot: document.querySelector(".mx_IRCLayout"),
|
||||
}, () => this.updateCSSWidth(this.state.width));
|
||||
}
|
||||
|
||||
|
|
|
@ -352,10 +352,10 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
if (this.props.direction === Direction.Left) {
|
||||
const targetLeft = targetRect.left + window.pageXOffset;
|
||||
const targetLeft = targetRect.left + window.scrollX;
|
||||
return !contentRect || (targetLeft - contentRect.width > MIN_SAFE_DISTANCE_TO_WINDOW_EDGE);
|
||||
} else {
|
||||
const targetRight = targetRect.right + window.pageXOffset;
|
||||
const targetRight = targetRect.right + window.scrollX;
|
||||
const spaceOnRight = UIStore.instance.windowWidth - targetRight;
|
||||
return contentRect && (spaceOnRight - contentRect.width < MIN_SAFE_DISTANCE_TO_WINDOW_EDGE);
|
||||
}
|
||||
|
@ -366,10 +366,10 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
if (this.props.direction === Direction.Top) {
|
||||
const targetTop = targetRect.top + window.pageYOffset;
|
||||
const targetTop = targetRect.top + window.scrollY;
|
||||
return !contentRect || (targetTop - contentRect.height > MIN_SAFE_DISTANCE_TO_WINDOW_EDGE);
|
||||
} else {
|
||||
const targetBottom = targetRect.bottom + window.pageYOffset;
|
||||
const targetBottom = targetRect.bottom + window.scrollY;
|
||||
const spaceBelow = UIStore.instance.windowHeight - targetBottom;
|
||||
return contentRect && (spaceBelow - contentRect.height < MIN_SAFE_DISTANCE_TO_WINDOW_EDGE);
|
||||
}
|
||||
|
@ -429,10 +429,10 @@ export default class InteractiveTooltip extends React.Component<IProps, IState>
|
|||
const targetRect = this.target.getBoundingClientRect();
|
||||
|
||||
// The window X and Y offsets are to adjust position when zoomed in to page
|
||||
const targetLeft = targetRect.left + window.pageXOffset;
|
||||
const targetRight = targetRect.right + window.pageXOffset;
|
||||
const targetBottom = targetRect.bottom + window.pageYOffset;
|
||||
const targetTop = targetRect.top + window.pageYOffset;
|
||||
const targetLeft = targetRect.left + window.scrollX;
|
||||
const targetRight = targetRect.right + window.scrollX;
|
||||
const targetBottom = targetRect.bottom + window.scrollY;
|
||||
const targetTop = targetRect.top + window.scrollY;
|
||||
|
||||
// Place the tooltip above the target by default. If we find that the
|
||||
// tooltip content would extend past the safe area towards the window
|
||||
|
|
|
@ -116,12 +116,12 @@ export default class Tooltip extends React.Component<ITooltipProps> {
|
|||
? Math.min(parentBox.width, this.props.maxParentWidth)
|
||||
: parentBox.width
|
||||
);
|
||||
const baseTop = (parentBox.top - 2 + this.props.yOffset) + window.pageYOffset;
|
||||
const baseTop = (parentBox.top - 2 + this.props.yOffset) + window.scrollY;
|
||||
const top = baseTop + offset;
|
||||
const right = width - parentBox.left - window.pageXOffset;
|
||||
const left = parentBox.right + window.pageXOffset;
|
||||
const right = width - parentBox.left - window.scrollX;
|
||||
const left = parentBox.right + window.scrollX;
|
||||
const horizontalCenter = (
|
||||
parentBox.left - window.pageXOffset + (parentWidth / 2)
|
||||
parentBox.left - window.scrollX + (parentWidth / 2)
|
||||
);
|
||||
switch (this.props.alignment) {
|
||||
case Alignment.Natural:
|
||||
|
@ -154,7 +154,7 @@ export default class Tooltip extends React.Component<ITooltipProps> {
|
|||
break;
|
||||
case Alignment.TopRight:
|
||||
style.top = baseTop - 5;
|
||||
style.right = width - parentBox.right - window.pageXOffset;
|
||||
style.right = width - parentBox.right - window.scrollX;
|
||||
style.transform = "translate(5px, -100%)";
|
||||
break;
|
||||
case Alignment.TopCenter:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue