I am using a vaadin-split-layout
element to split the screen vertically.
I have the following as part of the style for my application.
.flex-horizontal {
@apply(--layout-horizontal);
}
.flex-vertical {
@apply(--layout-vertical);
}
.flexchild {
@apply(--layout-flex);
}
The following is the vaadin-split-layout
. The easymetahub-d3-graph supports the IronResizeableBehavior
. I need the elements with the id of thetop
and d3graphcontainer
to rrespond to the iron resize behavior so the the easymetahub-d3-graph
responds to the iron resize in the vaadin-split-layout
.
<vaadin-split-layout orientation="vertical">
<div id="thetop" class="card flexchild">
<vaadin-horizontal-layout>
<div class="flex-vertical" style="margin-top: 20px; margin-bottom: 70px;">
<paper-icon-button class="command" id="changeButton" title="Save changes" icon="save" disabled$="[[!changelog.length]]" on-tap="openSaveChanges"></paper-icon-button>
<paper-icon-button class="command" title="Harvest Data" src="images/app-icon-32.png" on-tap="openHarvestData"></paper-icon-button>
<paper-icon-button class="command" title="Monitor Harvests" icon="watch-later" on-tap="openMonitorHarvest"></paper-icon-button>
<div class="flexchild"></div>
<div class="rootnode">Root</div>
<div class="dependentnode">Dependent</div>
<div class="referencenode">Reference</div>
<div class="unassignednode">Unassigned</div>
</div>
<div id="d3graphcontainer" style="width: 100%; height: 50vh; min-height: 300px;">
<easymetahub-d3-graph graph="[[result]]" selected-node="{{entitydetail}}" selected-link="{{selectedLink}}" changelog="{{changelog}}" class="flex-vertical"></easymetahub-d3-graph>
</div>
</vaadin-horizontal-layout>
</div>
<iron-pages id="ip" selected="0">
<no-detail></no-detail>
<entity-display entitydetail="{{entitydetail}}" changelog="{{changelog}}"></entity-display>
<link-detail linkdetail="{{selectedLink}}"></link-detail>
</iron-pages>
</vaadin-split-layout>
What am I missing?
I found a solution. I put a vaadin-split-layout within the top part of the split.
<vaadin-split-layout orientation="vertical" style="height: 100%;">
<vaadin-split-layout orientation="horizontal" style="height: 50%; min-height: 100px;">
<iron-resize-div id="sidebar" class="flex-vertical"v style="min-width: 85px; max-width: 85px;">
<paper-icon-button style="width: 85px;" class="command" id="changeButton" title="Save changes" icon="save" disabled$="[[!changelog.length]]" on-tap="openSaveChanges"></paper-icon-button>
<paper-icon-button style="width: 85px;" class="command" title="Harvest Data" src="images/app-icon-32.png" on-tap="openHarvestData"></paper-icon-button>
<paper-icon-button style="width: 85px;" class="command" title="Monitor Harvests" icon="watch-later" on-tap="openMonitorHarvest"></paper-icon-button>
<div style="width: 85px;" class="flexchild"></div>
<div class="rootnode" style="width: 85px;">Root</div>
<div class="dependentnode" style="width: 85px;">Dependent</div>
<div class="referencenode" style="width: 85px;">Reference</div>
<div class="unassignednode" style="width: 85px;">Unassigned</div>
</iron-resize-div>
<easymetahub-d3-graph graph="[[result]]" selected-node="{{entitydetail}}" selected-link="{{selectedLink}}" changelog="{{changelog}}" class="flex-vertical"></easymetahub-d3-graph>
</vaadin-split-layout>
With the following as the iron-resize-div
"use strict";
import {html, PolymerElement} from '@polymer/polymer/polymer-element.js';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {IronResizableBehavior} from '@polymer/iron-resizable-behavior/iron-resizable-behavior.js';
/**
* @customElement
* @polymer
*/
class IronResizeDiv extends mixinBehaviors([IronResizableBehavior], PolymerElement) {
static get template() {
return html`
<style>
:host {
display: block;
height: 100%;
width: 100%;
}
.general {
width: 98%;
height: 98%;
}
</style>
<div class="general">
<slot></slot>
</div>
`;
}
static get properties() {
return {
};
}
connectedCallback() {
super.connectedCallback();
this.addEventListener('iron-resize', this.onIronResize.bind(this));
}
onIronResize() {
this.width = this.offsetWidth;
this.height = this.offsetHeight;
this.notifyResize();
}
}
window.customElements.define('iron-resize-div', IronResizeDiv);
The content within the top of the vertical split now works like I want it to.