Browse Source

Fixed offset issue with dragging items vertically when the page is scrolled (this regression was introduced a few commits back)

v3_develop
jos 9 years ago
parent
commit
fbfe6ad445
5 changed files with 44 additions and 44 deletions
  1. +28
    -28
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +5
    -5
      dist/vis.min.js
  4. +9
    -9
      lib/timeline/component/ItemSet.js
  5. +1
    -1
      test/timeline_groups.html

+ 28
- 28
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 3.11.1-SNAPSHOT * @version 3.11.1-SNAPSHOT
* @date 2015-03-31
* @date 2015-04-07
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -13637,7 +13637,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (dragLeftItem) { if (dragLeftItem) {
props = { props = {
item: dragLeftItem, item: dragLeftItem,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
dragLeft: true, dragLeft: true,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -13647,7 +13647,7 @@ return /******/ (function(modules) { // webpackBootstrap
else if (dragRightItem) { else if (dragRightItem) {
props = { props = {
item: dragRightItem, item: dragRightItem,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
dragRight: true, dragRight: true,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -13659,7 +13659,7 @@ return /******/ (function(modules) { // webpackBootstrap
var item = me.items[id]; var item = me.items[id];
var props = { var props = {
item: item, item: item,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -13713,7 +13713,7 @@ return /******/ (function(modules) { // webpackBootstrap
var props = { var props = {
item: newItem, item: newItem,
dragRight: true, dragRight: true,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
data: util.extend({}, itemData) data: util.extend({}, itemData)
}; };
this.touchParams.itemProps = [props]; this.touchParams.itemProps = [props];
@ -13740,7 +13740,7 @@ return /******/ (function(modules) { // webpackBootstrap
// move // move
this.touchParams.itemProps.forEach(function (props) { this.touchParams.itemProps.forEach(function (props) {
var current = me.body.util.toTime(event.gesture.center.clientX - xOffset);
var current = me.body.util.toTime(event.gesture.center.pageX - xOffset);
var initial = me.body.util.toTime(props.initialX - xOffset); var initial = me.body.util.toTime(props.initialX - xOffset);
var offset = current - initial; var offset = current - initial;
@ -14097,23 +14097,23 @@ return /******/ (function(modules) { // webpackBootstrap
* @return {Group | null} group * @return {Group | null} group
*/ */
ItemSet.prototype.groupFromTarget = function(event) { ItemSet.prototype.groupFromTarget = function(event) {
var clientY = event.gesture ? event.gesture.center.clientY : event.clientY;
var pageY = event.gesture ? event.gesture.center.pageY : event.pageY;
for (var i = 0; i < this.groupIds.length; i++) { for (var i = 0; i < this.groupIds.length; i++) {
var groupId = this.groupIds[i]; var groupId = this.groupIds[i];
var group = this.groups[groupId]; var group = this.groups[groupId];
var foreground = group.dom.foreground; var foreground = group.dom.foreground;
var top = util.getAbsoluteTop(foreground); var top = util.getAbsoluteTop(foreground);
if (clientY > top && clientY < top + foreground.offsetHeight) {
if (pageY > top && pageY < top + foreground.offsetHeight) {
return group; return group;
} }
if (this.options.orientation === 'top') { if (this.options.orientation === 'top') {
if (i === this.groupIds.length - 1 && clientY > top) {
if (i === this.groupIds.length - 1 && pageY > top) {
return group; return group;
} }
} }
else { else {
if (i === 0 && clientY < top + foreground.offset) {
if (i === 0 && pageY < top + foreground.offset) {
return group; return group;
} }
} }
@ -30518,9 +30518,9 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var util = __webpack_require__(1); var util = __webpack_require__(1);
var RepulsionMixin = __webpack_require__(68);
var HierarchialRepulsionMixin = __webpack_require__(69);
var BarnesHutMixin = __webpack_require__(70);
var RepulsionMixin = __webpack_require__(67);
var HierarchialRepulsionMixin = __webpack_require__(68);
var BarnesHutMixin = __webpack_require__(69);
/** /**
* Toggling barnes Hut calculation on and off. * Toggling barnes Hut calculation on and off.
@ -34960,19 +34960,6 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 67 */ /* 67 */
/***/ function(module, exports, __webpack_require__) {
function webpackContext(req) {
throw new Error("Cannot find module '" + req + "'.");
}
webpackContext.keys = function() { return []; };
webpackContext.resolve = webpackContext;
module.exports = webpackContext;
webpackContext.id = 67;
/***/ },
/* 68 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -35042,7 +35029,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ }, /***/ },
/* 69 */
/* 68 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -35201,7 +35188,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
/***/ }, /***/ },
/* 70 */
/* 69 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/** /**
@ -35605,6 +35592,19 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
/***/ },
/* 70 */
/***/ function(module, exports, __webpack_require__) {
function webpackContext(req) {
throw new Error("Cannot find module '" + req + "'.");
}
webpackContext.keys = function() { return []; };
webpackContext.resolve = webpackContext;
module.exports = webpackContext;
webpackContext.id = 70;
/***/ }, /***/ },
/* 71 */ /* 71 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {

+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 5
- 5
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 9
- 9
lib/timeline/component/ItemSet.js View File

@ -1115,7 +1115,7 @@ ItemSet.prototype._onDragStart = function (event) {
if (dragLeftItem) { if (dragLeftItem) {
props = { props = {
item: dragLeftItem, item: dragLeftItem,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
dragLeft: true, dragLeft: true,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -1125,7 +1125,7 @@ ItemSet.prototype._onDragStart = function (event) {
else if (dragRightItem) { else if (dragRightItem) {
props = { props = {
item: dragRightItem, item: dragRightItem,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
dragRight: true, dragRight: true,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -1137,7 +1137,7 @@ ItemSet.prototype._onDragStart = function (event) {
var item = me.items[id]; var item = me.items[id];
var props = { var props = {
item: item, item: item,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
data: util.extend({}, item.data) // clone the items data data: util.extend({}, item.data) // clone the items data
}; };
@ -1191,7 +1191,7 @@ ItemSet.prototype._onDragStartAddItem = function (event) {
var props = { var props = {
item: newItem, item: newItem,
dragRight: true, dragRight: true,
initialX: event.gesture.center.clientX,
initialX: event.gesture.center.pageX,
data: util.extend({}, itemData) data: util.extend({}, itemData)
}; };
this.touchParams.itemProps = [props]; this.touchParams.itemProps = [props];
@ -1218,7 +1218,7 @@ ItemSet.prototype._onDrag = function (event) {
// move // move
this.touchParams.itemProps.forEach(function (props) { this.touchParams.itemProps.forEach(function (props) {
var current = me.body.util.toTime(event.gesture.center.clientX - xOffset);
var current = me.body.util.toTime(event.gesture.center.pageX - xOffset);
var initial = me.body.util.toTime(props.initialX - xOffset); var initial = me.body.util.toTime(props.initialX - xOffset);
var offset = current - initial; var offset = current - initial;
@ -1575,23 +1575,23 @@ ItemSet.prototype.itemFromTarget = function(event) {
* @return {Group | null} group * @return {Group | null} group
*/ */
ItemSet.prototype.groupFromTarget = function(event) { ItemSet.prototype.groupFromTarget = function(event) {
var clientY = event.gesture ? event.gesture.center.clientY : event.clientY;
var pageY = event.gesture ? event.gesture.center.pageY : event.pageY;
for (var i = 0; i < this.groupIds.length; i++) { for (var i = 0; i < this.groupIds.length; i++) {
var groupId = this.groupIds[i]; var groupId = this.groupIds[i];
var group = this.groups[groupId]; var group = this.groups[groupId];
var foreground = group.dom.foreground; var foreground = group.dom.foreground;
var top = util.getAbsoluteTop(foreground); var top = util.getAbsoluteTop(foreground);
if (clientY > top && clientY < top + foreground.offsetHeight) {
if (pageY > top && pageY < top + foreground.offsetHeight) {
return group; return group;
} }
if (this.options.orientation === 'top') { if (this.options.orientation === 'top') {
if (i === this.groupIds.length - 1 && clientY > top) {
if (i === this.groupIds.length - 1 && pageY > top) {
return group; return group;
} }
} }
else { else {
if (i === 0 && clientY < top + foreground.offset) {
if (i === 0 && pageY < top + foreground.offset) {
return group; return group;
} }
} }

+ 1
- 1
test/timeline_groups.html View File

@ -58,7 +58,7 @@
var now = moment().minutes(0).seconds(0).milliseconds(0); var now = moment().minutes(0).seconds(0).milliseconds(0);
var groupCount = 3; var groupCount = 3;
var itemCount = 7;
var itemCount = 20;
// create a data set with groups // create a data set with groups
var names = ['John (0)', 'Alston (1)', 'Lee (2)', 'Grant (3)']; var names = ['John (0)', 'Alston (1)', 'Lee (2)', 'Grant (3)'];

Loading…
Cancel
Save