Browse Source

Changed the 'auto' alignment of range item contents such that it always displays the left side of the conents (see #785)

flowchartTest
jos 9 years ago
parent
commit
d4ba655050
2 changed files with 5 additions and 6 deletions
  1. +3
    -3
      lib/timeline/component/css/item.css
  2. +2
    -3
      lib/timeline/component/item/RangeItem.js

+ 3
- 3
lib/timeline/component/css/item.css View File

@ -87,15 +87,15 @@
.vis-item .vis-item-content { .vis-item .vis-item-content {
white-space: nowrap; white-space: nowrap;
box-sizing: border-box; box-sizing: border-box;
margin: 5px;
padding: 5px;
} }
.vis-item .vis-delete { .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; position: absolute;
width: 24px; width: 24px;
height: 24px; height: 24px;
top: 0;
top: -4px;
right: -24px; right: -24px;
cursor: pointer; cursor: pointer;
} }

+ 2
- 3
lib/timeline/component/item/RangeItem.js View File

@ -189,6 +189,7 @@ RangeItem.prototype.repositionX = function(limitSize) {
this.left = start; this.left = start;
this.width = boxWidth; this.width = boxWidth;
contentWidth = Math.min(end - start - 2 * this.options.padding, this.props.content.width); 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'; this.dom.box.style.left = this.left + 'px';
@ -219,9 +220,7 @@ RangeItem.prototype.repositionX = function(limitSize) {
} }
else { else {
if (start < 0) { 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 { else {
contentLeft = 0; contentLeft = 0;

Loading…
Cancel
Save