From 1dcb84a507367c4ec42ebaa42fe9ac5d31af9b0f Mon Sep 17 00:00:00 2001 From: jos Date: Tue, 22 Apr 2014 15:47:06 +0200 Subject: [PATCH] Cleaned up some old TODO's --- src/timeline/component/GroupSet.js | 11 ++--------- src/timeline/component/ItemSet.js | 12 ++---------- src/timeline/component/Panel.js | 2 +- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/timeline/component/GroupSet.js b/src/timeline/component/GroupSet.js index c3b612a9..1e94fa3c 100644 --- a/src/timeline/component/GroupSet.js +++ b/src/timeline/component/GroupSet.js @@ -257,7 +257,6 @@ GroupSet.prototype.repaint = function repaint() { }); // reposition the labels and calculate the maximum label width - // TODO: labels are not displayed correctly when orientation=='top' var maxWidth = 0; for (id in groups) { if (groups.hasOwnProperty(id)) { @@ -327,7 +326,7 @@ GroupSet.prototype.hide = function hide() { // hide labelset this.labelPanel.removeChild(this.labelSet); - // TODO: replace the following with a panel holding all itemsets, do not hide groups individually + // hide each of the groups for (var groupId in this.groups) { if (this.groups.hasOwnProperty(groupId)) { this.groups[groupId].hide(); @@ -345,7 +344,7 @@ GroupSet.prototype.show = function show() { this.labelPanel.removeChild(this.labelSet); } - // TODO: replace the following with a panel holding all itemsets, do not show groups individually + // show each of the groups for (var groupId in this.groups) { if (this.groups.hasOwnProperty(groupId)) { this.groups[groupId].show(); @@ -378,18 +377,12 @@ GroupSet.prototype._onAdd = function _onAdd(ids) { height: null }); - // TODO: do not recreate the group with every update - group = new Group(me, me.labelSet, me.backgroundPanel, me.axisPanel, id, groupOptions); group.on('change', me.emit.bind(me, 'change')); // propagate change event group.setRange(me.range); group.setItems(me.itemsData); // attach items data me.groups[id] = group; group.parent = me; - - // Note: it is important to add the binding after group.setItems - // is executed, because that will start an infinite loop - // as this call will already trigger a repaint } // update group data diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index 6ac1c0a2..77233381 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -10,7 +10,6 @@ * @constructor ItemSet * @extends Panel */ -// TODO: improve performance by replacing all Array.forEach with a for loop function ItemSet(backgroundPanel, axisPanel, options) { this.id = util.randomUUID(); @@ -54,8 +53,6 @@ function ItemSet(backgroundPanel, axisPanel, options) { this.touchParams = {}; // stores properties while dragging - // TODO: ItemSet should also attach event listeners for rangechange and rangechanged, like timeaxis - // create the HTML DOM this._create(); } @@ -97,7 +94,7 @@ ItemSet.prototype._create = function _create(){ this.axisPanel.frame.appendChild(axis); // 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, { prevent_default: true }); @@ -330,7 +327,7 @@ ItemSet.prototype.repaint = function repaint() { } // reposition visible items vertically - //this.stack.order(this.visibleItems); // TODO: solve ordering issue + //this.stack.order(this.visibleItems); // TODO: improve ordering var force = this.stackDirty || zoomed; // force re-stacking of all items if true this.stack.stack(this.visibleItems, force); this.stackDirty = false; @@ -500,7 +497,6 @@ ItemSet.prototype._onUpdate = function _onUpdate(ids) { var constructor = ItemSet.types[type]; - // TODO: how to handle items with invalid data? hide them and give a warning? or throw an error? if (item) { // update item if (!constructor || !(item instanceof constructor)) { @@ -582,10 +578,6 @@ ItemSet.prototype._order = function _order() { // reorder the items this.stack.orderByStart(this.orderedItems.byStart); this.stack.orderByEnd(this.orderedItems.byEnd); - - // TODO: cleanup - //console.log('byStart', this.orderedItems.byStart.map(function (item) {return item.id})) - //console.log('byEnd', this.orderedItems.byEnd.map(function (item) {return item.id})) }; /** diff --git a/src/timeline/component/Panel.js b/src/timeline/component/Panel.js index 84d70e7b..eb4264c5 100644 --- a/src/timeline/component/Panel.js +++ b/src/timeline/component/Panel.js @@ -11,7 +11,7 @@ */ function Panel(options) { this.id = util.randomUUID(); - this.parent = null; // TODO: remove parent? + this.parent = null; this.childs = []; this.options = options || {};