From ebf45bbf5a35374116a18dac9f38cd857bf62f80 Mon Sep 17 00:00:00 2001 From: Peter Pisljar Date: Fri, 4 Aug 2017 08:10:32 +0200 Subject: [PATCH] resize was not detected correctly (#13239) --- src/core_plugins/tile_map/public/maps_visualization.js | 6 +++--- src/ui/public/visualize/visualization.js | 4 +--- src/ui/public/visualize/visualize.js | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/core_plugins/tile_map/public/maps_visualization.js b/src/core_plugins/tile_map/public/maps_visualization.js index eb2be81aaeff7..3964e3bf905d8 100644 --- a/src/core_plugins/tile_map/public/maps_visualization.js +++ b/src/core_plugins/tile_map/public/maps_visualization.js @@ -42,6 +42,9 @@ export function MapsVisualizationProvider(serviceSettings, Notifier, getAppState return new Promise(async(resolve) => { await this._kibanaMapReady; + if (status.resize) { + this._kibanaMap.resize(); + } if (status.params || status.aggs) await this._updateParams(); if (esResponse && typeof esResponse.geohashGridAgg === 'undefined') { @@ -54,9 +57,6 @@ export function MapsVisualizationProvider(serviceSettings, Notifier, getAppState if (status.uiState) { this._kibanaMap.useUiStateFromVisualization(this.vis); } - if (status.resize) { - this._kibanaMap.resize(); - } this._doRenderComplete(resolve); diff --git a/src/ui/public/visualize/visualization.js b/src/ui/public/visualize/visualization.js index e54108a4f1fe4..54e32e31332e4 100644 --- a/src/ui/public/visualize/visualization.js +++ b/src/ui/public/visualize/visualization.js @@ -98,12 +98,10 @@ uiModules }); const Visualization = $scope.vis.type.visualization; - - //todo: make this not a jquery element const visualization = new Visualization(getVisEl()[0], $scope.vis); - const renderFunction = _.debounce(() => { + $scope.vis.size = [$el.width(), $el.height()]; const status = getUpdateStatus($scope); visualization.render($scope.visData, status) .then(() => { diff --git a/src/ui/public/visualize/visualize.js b/src/ui/public/visualize/visualize.js index a97422455ff62..5b64c87d10fff 100644 --- a/src/ui/public/visualize/visualize.js +++ b/src/ui/public/visualize/visualize.js @@ -137,7 +137,6 @@ uiModules let resizeInit = false; const resizeFunc = _.debounce(() => { if (!resizeInit) return resizeInit = true; - $scope.vis.size = [$el.width(), $el.height()]; $scope.$broadcast('render'); }, 200); resizeChecker.on('resize', resizeFunc);