Commit de395f24 by Marcus Andersson Committed by GitHub

Panel: making sure we support all versions of chrome when detecting position of…

Panel: making sure we support all versions of chrome when detecting position of click event. (#29544)

* making sure we are always using int value when compairing coordinates.

* removed unused import.

* Using Math.floor instead.

* removed unused dep.
parent db0fb1e2
import React, { PureComponent } from 'react';
import classNames from 'classnames';
import { isEqual } from 'lodash';
import { DataLink, LoadingState, PanelData, PanelMenuItem, QueryResultMetaNotice, ScopedVars } from '@grafana/data';
import { AngularComponent, config, getTemplateSrv } from '@grafana/runtime';
import { ClickOutsideWrapper, Icon, IconName, Tooltip, stylesFactory } from '@grafana/ui';
......@@ -52,8 +51,8 @@ export class PanelHeader extends PureComponent<Props, State> {
eventToClickCoordinates = (event: React.MouseEvent<HTMLDivElement>) => {
return {
x: event.clientX,
y: event.clientY,
x: Math.floor(event.clientX),
y: Math.floor(event.clientY),
};
};
......@@ -62,7 +61,7 @@ export class PanelHeader extends PureComponent<Props, State> {
};
isClick = (clickCoordinates: ClickCoordinates) => {
return isEqual(clickCoordinates, this.clickCoordinates);
return clickCoordinates.x === this.clickCoordinates.x && clickCoordinates.y === this.clickCoordinates.y;
};
onMenuToggle = (event: React.MouseEvent<HTMLDivElement>) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment