[dashboard] Avoid triggering unnecessary window.resize events
@@ -4058,11 +4058,9 @@ $(document).ready(function () {
});
}
+
window.setInterval(function () {
if (searchViewModel.isGridster() && !isDraggingOrResizingWidgets) {
- if ($('.gridster li:first').width() !== $('.gridster').width()) {
- $(window).trigger('resize');
- }
var $gridster = $('.gridster>ul').data('gridster');
searchViewModel.gridItems().forEach(function (existingWidget) {
var scrollDifference = existingWidget.gridsterElement.scrollHeight - existingWidget.gridsterElement.clientHeight;
@@ -4112,6 +4110,10 @@ $(document).ready(function () {
}
}, 'dashboard');
+ huePubSub.subscribeOnce('gridster.added.widget', function () {
+ $(window).trigger('resize');
+ });
+
huePubSub.subscribe('gridster.added.widget', removePreviewHolder, 'dashboard');
huePubSub.subscribe('gridster.clean.whitespace', function () {
