From 785096c51ad9e7115cce0673a9568664d69428d1 Mon Sep 17 00:00:00 2001 From: josdejong Date: Thu, 6 Mar 2014 09:16:08 +0100 Subject: [PATCH] Fixed a bug with margin.item=0 and margin.axis=0. Clarified some options in the documentation --- HISTORY.md | 8 +++++++- docs/timeline.html | 13 +++++++++++-- src/timeline/component/ItemSet.js | 4 ++-- src/timeline/component/css/item.css | 3 ++- 4 files changed, 22 insertions(+), 6 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 95e31364..99738795 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,7 +2,7 @@ vis.js history http://visjs.org -## 2014-03-05, version 0.6.1 +## 2014-03-06, version 0.6.1 ### Graph @@ -11,6 +11,12 @@ http://visjs.org - Tweaked graphviz example physics. - Updated physics documentation to stress importance of configurePhysics. +### Timeline + +- Fixed a bug with options `margin.axis` and `margin.item` being ignored when setting them to zero. +- Some clarifications in the documentation. + + ## 2014-03-05, version 0.6.0 ### Graph diff --git a/docs/timeline.html b/docs/timeline.html index e8429efc..292542c8 100644 --- a/docs/timeline.html +++ b/docs/timeline.html @@ -310,7 +310,10 @@ var groups = [
 var options = {
   width: '100%',
-  height: '30px'
+  height: '30px',
+  margin: {
+    item: 20
+  }
 };
 
@@ -476,7 +479,13 @@ var options = { Number 5 The padding of items, needed to correctly calculate the size - of item ranges. Must correspond with the css of item ranges. + of item ranges. Must correspond with the css of items, for example when setting options.padding=10, corresponding css is: +
+.vis.timeline .item {
+  padding: 10px;
+}
+  
+ diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index 0e3a1720..44838c59 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -446,8 +446,8 @@ ItemSet.prototype.getAxis = function getAxis() { ItemSet.prototype.reflow = function reflow () { var changed = 0, options = this.options, - marginAxis = options.margin && options.margin.axis || this.defaultOptions.margin.axis, - marginItem = options.margin && options.margin.item || this.defaultOptions.margin.item, + marginAxis = (options.margin && 'axis' in options.margin) ? options.margin.axis : this.defaultOptions.margin.axis, + marginItem = (options.margin && 'item' in options.margin) ? options.margin.item : this.defaultOptions.margin.item, update = util.updateProperty, asNumber = util.option.asNumber, asSize = util.option.asSize, diff --git a/src/timeline/component/css/item.css b/src/timeline/component/css/item.css index 1242f9d1..2c5aac26 100644 --- a/src/timeline/component/css/item.css +++ b/src/timeline/component/css/item.css @@ -47,7 +47,8 @@ background: none; } -.vis.timeline .dot { +.vis.timeline .dot, +.vis.timeline .item.dot { padding: 0; border: 5px solid #97B0F8; position: absolute;