mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
parent
cacae6a43b
commit
8a6ea4bfad
@ -6377,6 +6377,9 @@ exports[`better eslint`] = {
|
||||
[0, 0, 0, "Styles should be written using objects.", "0"],
|
||||
[0, 0, 0, "Styles should be written using objects.", "1"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/usePanning.ts:5381": [
|
||||
[0, 0, 0, "Do not use any type assertions.", "0"]
|
||||
],
|
||||
"public/app/plugins/panel/nodeGraph/utils.ts:5381": [
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "0"],
|
||||
[0, 0, 0, "Unexpected any. Specify a different type.", "1"]
|
||||
|
@ -183,12 +183,14 @@ function inBounds(value: number, min: number | undefined, max: number | undefine
|
||||
return Math.min(Math.max(value, min ?? -Infinity), max ?? Infinity);
|
||||
}
|
||||
|
||||
// The issue here is that TouchEvent is undefined while using instanceof in Firefox and Safari
|
||||
// which will throw an exception but if it's (event as TouchEvent).changedTouches it will be undefined
|
||||
// and the if check will fail so it will go to the else but will not throw an exception
|
||||
function getEventXY(event: Event): { x: number; y: number } {
|
||||
if (event instanceof TouchEvent) {
|
||||
if ((event as TouchEvent).changedTouches && event instanceof TouchEvent) {
|
||||
return { x: event.changedTouches[0].clientX, y: event.changedTouches[0].clientY };
|
||||
} else if (event instanceof MouseEvent) {
|
||||
return { x: event.clientX, y: event.clientY };
|
||||
} else {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user