From d4ba65505056c8923bba5ad174037ab382b43cdd Mon Sep 17 00:00:00 2001 From: jos Date: Thu, 30 Apr 2015 10:19:05 +0200 Subject: [PATCH] Changed the 'auto' alignment of range item contents such that it always displays the left side of the conents (see #785) --- lib/timeline/component/css/item.css | 6 +++--- lib/timeline/component/item/RangeItem.js | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/timeline/component/css/item.css b/lib/timeline/component/css/item.css index c69ecb0c..225daf83 100644 --- a/lib/timeline/component/css/item.css +++ b/lib/timeline/component/css/item.css @@ -87,15 +87,15 @@ .vis-item .vis-item-content { white-space: nowrap; box-sizing: border-box; - margin: 5px; + padding: 5px; } .vis-item .vis-delete { - background: url('img/timeline/delete.png') no-repeat top center; + background: url('img/timeline/delete.png') no-repeat center; position: absolute; width: 24px; height: 24px; - top: 0; + top: -4px; right: -24px; cursor: pointer; } diff --git a/lib/timeline/component/item/RangeItem.js b/lib/timeline/component/item/RangeItem.js index 4a4fc72d..53bec65c 100644 --- a/lib/timeline/component/item/RangeItem.js +++ b/lib/timeline/component/item/RangeItem.js @@ -189,6 +189,7 @@ RangeItem.prototype.repositionX = function(limitSize) { this.left = start; this.width = boxWidth; contentWidth = Math.min(end - start - 2 * this.options.padding, this.props.content.width); + // TODO: remove the need for options.padding. it's terrible. } this.dom.box.style.left = this.left + 'px'; @@ -219,9 +220,7 @@ RangeItem.prototype.repositionX = function(limitSize) { } else { if (start < 0) { - contentLeft = Math.min(-start, - (end - start - contentWidth - 2 * this.options.padding)); - // TODO: remove the need for options.padding. it's terrible. + contentLeft = -start; } else { contentLeft = 0;