diff --git a/docs/timeline/index.html b/docs/timeline/index.html
index 374b9f97..da2084f9 100644
--- a/docs/timeline/index.html
+++ b/docs/timeline/index.html
@@ -1584,6 +1584,33 @@ timeline.off('select', onSelect);
+
+ | mouseDown |
+
+ Passes a properties object as returned by the method Timeline.getEventProperties(event).
+ |
+ Fired when the mouse down event is triggered over a timeline element.
+ |
+
+
+
+ | mouseUp |
+
+ Passes a properties object as returned by the method Timeline.getEventProperties(event).
+ |
+ Fired when the mouse up event is triggered over a timeline element.
+ |
+
+
+
+ | mouseMove |
+
+ Passes a properties object as returned by the method Timeline.getEventProperties(event).
+ |
+ Fired when the mouse is moved over a timeline element.
+ |
+
+
| groupDragged |
diff --git a/examples/timeline/interaction/eventListeners.html b/examples/timeline/interaction/eventListeners.html
index 91bacfb0..ae16dc67 100644
--- a/examples/timeline/interaction/eventListeners.html
+++ b/examples/timeline/interaction/eventListeners.html
@@ -72,6 +72,14 @@
logEvent('contextmenu', properties);
});
+ timeline.on('mouseDown', function (properties) {
+ logEvent('mouseDown', properties);
+ });
+
+ timeline.on('mouseUp', function (properties) {
+ logEvent('mouseUp', properties);
+ });
+
// other possible events:
// timeline.on('mouseOver', function (properties) {
diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js
index 02d633a4..8b870578 100644
--- a/lib/timeline/Timeline.js
+++ b/lib/timeline/Timeline.js
@@ -139,9 +139,27 @@ function Timeline (container, items, groups, options) {
this.dom.root.onmouseover = function (event) {
me.emit('mouseOver', me.getEventProperties(event))
};
- this.dom.root.onmousemove = function (event) {
- me.emit('mouseMove', me.getEventProperties(event))
- };
+ if(window.PointerEvent) {
+ this.dom.root.onpointerdown = function (event) {
+ me.emit('mouseDown', me.getEventProperties(event))
+ };
+ this.dom.root.onpointermove = function (event) {
+ me.emit('mouseMove', me.getEventProperties(event))
+ };
+ this.dom.root.onpointerup = function (event) {
+ me.emit('mouseUp', me.getEventProperties(event))
+ };
+ } else {
+ this.dom.root.onmousemove = function (event) {
+ me.emit('mouseMove', me.getEventProperties(event))
+ };
+ this.dom.root.onmousedown = function (event) {
+ me.emit('mouseDown', me.getEventProperties(event))
+ };
+ this.dom.root.onmouseup = function (event) {
+ me.emit('mouseUp', me.getEventProperties(event))
+ };
+ }
//Single time autoscale/fit
this.fitDone = false;
diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js
index 002f294a..09f16f39 100644
--- a/lib/timeline/component/ItemSet.js
+++ b/lib/timeline/component/ItemSet.js
@@ -2220,7 +2220,7 @@ ItemSet.prototype.groupFromTarget = function(event) {
var clientY = event.center ? event.center.y : event.clientY;
var groupIds = this.groupIds;
- if (groupIds.length <= 0) {
+ if (groupIds.length <= 0 && this.groupsData) {
groupIds = this.groupsData.getIds({
order: this.options.groupOrder
});
|