Browse Source

lint timeline component item (#3310)

revert-3409-performance
macleodbroad-wf 6 years ago
committed by Yotam Berkowitz
parent
commit
b5ef4b9ed9
4 changed files with 6 additions and 14 deletions
  1. +1
    -5
      lib/timeline/component/item/BackgroundItem.js
  2. +0
    -1
      lib/timeline/component/item/BoxItem.js
  3. +5
    -7
      lib/timeline/component/item/Item.js
  4. +0
    -1
      lib/timeline/component/item/RangeItem.js

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

@ -1,4 +1,3 @@
var Hammer = require('../../../module/hammer');
var Item = require('./Item');
var BackgroundGroup = require('../BackgroundGroup');
var RangeItem = require('./RangeItem');
@ -141,17 +140,14 @@ BackgroundItem.prototype.repositionX = RangeItem.prototype.repositionX;
* Reposition the item vertically
* @Override
*/
BackgroundItem.prototype.repositionY = function(margin) {
BackgroundItem.prototype.repositionY = function(margin) { // eslint-disable-line no-unused-vars
var height;
var orientation = this.options.orientation.item;
// special positioning for subgroups
if (this.data.subgroup !== undefined) {
// TODO: instead of calculating the top position of the subgroups here for every BackgroundItem, calculate the top of the subgroup once in Itemset
var itemSubgroup = this.data.subgroup;
var subgroups = this.parent.subgroups;
var subgroupIndex = subgroups[itemSubgroup].index;
this.dom.box.style.height = this.parent.subgroups[itemSubgroup].height + 'px';

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

@ -1,5 +1,4 @@
var Item = require('./Item');
var util = require('../../../util');
/**
* @constructor BoxItem

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

@ -99,7 +99,7 @@ Item.prototype.setParent = function(parent) {
* @returns {{start: Number, end: Number}} range with a timestamp for start and end
* @returns {boolean} True if visible
*/
Item.prototype.isVisible = function(range) {
Item.prototype.isVisible = function(range) { // eslint-disable-line no-unused-vars
return false;
};
@ -244,9 +244,6 @@ Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
this.data.editable !== false;
if (this.selected && editable && !this.dom.onItemUpdateTimeTooltip) {
// create and show tooltip
var me = this;
var onItemUpdateTimeTooltip = document.createElement('div');
onItemUpdateTimeTooltip.className = 'vis-onUpdateTime-tooltip';
@ -321,6 +318,7 @@ Item.prototype._repaintOnItemUpdateTimeTooltip = function (anchor) {
*/
Item.prototype._updateContents = function (element) {
var content;
var changed;
var templateFunction;
var itemVisibleFrameContent;
var visibleFrameTemplateFunction;
@ -340,7 +338,7 @@ Item.prototype._updateContents = function (element) {
if ((itemVisibleFrameContent instanceof Object) && !(itemVisibleFrameContent instanceof Element)) {
visibleFrameTemplateFunction(itemData, itemVisibleFrameContentElement)
} else {
var changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent);
changed = this._contentToString(this.itemVisibleFrameContent) !== this._contentToString(itemVisibleFrameContent);
if (changed) {
// only replace the content when changed
if (itemVisibleFrameContent instanceof Element) {
@ -371,7 +369,7 @@ Item.prototype._updateContents = function (element) {
if ((content instanceof Object) && !(content instanceof Element)) {
templateFunction(itemData, element)
} else {
var changed = this._contentToString(this.content) !== this._contentToString(content);
changed = this._contentToString(this.content) !== this._contentToString(content);
if (changed) {
// only replace the content when changed
if (content instanceof Element) {
@ -470,7 +468,7 @@ Item.prototype._updateEditStatus = function() {
} else if(typeof this.options.editable === 'object') {
this.editable = {};
util.selectiveExtend(['updateTime', 'updateGroup', 'remove'], this.editable, this.options.editable);
};
}
}
// Item data overrides, except if options.editable.overrideItems is set.
if (!this.options || !(this.options.editable) || (this.options.editable.overrideItems !== true)) {

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

@ -1,4 +1,3 @@
var Hammer = require('../../../module/hammer');
var Item = require('./Item');
/**

Loading…
Cancel
Save