mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Minor progress on edit mode
This commit is contained in:
@@ -8,6 +8,7 @@ import classNames from 'classnames';
|
||||
import sizeMe from 'react-sizeme';
|
||||
|
||||
let lastGridWidth = 1200;
|
||||
let ignoreNextWidthChange = false;
|
||||
|
||||
function GridWrapper({
|
||||
size,
|
||||
@@ -24,8 +25,12 @@ function GridWrapper({
|
||||
isFullscreen,
|
||||
}) {
|
||||
const width = size.width > 0 ? size.width : lastGridWidth;
|
||||
|
||||
// logic to ignore width changes (optimization)
|
||||
if (width !== lastGridWidth) {
|
||||
if (!isFullscreen && Math.abs(width - lastGridWidth) > 8) {
|
||||
if (ignoreNextWidthChange) {
|
||||
ignoreNextWidthChange = false;
|
||||
} else if (!isFullscreen && Math.abs(width - lastGridWidth) > 8) {
|
||||
onWidthChange();
|
||||
lastGridWidth = width;
|
||||
}
|
||||
@@ -138,6 +143,7 @@ export class DashboardGrid extends React.Component<DashboardGridProps, any> {
|
||||
}
|
||||
|
||||
onViewModeChanged(payload) {
|
||||
ignoreNextWidthChange = true;
|
||||
this.setState({ animated: !payload.fullscreen });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user