Skip to content

Commit

Permalink
Revert "[Vega] Fix vega controls layout (elastic#130954)"
Browse files Browse the repository at this point in the history
This reverts commit 8e09cdc.
  • Loading branch information
flash1293 committed Oct 11, 2022
1 parent a2f2bc5 commit cd753c3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 23 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions src/plugins/vis_types/vega/public/components/vega_vis.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,15 @@
// flex-direction determined by js
}

.vgaVis--autoresize {
@include euiScrollBar;
max-width: 100%;
max-height: 100%;
overflow: auto;
.vgaVis__view {
overflow: hidden;
}
}

.vgaVis__view {
z-index: 0;
flex: 1 1 100%;

display: block;
max-width: 100%;
max-height: 100%;
width: 100%;
height: 100%;

canvas {
display: block;
Expand Down
14 changes: 6 additions & 8 deletions src/plugins/vis_types/vega/public/vega_view/vega_base_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ export class VegaBaseView {
this._initialized = true;

try {
if (this._parser.useResize) {
this._$parentEl.addClass('vgaVis--autoresize');
} else {
this._$parentEl.removeClass('vgaVis--autoresize');
}
this._$parentEl.empty().addClass(`vgaVis`).css('flex-direction', this._parser.containerDir);

// bypass the onWarn warning checks - in some cases warnings may still need to be shown despite being disabled
Expand All @@ -116,7 +111,10 @@ export class VegaBaseView {
return;
}

this._$container = $('<div class="vgaVis__view">').appendTo(this._$parentEl);
this._$container = $('<div class="vgaVis__view">')
// Force a height here because css is not loaded in mocha test
.css('height', '100%')
.appendTo(this._$parentEl);
this._$controls = $(
`<div class="vgaVis__controls vgaVis__controls--${this._parser.controlsDir}">`
).appendTo(this._$parentEl);
Expand Down Expand Up @@ -267,9 +265,9 @@ export class VegaBaseView {
}
}

async resize() {
async resize(dimensions) {
if (this._parser.useResize && this._view) {
this.updateVegaSize(this._view);
this.updateVegaSize(this._view, dimensions);
await this._view.runAsync();

// The derived class should create this method
Expand Down
2 changes: 0 additions & 2 deletions src/plugins/vis_types/vega/public/vega_view/vega_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export class VegaView extends VegaBaseView {

if (this._parser.useResize) this.updateVegaSize(view);
view.initialize(this._$container.get(0), this._$controls.get(0));
// resize again to take controls into account
if (this._parser.useResize) this.updateVegaSize(view);

if (this._parser.useHover) view.hover();

Expand Down

0 comments on commit cd753c3

Please sign in to comment.