diff --git a/HISTORY.md b/HISTORY.md index 8a71f54c..86a7249c 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -23,6 +23,7 @@ http://visjs.org - Fixed not property initializing with a DataView for groups. - Merged add custom timebar functionality, thanks @aytech! +- Fixed #664: end of item not restored when canceling a move event. ## 2015-02-11, version 3.10.0 diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index dd6eb87a..571e87ea 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1229,8 +1229,15 @@ ItemSet.prototype._onDrag = function (event) { */ ItemSet.prototype._updateItemProps = function(item, props) { // TODO: copy all properties from props to item? (also new ones) - if ('start' in props) item.data.start = props.start; - if ('end' in props) item.data.end = props.end; + if ('start' in props) { + item.data.start = props.start; + } + if ('end' in props) { + item.data.end = props.end; + } + else if ('duration' in props) { + item.data.end = new Date(props.start.valueOf() + props.duration); + } if ('group' in props && item.data.group != props.group) { this._moveToGroup(item, props.group) }