Browse Source

updated background itemtype. No content is allowed now.

v3_develop
Alex de Mulder 10 years ago
parent
commit
8f63c115ee
6 changed files with 1978 additions and 1924 deletions
  1. +7
    -0
      dist/vis.css
  2. +1940
    -1920
      dist/vis.js
  3. +1
    -1
      dist/vis.min.css
  4. +7
    -0
      lib/timeline/component/css/item.css
  5. +20
    -2
      lib/timeline/component/item/BackgroundItem.js
  6. +3
    -1
      lib/timeline/component/item/Item.js

+ 7
- 0
dist/vis.css View File

@ -232,6 +232,13 @@
max-width: 100%; max-width: 100%;
margin: 5px; margin: 5px;
} }
.vis.timeline .item.background .noContent {
position: absolute;
display: inline-block;
overflow: hidden;
max-width: 100%;
margin: 0px;
}
.vis.timeline .item.line { .vis.timeline .item.line {
padding: 0; padding: 0;

+ 1940
- 1920
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.min.css
File diff suppressed because it is too large
View File


+ 7
- 0
lib/timeline/component/css/item.css View File

@ -72,6 +72,13 @@
max-width: 100%; max-width: 100%;
margin: 5px; margin: 5px;
} }
.vis.timeline .item.background .noContent {
position: absolute;
display: inline-block;
overflow: hidden;
max-width: 100%;
margin: 0px;
}
.vis.timeline .item.line { .vis.timeline .item.line {
padding: 0; padding: 0;

+ 20
- 2
lib/timeline/component/item/BackgroundItem.js View File

@ -31,6 +31,7 @@ function BackgroundItem (data, conversion, options) {
} }
} }
this.emptyContent = false;
Item.call(this, data, conversion, options); Item.call(this, data, conversion, options);
} }
@ -58,13 +59,20 @@ BackgroundItem.prototype.redraw = function() {
this.dom = {}; this.dom = {};
dom = this.dom; dom = this.dom;
// background box
// background box
dom.box = document.createElement('div'); dom.box = document.createElement('div');
// className is updated in redraw() // className is updated in redraw()
// contents box // contents box
dom.content = document.createElement('div'); dom.content = document.createElement('div');
dom.content.className = 'content';
if (this.data.content === undefined) {
dom.content.className = 'noContent';
this.emptyContent = true;
}
else {
dom.content.className = 'content';
this.emptyContent = false;
}
dom.box.appendChild(dom.content); dom.box.appendChild(dom.content);
// attach this item as attribute // attach this item as attribute
@ -91,6 +99,16 @@ BackgroundItem.prototype.redraw = function() {
// - the item's data is changed // - the item's data is changed
// - the item is selected/deselected // - the item is selected/deselected
if (this.dirty) { if (this.dirty) {
// only change content class when needed
if (this.data.content === undefined && this.emptyContent == false) {
dom.content.className = 'noContent';
this.emptyContent = true;
}
else if (this.data.content !== undefined && this.emptyContent == true) {
dom.content.className = 'content';
this.emptyContent = false;
}
this._updateContents(this.dom.content); this._updateContents(this.dom.content);
this._updateTitle(this.dom.content); this._updateTitle(this.dom.content);
this._updateDataAttributes(this.dom.content); this._updateDataAttributes(this.dom.content);

+ 3
- 1
lib/timeline/component/item/Item.js View File

@ -176,7 +176,9 @@ Item.prototype._updateContents = function (element) {
element.innerHTML = content; element.innerHTML = content;
} }
else { else {
throw new Error('Property "content" missing in item ' + this.data.id);
if (!(this.data.type == "background" && this.data.content === undefined)) {
throw new Error('Property "content" missing in item ' + this.data.id);
}
} }
}; };

Loading…
Cancel
Save