Browse Source

Background areas are now neatly ignored from stacking

v3_develop
jos 10 years ago
parent
commit
727031283c
3 changed files with 5 additions and 5 deletions
  1. +2
    -2
      lib/timeline/Stack.js
  2. +1
    -1
      lib/timeline/component/item/BackgroundItem.js
  3. +2
    -2
      lib/timeline/component/item/Item.js

+ 2
- 2
lib/timeline/Stack.js View File

@ -49,7 +49,7 @@ exports.stack = function(items, margin, force) {
// calculate new, non-overlapping positions
for (i = 0, iMax = items.length; i < iMax; i++) {
var item = items[i];
if (item.top === null) {
if (item.stack && item.top === null) {
// initialize top position
item.top = margin.axis;
@ -59,7 +59,7 @@ exports.stack = function(items, margin, force) {
var collidingItem = null;
for (var j = 0, jj = items.length; j < jj; j++) {
var other = items[j];
if (other.top !== null && other !== item && other.ignoreStacking == false && exports.collision(item, other, margin.item)) {
if (other.top !== null && other !== item && other.stack && exports.collision(item, other, margin.item)) {
collidingItem = other;
break;
}

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

@ -34,13 +34,13 @@ function BackgroundItem (data, conversion, options) {
Item.call(this, data, conversion, options);
this.ignoreStacking = true; // this is not used when stacking
this.emptyContent = false;
}
BackgroundItem.prototype = new Item (null, null, null);
BackgroundItem.prototype.baseClassName = 'item background';
BackgroundItem.prototype.stack = false;
/**
* Check whether this item is visible inside given range

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

@ -26,10 +26,10 @@ function Item (data, conversion, options) {
this.left = null;
this.width = null;
this.height = null;
this.ignoreStacking = false;
}
Item.prototype.stack = true;
/**
* Select current item
*/

Loading…
Cancel
Save