grafana/public/app/features/dashboard/state/utils.ts
Hugo Häggmark d8e97fc024
Dashboard: Fixes rendering of repeating panels (#39991)
* Dashboard: Fixes rendering of repeating panels

* Chore: update after PR comments
2021-10-11 06:33:04 +02:00

18 lines
471 B
TypeScript

import { PanelModel } from './PanelModel';
import { REPEAT_DIR_HORIZONTAL } from '../../../core/constants';
export function isOnTheSameGridRow(sourcePanel: PanelModel, otherPanel: PanelModel): boolean {
if (sourcePanel.repeatDirection === REPEAT_DIR_HORIZONTAL) {
return false;
}
if (
otherPanel.gridPos.x >= sourcePanel.gridPos.x + sourcePanel.gridPos.w &&
otherPanel.gridPos.y === sourcePanel.gridPos.y
) {
return true;
}
return false;
}