Browse Source

fixes BoxItem's initial width if content width is dynamic; fixes #2032 (#2035)

codeClimate
Alexander Wunschik 8 years ago
committed by GitHub
parent
commit
8dd7849330
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      lib/timeline/component/item/BoxItem.js

+ 12
- 2
lib/timeline/component/item/BoxItem.js View File

@ -110,19 +110,29 @@ BoxItem.prototype.redraw = function() {
this._updateDataAttributes(this.dom.box);
this._updateStyle(this.dom.box);
var editable = (this.options.editable.updateTime ||
var editable = (this.options.editable.updateTime ||
this.options.editable.updateGroup ||
this.editable === true) &&
this.editable !== false;
// update class
var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' vis-selected' : '') +
(this.selected ? ' vis-selected' : '') +
(editable ? ' vis-editable' : ' vis-readonly');
dom.box.className = 'vis-item vis-box' + className;
dom.line.className = 'vis-item vis-line' + className;
dom.dot.className = 'vis-item vis-dot' + className;
// set initial position in the visible range of the grid so that the
// rendered box size can be determinated correctly, even the content
// has a dynamic width (fixes #2032).
// The correct position is reset by this.repositionX
if (this.options.rtl) {
dom.box.style.right = "0px";
} else {
dom.box.style.left = "0px";
}
// recalculate size
this.props.dot.height = dom.dot.offsetHeight;
this.props.dot.width = dom.dot.offsetWidth;

Loading…
Cancel
Save