[dashboard] Fix dropping of a widget on empty space
@@ -3806,6 +3806,7 @@ $(document).ready(function () {
var $huePreviewHolder = $('.hue-preview-holder');
if (coords.row > 0 && coords.col > 0 && coords.col < 13) {
var overlaps = false;
+ var isEmptyWidget = false;
$('li.gs-w').each(function () {
var dimensions = {
col: parseInt($(this).attr('data-immutable-col')),
@@ -3814,7 +3815,7 @@ $(document).ready(function () {
sizey: parseInt($(this).attr('data-immutable-sizey'))
}
var $widget = $(this);
- var isEmptyWidget = $widget.children('.empty-gridster-widget').length > 0;
+ isEmptyWidget = $widget.children('.empty-gridster-widget').length > 0;
if (coords.col >= dimensions.col && coords.row >= dimensions.row && coords.col < dimensions.col + dimensions.sizex && coords.row < dimensions.row + dimensions.sizey) {
overlaps = true;
if (!isEmptyWidget) {
@@ -3960,6 +3961,9 @@ $(document).ready(function () {
$huePreviewHolder.removeAttr('data-widgetrow');
$huePreviewHolder.removeAttr('data-widgetcol');
}
+ if (isEmptyWidget) {
+ $huePreviewHolder.hide();
+ }
}
else {
$huePreviewHolder.hide();
@@ -4074,6 +4078,7 @@ $(document).ready(function () {
if (searchViewModel.columns().length > 0) {
+ if (typeof dimensions.overlap !== 'undefined') {
if (dimensions.overlap === 'N') {
dimensions.row = dimensions.widgetRow;
}
@@ -4105,6 +4110,7 @@ $(document).ready(function () {
}
}
}
+ }
if (tempDraggable) {
searchViewModel.gridItems.push(
