Browse Source

Cleaned up some old TODO's

css_transitions
jos 10 years ago
parent
commit
1dcb84a507
3 changed files with 5 additions and 20 deletions
  1. +2
    -9
      src/timeline/component/GroupSet.js
  2. +2
    -10
      src/timeline/component/ItemSet.js
  3. +1
    -1
      src/timeline/component/Panel.js

+ 2
- 9
src/timeline/component/GroupSet.js View File

@ -257,7 +257,6 @@ GroupSet.prototype.repaint = function repaint() {
}); });
// reposition the labels and calculate the maximum label width // reposition the labels and calculate the maximum label width
// TODO: labels are not displayed correctly when orientation=='top'
var maxWidth = 0; var maxWidth = 0;
for (id in groups) { for (id in groups) {
if (groups.hasOwnProperty(id)) { if (groups.hasOwnProperty(id)) {
@ -327,7 +326,7 @@ GroupSet.prototype.hide = function hide() {
// hide labelset // hide labelset
this.labelPanel.removeChild(this.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) { for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) { if (this.groups.hasOwnProperty(groupId)) {
this.groups[groupId].hide(); this.groups[groupId].hide();
@ -345,7 +344,7 @@ GroupSet.prototype.show = function show() {
this.labelPanel.removeChild(this.labelSet); 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) { for (var groupId in this.groups) {
if (this.groups.hasOwnProperty(groupId)) { if (this.groups.hasOwnProperty(groupId)) {
this.groups[groupId].show(); this.groups[groupId].show();
@ -378,18 +377,12 @@ GroupSet.prototype._onAdd = function _onAdd(ids) {
height: null height: null
}); });
// TODO: do not recreate the group with every update
group = new Group(me, me.labelSet, me.backgroundPanel, me.axisPanel, id, groupOptions); group = new Group(me, me.labelSet, me.backgroundPanel, me.axisPanel, id, groupOptions);
group.on('change', me.emit.bind(me, 'change')); // propagate change event group.on('change', me.emit.bind(me, 'change')); // propagate change event
group.setRange(me.range); group.setRange(me.range);
group.setItems(me.itemsData); // attach items data group.setItems(me.itemsData); // attach items data
me.groups[id] = group; me.groups[id] = group;
group.parent = me; 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 // update group data

+ 2
- 10
src/timeline/component/ItemSet.js View File

@ -10,7 +10,6 @@
* @constructor ItemSet * @constructor ItemSet
* @extends Panel * @extends Panel
*/ */
// TODO: improve performance by replacing all Array.forEach with a for loop
function ItemSet(backgroundPanel, axisPanel, options) { function ItemSet(backgroundPanel, axisPanel, options) {
this.id = util.randomUUID(); this.id = util.randomUUID();
@ -54,8 +53,6 @@ function ItemSet(backgroundPanel, axisPanel, options) {
this.touchParams = {}; // stores properties while dragging this.touchParams = {}; // stores properties while dragging
// TODO: ItemSet should also attach event listeners for rangechange and rangechanged, like timeaxis
// create the HTML DOM // create the HTML DOM
this._create(); this._create();
} }
@ -97,7 +94,7 @@ ItemSet.prototype._create = function _create(){
this.axisPanel.frame.appendChild(axis); this.axisPanel.frame.appendChild(axis);
// 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, {
prevent_default: true prevent_default: true
}); });
@ -330,7 +327,7 @@ ItemSet.prototype.repaint = function repaint() {
} }
// reposition visible items vertically // 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 var force = this.stackDirty || zoomed; // force re-stacking of all items if true
this.stack.stack(this.visibleItems, force); this.stack.stack(this.visibleItems, force);
this.stackDirty = false; this.stackDirty = false;
@ -500,7 +497,6 @@ ItemSet.prototype._onUpdate = function _onUpdate(ids) {
var constructor = ItemSet.types[type]; 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) { if (item) {
// update item // update item
if (!constructor || !(item instanceof constructor)) { if (!constructor || !(item instanceof constructor)) {
@ -582,10 +578,6 @@ ItemSet.prototype._order = function _order() {
// reorder the items // reorder the items
this.stack.orderByStart(this.orderedItems.byStart); this.stack.orderByStart(this.orderedItems.byStart);
this.stack.orderByEnd(this.orderedItems.byEnd); 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}))
}; };
/** /**

+ 1
- 1
src/timeline/component/Panel.js View File

@ -11,7 +11,7 @@
*/ */
function Panel(options) { function Panel(options) {
this.id = util.randomUUID(); this.id = util.randomUUID();
this.parent = null; // TODO: remove parent?
this.parent = null;
this.childs = []; this.childs = [];
this.options = options || {}; this.options = options || {};

Loading…
Cancel
Save