From bd2689736e2cf1959a8c39b7580fffc89f9348ec Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Wed, 22 Jul 2020 15:43:16 +0300 Subject: [PATCH] remove workaround for vega height bug Related to #31461 --- .../__snapshots__/vega_visualization.test.js.snap | 4 ++-- .../vis_type_vega/public/vega_view/vega_base_view.js | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap b/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap index 650d9c1b430f0..001382d946df6 100644 --- a/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap +++ b/src/plugins/vis_type_vega/public/__snapshots__/vega_visualization.test.js.snap @@ -4,6 +4,6 @@ exports[`VegaVisualizations VegaVisualization - basics should show vega blank re exports[`VegaVisualizations VegaVisualization - basics should show vega graph (may fail in dev env) 1`] = `"
"`; -exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 1`] = `"
"`; +exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 1`] = `"
"`; -exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 2`] = `"
"`; +exports[`VegaVisualizations VegaVisualization - basics should show vegalite graph and update on resize (may fail in dev env) 2`] = `"
"`; diff --git a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js index 8f88d5c5b2056..4596b47364494 100644 --- a/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js +++ b/src/plugins/vis_type_vega/public/vega_view/vega_base_view.js @@ -195,13 +195,9 @@ export class VegaBaseView { const width = Math.max(0, this._$container.width() - this._parser.paddingWidth); const height = Math.max(0, this._$container.height() - this._parser.paddingHeight) - heightExtraPadding; - // Somehow the `height` signal in vega becomes zero if the height is set exactly to - // an even number. This is a dirty workaround for this. - // when vega itself is updated again, it should be checked whether this is still - // necessary. - const adjustedHeight = height + 0.00000001; - if (view.width() !== width || view.height() !== adjustedHeight) { - view.width(width).height(adjustedHeight); + + if (view.width() !== width || view.height() !== height) { + view.width(width).height(height); return true; } return false;