mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 04:59:15 -06:00
ux(panel resize): snap to even 12ths spans
This commit is contained in:
parent
10a42cc98c
commit
4db723ea81
@ -159,20 +159,29 @@ module.directive('panelResizer', function($rootScope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scope.$apply(function() {
|
scope.$apply(function() {
|
||||||
ctrl.render();
|
// ctrl.render();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function dragEndHandler() {
|
function dragEndHandler() {
|
||||||
|
ctrl.panel.span = Math.round(ctrl.panel.span);
|
||||||
|
if (lastPanel) {
|
||||||
|
lastPanel.span = Math.round(lastPanel.span);
|
||||||
|
}
|
||||||
|
|
||||||
// if close to 12
|
// if close to 12
|
||||||
var rowSpan = ctrl.dashboard.rowSpan(ctrl.row);
|
var rowSpan = ctrl.dashboard.rowSpan(ctrl.row);
|
||||||
if (rowSpan < 12 && rowSpan > 11) {
|
if (rowSpan < 12 && rowSpan > 11) {
|
||||||
lastPanel.span += 12 - rowSpan;
|
lastPanel.span += 12 - rowSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
scope.$apply(function() {
|
// first digest to propagate panel width change
|
||||||
|
// then render
|
||||||
|
$rootScope.$apply(function() {
|
||||||
|
setTimeout(function() {
|
||||||
$rootScope.$broadcast('render');
|
$rootScope.$broadcast('render');
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
$('body').off('mousemove', moveHandler);
|
$('body').off('mousemove', moveHandler);
|
||||||
$('body').off('mouseup', dragEndHandler);
|
$('body').off('mouseup', dragEndHandler);
|
||||||
|
Loading…
Reference in New Issue
Block a user