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 React, { PureComponent } from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import { isEqual } from 'lodash';
import { DataLink, LoadingState, PanelData, PanelMenuItem, QueryResultMetaNotice, ScopedVars } from '@grafana/data'; import { DataLink, LoadingState, PanelData, PanelMenuItem, QueryResultMetaNotice, ScopedVars } from '@grafana/data';
import { AngularComponent, config, getTemplateSrv } from '@grafana/runtime'; import { AngularComponent, config, getTemplateSrv } from '@grafana/runtime';
import { ClickOutsideWrapper, Icon, IconName, Tooltip, stylesFactory } from '@grafana/ui'; import { ClickOutsideWrapper, Icon, IconName, Tooltip, stylesFactory } from '@grafana/ui';
...@@ -52,8 +51,8 @@ export class PanelHeader extends PureComponent<Props, State> { ...@@ -52,8 +51,8 @@ export class PanelHeader extends PureComponent<Props, State> {
eventToClickCoordinates = (event: React.MouseEvent<HTMLDivElement>) => { eventToClickCoordinates = (event: React.MouseEvent<HTMLDivElement>) => {
return { return {
x: event.clientX, x: Math.floor(event.clientX),
y: event.clientY, y: Math.floor(event.clientY),
}; };
}; };
...@@ -62,7 +61,7 @@ export class PanelHeader extends PureComponent<Props, State> { ...@@ -62,7 +61,7 @@ export class PanelHeader extends PureComponent<Props, State> {
}; };
isClick = (clickCoordinates: ClickCoordinates) => { isClick = (clickCoordinates: ClickCoordinates) => {
return isEqual(clickCoordinates, this.clickCoordinates); return clickCoordinates.x === this.clickCoordinates.x && clickCoordinates.y === this.clickCoordinates.y;
}; };
onMenuToggle = (event: React.MouseEvent<HTMLDivElement>) => { 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