diff options
author | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-21 04:26:53 +0400 |
---|---|---|
committer | Benaka Moorthi <benaka.moorthi@gmail.com> | 2013-09-21 04:26:53 +0400 |
commit | c2061d4fd17875fba690b404c38bee30cde2fd31 (patch) | |
tree | e5b095b8ff56446213260ebf435db215d2a52374 /plugins/CoreHome | |
parent | ed569f20bbf74dd40ec33f9204bbbfd33358eba4 (diff) |
Refs #4077, #4041, resize treemap on widget resize and fix regression in jqplot refactoring (export as image didn't work).
Diffstat (limited to 'plugins/CoreHome')
-rw-r--r-- | plugins/CoreHome/javascripts/uiControl.js | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/plugins/CoreHome/javascripts/uiControl.js b/plugins/CoreHome/javascripts/uiControl.js index 3d5dba646d..7c92d26a01 100644 --- a/plugins/CoreHome/javascripts/uiControl.js +++ b/plugins/CoreHome/javascripts/uiControl.js @@ -24,9 +24,8 @@ var $element = this.$element = $(element); $element.data('uiControlObject', this); - // convert values in params that are arrays to comma separated string lists var params = JSON.parse($element.attr('data-params') || '{}'); - for (var key in params) { + for (var key in params) { // convert values in params that are arrays to comma separated string lists if (params[key] instanceof Array) { params[key] = params[key].join(','); } @@ -46,7 +45,7 @@ * to the DOM. * * TODO: instead of having other pieces of the UI manually calling cleanupUnusedControls, - * MutationObservers should be called + * MutationObservers should be used */ UIControl.cleanupUnusedControls = function () { var controls = UIControl._controls; @@ -88,6 +87,20 @@ delete this.$element; this._baseDestroyCalled = true; + }, + + /** + * Handle the widget resize event, if we're currently in a widget. + * + * TODO: should use proper resize detection (see + * http://www.backalleycoder.com/2013/03/18/cross-browser-event-based-element-resize-detection/ ) + * with timeouts (since resizing widgets can be expensive) + */ + onWidgetResize: function (handler) { + var $widget = this.$element.closest('.widgetContent'); + $widget.on('widget:maximise', handler) + .on('widget:minimise', handler) + .on('widget:resize', handler); } }; |