Browse Source

Removed parameter `parent` from Item constructor

css_transitions
jos 10 years ago
parent
commit
36e512cefb
6 changed files with 19 additions and 20 deletions
  1. +5
    -1
      src/timeline/component/ItemSet.js
  2. +2
    -3
      src/timeline/component/item/Item.js
  3. +3
    -4
      src/timeline/component/item/ItemBox.js
  4. +3
    -4
      src/timeline/component/item/ItemPoint.js
  5. +3
    -4
      src/timeline/component/item/ItemRange.js
  6. +3
    -4
      src/timeline/component/item/ItemRangeOverflow.js

+ 5
- 1
src/timeline/component/ItemSet.js View File

@ -76,6 +76,7 @@ function ItemSet(backgroundPanel, axisPanel, labelPanel, options) {
this.touchParams = {}; // stores properties while dragging this.touchParams = {}; // stores properties while dragging
// create the HTML DOM // create the HTML DOM
this._create(); this._create();
} }
@ -115,6 +116,9 @@ ItemSet.prototype._create = function _create(){
this.dom.axis = axis; this.dom.axis = axis;
this.axisPanel.frame.appendChild(axis); this.axisPanel.frame.appendChild(axis);
// create ungrouped Group
this._updateUngrouped();
// attach event listeners // attach event listeners
// TODO: use event listeners from the rootpanel to improve performance? // TODO: use event listeners from the rootpanel to improve performance?
this.hammer = Hammer(frame, { this.hammer = Hammer(frame, {
@ -735,7 +739,7 @@ ItemSet.prototype._onUpdate = function _onUpdate(ids) {
if (!item) { if (!item) {
// create item // create item
if (constructor) { 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 item.id = id; // TODO: not so nice setting id afterwards
me._addItem(item); me._addItem(item);
} }

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

@ -1,15 +1,14 @@
/** /**
* @constructor Item * @constructor Item
* @param {ItemSet | Group} parent
* @param {Object} data Object containing (optional) parameters type, * @param {Object} data Object containing (optional) parameters type,
* start, end, content, group, className. * start, end, content, group, className.
* @param {Object} [options] Options to set initial property values * @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options * @param {Object} [defaultOptions] default options
* // TODO: describe available options * // TODO: describe available options
*/ */
function Item (parent, data, options, defaultOptions) {
function Item (data, options, defaultOptions) {
this.id = null; this.id = null;
this.parent = parent;
this.parent = null;
this.data = data; this.data = data;
this.dom = null; this.dom = null;
this.options = options || {}; this.options = options || {};

+ 3
- 4
src/timeline/component/item/ItemBox.js View File

@ -1,14 +1,13 @@
/** /**
* @constructor ItemBox * @constructor ItemBox
* @extends Item * @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start * @param {Object} data Object containing parameters start
* content, className. * content, className.
* @param {Object} [options] Options to set initial property values * @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options * @param {Object} [defaultOptions] default options
* // TODO: describe available options * // TODO: describe available options
*/ */
function ItemBox (parent, data, options, defaultOptions) {
function ItemBox (data, options, defaultOptions) {
this.props = { this.props = {
dot: { dot: {
width: 0, 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 * Check whether this item is visible inside given range

+ 3
- 4
src/timeline/component/item/ItemPoint.js View File

@ -1,14 +1,13 @@
/** /**
* @constructor ItemPoint * @constructor ItemPoint
* @extends Item * @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start * @param {Object} data Object containing parameters start
* content, className. * content, className.
* @param {Object} [options] Options to set initial property values * @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options * @param {Object} [defaultOptions] default options
* // TODO: describe available options * // TODO: describe available options
*/ */
function ItemPoint (parent, data, options, defaultOptions) {
function ItemPoint (data, options, defaultOptions) {
this.props = { this.props = {
dot: { dot: {
top: 0, 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 * Check whether this item is visible inside given range

+ 3
- 4
src/timeline/component/item/ItemRange.js View File

@ -1,14 +1,13 @@
/** /**
* @constructor ItemRange * @constructor ItemRange
* @extends Item * @extends Item
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start, end * @param {Object} data Object containing parameters start, end
* content, className. * content, className.
* @param {Object} [options] Options to set initial property values * @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options * @param {Object} [defaultOptions] default options
* // TODO: describe available options * // TODO: describe available options
*/ */
function ItemRange (parent, data, options, defaultOptions) {
function ItemRange (data, options, defaultOptions) {
this.props = { this.props = {
content: { content: {
width: 0 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'; ItemRange.prototype.baseClassName = 'item range';

+ 3
- 4
src/timeline/component/item/ItemRangeOverflow.js View File

@ -1,14 +1,13 @@
/** /**
* @constructor ItemRangeOverflow * @constructor ItemRangeOverflow
* @extends ItemRange * @extends ItemRange
* @param {ItemSet} parent
* @param {Object} data Object containing parameters start, end * @param {Object} data Object containing parameters start, end
* content, className. * content, className.
* @param {Object} [options] Options to set initial property values * @param {Object} [options] Options to set initial property values
* @param {Object} [defaultOptions] default options * @param {Object} [defaultOptions] default options
* // TODO: describe available options * // TODO: describe available options
*/ */
function ItemRangeOverflow (parent, data, options, defaultOptions) {
function ItemRangeOverflow (data, options, defaultOptions) {
this.props = { this.props = {
content: { content: {
left: 0, 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'; ItemRangeOverflow.prototype.baseClassName = 'item rangeoverflow';

Loading…
Cancel
Save