Browse Source

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

codeClimate
Alexander Wunschik 8 years ago
committed by Alexander Wunschik
parent
commit
343ead9dcb
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._updateDataAttributes(this.dom.box);
this._updateStyle(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.options.editable.updateGroup ||
this.editable === true) && this.editable === true) &&
this.editable !== false; this.editable !== false;
// update class // update class
var className = (this.data.className? ' ' + this.data.className : '') + var className = (this.data.className? ' ' + this.data.className : '') +
(this.selected ? ' vis-selected' : '') +
(this.selected ? ' vis-selected' : '') +
(editable ? ' vis-editable' : ' vis-readonly'); (editable ? ' vis-editable' : ' vis-readonly');
dom.box.className = 'vis-item vis-box' + className; dom.box.className = 'vis-item vis-box' + className;
dom.line.className = 'vis-item vis-line' + className; dom.line.className = 'vis-item vis-line' + className;
dom.dot.className = 'vis-item vis-dot' + 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 // recalculate size
this.props.dot.height = dom.dot.offsetHeight; this.props.dot.height = dom.dot.offsetHeight;
this.props.dot.width = dom.dot.offsetWidth; this.props.dot.width = dom.dot.offsetWidth;

Loading…
Cancel
Save