Просмотр исходного кода

HUE-7869 [dashboard] Avoid dropping of a widget on an invalid grid position

Enrico Berti 7 лет назад
Родитель
Сommit
bac8a5c
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      desktop/libs/dashboard/src/dashboard/templates/common_search.mako

+ 2 - 2
desktop/libs/dashboard/src/dashboard/templates/common_search.mako

@@ -3798,7 +3798,7 @@ $(document).ready(function () {
       col: Math.ceil((options.event.clientX - $('.gridster').offset().left) / (widgetGridWidth + 10)),
       row: Math.ceil((options.event.pageY - $('.gridster').offset().top) / (widgetGridHeight + 10))
     }
-    if (coords.row > 0 && coords.col > 0) {
+    if (coords.row > 0 && coords.col > 0 && coords.col < 13) {
       var overlaps = false;
       $('li.gs-w').each(function () {
         var dimensions = {
@@ -3851,7 +3851,7 @@ $(document).ready(function () {
         col: Math.ceil((options.event.clientX - $('.gridster').offset().left) / (widgetGridWidth + 10)),
         row: Math.ceil((options.event.pageY - $('.gridster').offset().top) / (widgetGridHeight + 10))
       }
-      if (dropPosition.row > 0 && dropPosition.col > 0) {
+      if (dropPosition.row > 0 && dropPosition.col > 0 && dropPosition.col < 13) {
         if (tempDraggable) {
           var optimalWidgetWidth = 12;
           var queueLength = 0;