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.
This commit is contained in:
Marcus Andersson 2020-12-04 09:42:45 +01:00 committed by GitHub
parent db0fb1e2c1
commit de395f24e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
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>) => {