From 610702f21e2bcf90736c14c9460d319db3ea7994 Mon Sep 17 00:00:00 2001 From: jos Date: Fri, 13 Jun 2014 12:37:25 +0200 Subject: [PATCH] Removed all usage of style.bottom --- src/timeline/component/TimeAxis.js | 18 ++---------------- src/timeline/component/css/panel.css | 2 ++ src/timeline/component/item/ItemBox.js | 16 +++++----------- src/timeline/component/item/ItemPoint.js | 4 +--- src/timeline/component/item/ItemRange.js | 4 +--- 5 files changed, 11 insertions(+), 33 deletions(-) diff --git a/src/timeline/component/TimeAxis.js b/src/timeline/component/TimeAxis.js index eadafa86..3dffeb5d 100644 --- a/src/timeline/component/TimeAxis.js +++ b/src/timeline/component/TimeAxis.js @@ -238,14 +238,7 @@ TimeAxis.prototype._repaintMinorText = function (x, text, orientation) { label.childNodes[0].nodeValue = text; - if (orientation == 'top') { - label.style.top = this.props.majorLabelHeight + 'px'; - label.style.bottom = ''; - } - else { - label.style.top = ''; - label.style.bottom = this.props.majorLabelHeight + 'px'; - } + label.style.top = (orientation == 'top') ? (this.props.majorLabelHeight + 'px') : '0'; label.style.left = x + 'px'; //label.title = title; // TODO: this is a heavy operation }; @@ -274,14 +267,7 @@ TimeAxis.prototype._repaintMajorText = function (x, text, orientation) { label.childNodes[0].nodeValue = text; //label.title = title; // TODO: this is a heavy operation - if (orientation == 'top') { - label.style.top = '0px'; - label.style.bottom = ''; - } - else { - label.style.top = ''; - label.style.bottom = '0px'; - } + label.style.top = (orientation == 'top') ? '0' : (this.props.minorLabelHeight + 'px'); label.style.left = x + 'px'; }; diff --git a/src/timeline/component/css/panel.css b/src/timeline/component/css/panel.css index 53f7e967..4c259f77 100644 --- a/src/timeline/component/css/panel.css +++ b/src/timeline/component/css/panel.css @@ -55,7 +55,9 @@ width: 100%; height: 1px; box-shadow: 0 0 10px rgba(0,0,0,0.8); + /* TODO: find a nice way to ensure shadows are drawn on top of items z-index: 1; + */ } .vis.timeline .vispanel .shadow.top { diff --git a/src/timeline/component/item/ItemBox.js b/src/timeline/component/item/ItemBox.js index 149b0da2..d97102d4 100644 --- a/src/timeline/component/item/ItemBox.js +++ b/src/timeline/component/item/ItemBox.js @@ -211,20 +211,14 @@ ItemBox.prototype.repositionY = function() { dot = this.dom.dot; if (orientation == 'top') { - box.style.top = (this.top || 0) + 'px'; - box.style.bottom = ''; - - line.style.top = '0'; - line.style.bottom = ''; + box.style.top = (this.top || 0) + 'px'; + line.style.top = '0'; line.style.height = (this.parent.top + this.top + 1) + 'px'; } else { // orientation 'bottom' - box.style.top = ''; - box.style.bottom = (this.top || 0) + 'px'; - - line.style.top = (this.parent.top + this.parent.height - this.top - 1) + 'px'; - line.style.bottom = '0'; - line.style.height = ''; + box.style.top = (this.parent.height - this.top - this.height || 0) + 'px'; + line.style.top = (this.parent.height - this.top - 1) + 'px'; + line.style.height = this.top + 'px'; } dot.style.top = (-this.props.dot.height / 2) + 'px'; diff --git a/src/timeline/component/item/ItemPoint.js b/src/timeline/component/item/ItemPoint.js index 9d1664ea..ebb74c28 100644 --- a/src/timeline/component/item/ItemPoint.js +++ b/src/timeline/component/item/ItemPoint.js @@ -183,10 +183,8 @@ ItemPoint.prototype.repositionY = function() { if (orientation == 'top') { point.style.top = this.top + 'px'; - point.style.bottom = ''; } else { - point.style.top = ''; - point.style.bottom = this.top + 'px'; + point.style.top = (this.parent.height - this.top - this.height) + 'px'; } }; diff --git a/src/timeline/component/item/ItemRange.js b/src/timeline/component/item/ItemRange.js index 859245b6..00a2b241 100644 --- a/src/timeline/component/item/ItemRange.js +++ b/src/timeline/component/item/ItemRange.js @@ -195,11 +195,9 @@ ItemRange.prototype.repositionY = function() { if (orientation == 'top') { box.style.top = this.top + 'px'; - box.style.bottom = ''; } else { - box.style.top = ''; - box.style.bottom = this.top + 'px'; + box.style.top = (this.parent.height - this.top - this.height) + 'px'; } };