Browse Source

Changed `onMoving` to be a callback by default (simpler code, little performance hit) See also #294

v3_develop
jos 10 years ago
parent
commit
8fbb851c46
7 changed files with 24833 additions and 24630 deletions
  1. +1
    -0
      HISTORY.md
  2. +24801
    -24602
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +1
    -1
      dist/vis.min.css
  5. +11
    -11
      dist/vis.min.js
  6. +8
    -0
      docs/timeline.html
  7. +10
    -15
      lib/timeline/component/ItemSet.js

+ 1
- 0
HISTORY.md View File

@ -36,6 +36,7 @@ http://visjs.org
account).
- Renamed internal items from `ItemBox`, `ItemRange`, and `ItemPoint` to
respectively `BoxItem`, `RangeItem`, and `PointItem`.
- Fixed an error thrown when calling `destroy()`.
## 2014-08-29, version 3.3.0

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


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


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


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


+ 8
- 0
docs/timeline.html View File

@ -563,6 +563,14 @@ var options = {
</td>
</tr>
<tr>
<td>onMoving</td>
<td>Function</td>
<td>none</td>
<td>Callback function triggered repeatedly when an item is being moved. See section <a href="#Editing_Items">Editing Items</a> for more information. Only applicable when both options <code>selectable</code> and <code>editable.updateTime</code> or <code>editable.updateGroup</code> are set <code>true</code>.
</td>
</tr>
<tr>
<td>onRemove</td>
<td>Function</td>

+ 10
- 15
lib/timeline/component/ItemSet.js View File

@ -51,7 +51,9 @@ function ItemSet(body, options) {
onRemove: function (item, callback) {
callback(item);
},
onMoving: null, // onMoving is null by default for better performance (other on* functions do not support null)
onMoving: function (item, callback) {
callback(item);
},
margin: {
item: {
@ -1127,22 +1129,15 @@ ItemSet.prototype._onDrag = function (event) {
newProps.group = group && group.groupId;
}
if (me.options.onMoving) {
var itemData = util.extend({}, props.item.data, newProps);
me.options.onMoving(itemData, function (itemData) {
if (itemData) {
me._updateItemProps(props.item, itemData);
}
});
}
else {
me._updateItemProps(props.item, newProps);
}
// confirm moving the item
var itemData = util.extend({}, props.item.data, newProps);
me.options.onMoving(itemData, function (itemData) {
if (itemData) {
me._updateItemProps(props.item, itemData);
}
});
});
// TODO: implement onMoving handler
this.stackDirty = true; // force re-stacking of all items next redraw
this.body.emitter.emit('change');

Loading…
Cancel
Save