From 5fd3efceb2e4573361132a6c1202dd9813af7541 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 9 Dec 2015 16:55:36 +0100 Subject: [PATCH 1/3] Fixed #1491: Problem using ctrl+drag in combination with using a `DataView`, and an issue with ctrl+drag when using `snap: null` --- HISTORY.md | 4 +++- lib/DataSet.js | 2 +- lib/timeline/component/ItemSet.js | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 79bbf04a..538c7188 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -12,7 +12,9 @@ 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. diff --git a/lib/DataSet.js b/lib/DataSet.js index f4ca42ec..f42ca848 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; } } 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 = { From c4636affc80b7e8430c862987935792c66c34cf6 Mon Sep 17 00:00:00 2001 From: jos Date: Wed, 9 Dec 2015 17:05:48 +0100 Subject: [PATCH 2/3] Fixed #1487: DataSet cannot remove an item with id `0` correctly --- HISTORY.md | 3 +++ lib/DataSet.js | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 538c7188..e5f83ef8 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -21,6 +21,9 @@ http://visjs.org 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 f42ca848..75cb316d 100644 --- a/lib/DataSet.js +++ b/lib/DataSet.js @@ -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; From 02a7889deb1748c370e830bc772a563394ff2887 Mon Sep 17 00:00:00 2001 From: Tom Joseph Date: Thu, 10 Dec 2015 05:39:39 -0500 Subject: [PATCH 3/3] Use SVGElement.getBoundingClientRect() instead of .offstHeight Fixes DOM API deprecation warning in Chrome. Please see: https://www.chromestatus.com/features/5724912467574784 This is an improved version of PR #1501. --- lib/timeline/component/DataAxis.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;