add auto container height
This commit is contained in:
parent
f9c5b1f3ac
commit
218202c16d
12
src/index.js
12
src/index.js
@ -80,12 +80,10 @@ export default class Gantt {
|
|||||||
'lower-header-height': 'lower_header_height',
|
'lower-header-height': 'lower_header_height',
|
||||||
'upper-header-height': 'upper_header_height',
|
'upper-header-height': 'upper_header_height',
|
||||||
};
|
};
|
||||||
|
|
||||||
for (let name in CSS_VARIABLES) {
|
for (let name in CSS_VARIABLES) {
|
||||||
this.$container.style.setProperty(
|
let setting = this.options[CSS_VARIABLES[name]];
|
||||||
'--gv-' + name,
|
if (setting === 'auto') continue;
|
||||||
this.options[CSS_VARIABLES[name]] + 'px',
|
this.$container.style.setProperty('--gv-' + name, setting + 'px');
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.config = {
|
this.config = {
|
||||||
@ -873,13 +871,15 @@ export default class Gantt {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_dimensions() {
|
set_dimensions() {
|
||||||
const { width: cur_width } = this.$svg.getBoundingClientRect();
|
const { width: cur_width, height } = this.$svg.getBoundingClientRect();
|
||||||
const actual_width = this.$svg.querySelector('.grid .grid-row')
|
const actual_width = this.$svg.querySelector('.grid .grid-row')
|
||||||
? this.$svg.querySelector('.grid .grid-row').getAttribute('width')
|
? this.$svg.querySelector('.grid .grid-row').getAttribute('width')
|
||||||
: 0;
|
: 0;
|
||||||
if (cur_width < actual_width) {
|
if (cur_width < actual_width) {
|
||||||
this.$svg.setAttribute('width', actual_width);
|
this.$svg.setAttribute('width', actual_width);
|
||||||
}
|
}
|
||||||
|
if (this.options.container_height === 'auto')
|
||||||
|
this.$container.style.height = height + 'px';
|
||||||
}
|
}
|
||||||
|
|
||||||
set_scroll_position(date) {
|
set_scroll_position(date) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user