From 36e512cefbe5ca0f55766f96e16d931b12f13475 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 30 Apr 2014 14:36:46 +0200 Subject: [PATCH] Removed parameter `parent` from Item constructor --- src/timeline/component/ItemSet.js | 6 +++++- src/timeline/component/item/Item.js | 5 ++--- src/timeline/component/item/ItemBox.js | 7 +++---- src/timeline/component/item/ItemPoint.js | 7 +++---- src/timeline/component/item/ItemRange.js | 7 +++---- src/timeline/component/item/ItemRangeOverflow.js | 7 +++---- 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index 97dab172..e2fe0b85 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -76,6 +76,7 @@ function ItemSet(backgroundPanel, axisPanel, labelPanel, options) { this.touchParams = {}; // stores properties while dragging // create the HTML DOM + this._create(); } @@ -115,6 +116,9 @@ ItemSet.prototype._create = function _create(){ this.dom.axis = axis; this.axisPanel.frame.appendChild(axis); + // create ungrouped Group + this._updateUngrouped(); + // attach event listeners // TODO: use event listeners from the rootpanel to improve performance? this.hammer = Hammer(frame, { @@ -735,7 +739,7 @@ ItemSet.prototype._onUpdate = function _onUpdate(ids) { if (!item) { // create item if (constructor) { - item = new constructor(me, itemData, me.options, itemOptions); + item = new constructor(itemData, me.options, itemOptions); item.id = id; // TODO: not so nice setting id afterwards me._addItem(item); } diff --git a/src/timeline/component/item/Item.js b/src/timeline/component/item/Item.js index 6f6cef77..64cb5577 100644 --- a/src/timeline/component/item/Item.js +++ b/src/timeline/component/item/Item.js @@ -1,15 +1,14 @@ /** * @constructor Item - * @param {ItemSet | Group} parent * @param {Object} data Object containing (optional) parameters type, * start, end, content, group, className. * @param {Object} [options] Options to set initial property values * @param {Object} [defaultOptions] default options * // TODO: describe available options */ -function Item (parent, data, options, defaultOptions) { +function Item (data, options, defaultOptions) { this.id = null; - this.parent = parent; + this.parent = null; this.data = data; this.dom = null; this.options = options || {}; diff --git a/src/timeline/component/item/ItemBox.js b/src/timeline/component/item/ItemBox.js index df8d6fed..dd43d4a8 100644 --- a/src/timeline/component/item/ItemBox.js +++ b/src/timeline/component/item/ItemBox.js @@ -1,14 +1,13 @@ /** * @constructor ItemBox * @extends Item - * @param {ItemSet} parent * @param {Object} data Object containing parameters start * content, className. * @param {Object} [options] Options to set initial property values * @param {Object} [defaultOptions] default options * // TODO: describe available options */ -function ItemBox (parent, data, options, defaultOptions) { +function ItemBox (data, options, defaultOptions) { this.props = { dot: { width: 0, @@ -27,10 +26,10 @@ function ItemBox (parent, data, options, defaultOptions) { } } - Item.call(this, parent, data, options, defaultOptions); + Item.call(this, data, options, defaultOptions); } -ItemBox.prototype = new Item (null, null); +ItemBox.prototype = new Item (null); /** * Check whether this item is visible inside given range diff --git a/src/timeline/component/item/ItemPoint.js b/src/timeline/component/item/ItemPoint.js index eb6cca3f..6ab3111f 100644 --- a/src/timeline/component/item/ItemPoint.js +++ b/src/timeline/component/item/ItemPoint.js @@ -1,14 +1,13 @@ /** * @constructor ItemPoint * @extends Item - * @param {ItemSet} parent * @param {Object} data Object containing parameters start * content, className. * @param {Object} [options] Options to set initial property values * @param {Object} [defaultOptions] default options * // TODO: describe available options */ -function ItemPoint (parent, data, options, defaultOptions) { +function ItemPoint (data, options, defaultOptions) { this.props = { dot: { top: 0, @@ -28,10 +27,10 @@ function ItemPoint (parent, data, options, defaultOptions) { } } - Item.call(this, parent, data, options, defaultOptions); + Item.call(this, data, options, defaultOptions); } -ItemPoint.prototype = new Item (null, null); +ItemPoint.prototype = new Item (null); /** * Check whether this item is visible inside given range diff --git a/src/timeline/component/item/ItemRange.js b/src/timeline/component/item/ItemRange.js index 706555cc..3a28212d 100644 --- a/src/timeline/component/item/ItemRange.js +++ b/src/timeline/component/item/ItemRange.js @@ -1,14 +1,13 @@ /** * @constructor ItemRange * @extends Item - * @param {ItemSet} parent * @param {Object} data Object containing parameters start, end * content, className. * @param {Object} [options] Options to set initial property values * @param {Object} [defaultOptions] default options * // TODO: describe available options */ -function ItemRange (parent, data, options, defaultOptions) { +function ItemRange (data, options, defaultOptions) { this.props = { content: { width: 0 @@ -25,10 +24,10 @@ function ItemRange (parent, data, options, defaultOptions) { } } - Item.call(this, parent, data, options, defaultOptions); + Item.call(this, data, options, defaultOptions); } -ItemRange.prototype = new Item (null, null); +ItemRange.prototype = new Item (null); ItemRange.prototype.baseClassName = 'item range'; diff --git a/src/timeline/component/item/ItemRangeOverflow.js b/src/timeline/component/item/ItemRangeOverflow.js index a94c7cab..156123f6 100644 --- a/src/timeline/component/item/ItemRangeOverflow.js +++ b/src/timeline/component/item/ItemRangeOverflow.js @@ -1,14 +1,13 @@ /** * @constructor ItemRangeOverflow * @extends ItemRange - * @param {ItemSet} parent * @param {Object} data Object containing parameters start, end * content, className. * @param {Object} [options] Options to set initial property values * @param {Object} [defaultOptions] default options * // TODO: describe available options */ -function ItemRangeOverflow (parent, data, options, defaultOptions) { +function ItemRangeOverflow (data, options, defaultOptions) { this.props = { content: { left: 0, @@ -16,10 +15,10 @@ function ItemRangeOverflow (parent, data, options, defaultOptions) { } }; - ItemRange.call(this, parent, data, options, defaultOptions); + ItemRange.call(this, data, options, defaultOptions); } -ItemRangeOverflow.prototype = new ItemRange (null, null); +ItemRangeOverflow.prototype = new ItemRange (null); ItemRangeOverflow.prototype.baseClassName = 'item rangeoverflow';