diff --git a/HISTORY.md b/HISTORY.md index 79bbf04a..e5f83ef8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,13 +12,18 @@ http://visjs.org - Fixed #1441: Height of subgroups not immediately updated after updating data in a DataSet or DataView. - +- Fixed #1491: Problem using ctrl+drag in combination with using a `DataView`, + and an issue with ctrl+drag when using `snap: null`. + ### Graph2d - Implemented a new option for `shaded.orientation` to always shade towards zero. Thanks @ludost. - Fixed support for using a `DataView` in Graph2d. Thanks @ludost. +### DataSet +- Fixed #1487: DataSet cannot remove an item with id `0` correctly. + ## 2015-11-27, version 4.10.0 diff --git a/lib/DataSet.js b/lib/DataSet.js index f4ca42ec..75cb316d 100644 --- a/lib/DataSet.js +++ b/lib/DataSet.js @@ -357,7 +357,7 @@ DataSet.prototype.get = function (args) { if (id != undefined) { // return a single item item = me._getItem(id, type); - if (filter && !filter(item)) { + if (item && filter && !filter(item)) { item = null; } } @@ -704,7 +704,7 @@ DataSet.prototype._remove = function (id) { } else if (id instanceof Object) { var itemId = id[this._fieldId]; - if (itemId && this._data[itemId]) { + if (itemId !== undefined && this._data[itemId]) { delete this._data[itemId]; this.length--; return itemId; diff --git a/lib/timeline/component/DataAxis.js b/lib/timeline/component/DataAxis.js index 02593649..4a1291a3 100644 --- a/lib/timeline/component/DataAxis.js +++ b/lib/timeline/component/DataAxis.js @@ -59,7 +59,7 @@ function DataAxis (body, options, svg, linegraphOptions) { this.setOptions(options); this.width = Number(('' + this.options.width).replace("px","")); this.minWidth = this.width; - this.height = this.linegraphSVG.offsetHeight; + this.height = this.linegraphSVG.getBoundingClientRect().height; this.hidden = false; this.stepPixels = 25; diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 4ec39bfb..edff2897 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1248,7 +1248,7 @@ ItemSet.prototype._onDragStartAddItem = function (event) { var time = this.body.util.toTime(x); var scale = this.body.util.getScale(); var step = this.body.util.getStep(); - var start = snap ? snap(time, scale, step) : start; + var start = snap ? snap(time, scale, step) : time; var end = start; var itemData = {