From 839f22447f263687334e1abd3ad5468f6bac6d70 Mon Sep 17 00:00:00 2001
From: y_ryu <maguchi579@gmail.com>
Date: Mon, 18 May 2020 03:30:20 +0900
Subject: [PATCH 1/4] fix: fix an access to an undefined object's property
 (#472)

---
 lib/timeline/Core.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js
index 49cbde5532..bd999f7a4b 100644
--- a/lib/timeline/Core.js
+++ b/lib/timeline/Core.js
@@ -670,7 +670,7 @@ class Core {
     const customTime = new CustomTime(this.body, util.extend({}, this.options, {
       time : timestamp,
       id,
-      snap: this.itemSet.options.snap
+      snap: this.options.snap
     }));
 
     this.customTimes.push(customTime);

From a26814671c772cf117e4fd72b75144d559e61516 Mon Sep 17 00:00:00 2001
From: y_ryu <maguchi579@gmail.com>
Date: Wed, 27 May 2020 13:28:54 +0900
Subject: [PATCH 2/4] fix: fix a bug that occures when dragging any marker

---
 lib/timeline/Graph2d.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/timeline/Graph2d.js b/lib/timeline/Graph2d.js
index 7e69f4c192..9663040eb0 100644
--- a/lib/timeline/Graph2d.js
+++ b/lib/timeline/Graph2d.js
@@ -76,6 +76,13 @@ function Graph2d (container, items, groups, options) {
     },
     hiddenDates: [],
     util: {
+      getScale() {
+        return me.timeAxis.step.scale;
+      },
+      getStep() {
+        return me.timeAxis.step.step;
+      },
+
       toScreen: me._toScreen.bind(me),
       toGlobalScreen: me._toGlobalScreen.bind(me), // this refers to the root.width
       toTime: me._toTime.bind(me),

From a57d0a65b5b9e13a8fbad48170dc9946e2159010 Mon Sep 17 00:00:00 2001
From: y_ryu <maguchi579@gmail.com>
Date: Wed, 27 May 2020 18:43:06 +0900
Subject: [PATCH 3/4] feat: accept the snap option in Graph2d

---
 lib/timeline/Core.js           | 2 +-
 lib/timeline/optionsGraph2d.js | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js
index bd999f7a4b..f59cd28587 100644
--- a/lib/timeline/Core.js
+++ b/lib/timeline/Core.js
@@ -411,7 +411,7 @@ class Core {
         'width', 'height', 'minHeight', 'maxHeight', 'autoResize',
         'start', 'end', 'clickToUse', 'dataAttributes', 'hiddenDates',
         'locale', 'locales', 'moment', 'preferZoom', 'rtl', 'zoomKey',
-        'horizontalScroll', 'verticalScroll', 'longSelectPressTime'
+        'horizontalScroll', 'verticalScroll', 'longSelectPressTime', 'snap'
       ];
       util.selectiveExtend(fields, this.options, options);
       this.dom.rollingModeBtn.style.visibility = 'hidden';
diff --git a/lib/timeline/optionsGraph2d.js b/lib/timeline/optionsGraph2d.js
index 7ffab7e1ca..cde26916fc 100644
--- a/lib/timeline/optionsGraph2d.js
+++ b/lib/timeline/optionsGraph2d.js
@@ -159,6 +159,7 @@ let allOptions = {
   showMajorLabels: {'boolean': bool},
   showMinorLabels: {'boolean': bool},
   showWeekScale: {'boolean': bool},
+  snap: {'function': 'function', 'null': 'null'},
   start: {date, number, string, moment},
   timeAxis: {
     scale: {string,'undefined': 'undefined'},

From fc04e933ede82db6b2c793e048b0f4bd9fb7efb5 Mon Sep 17 00:00:00 2001
From: y_ryu <maguchi579@gmail.com>
Date: Mon, 22 Jun 2020 07:37:07 +0900
Subject: [PATCH 4/4] fix: use options.snap only when itemSet is undefined

---
 lib/timeline/Core.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/timeline/Core.js b/lib/timeline/Core.js
index f59cd28587..422e01a549 100644
--- a/lib/timeline/Core.js
+++ b/lib/timeline/Core.js
@@ -668,9 +668,9 @@ class Core {
     }
 
     const customTime = new CustomTime(this.body, util.extend({}, this.options, {
-      time : timestamp,
+      time: timestamp,
       id,
-      snap: this.options.snap
+      snap: this.itemSet ? this.itemSet.options.snap : this.options.snap
     }));
 
     this.customTimes.push(customTime);