Browse Source

Merge remote-tracking branch 'origin/develop' into develop

Conflicts:
	HISTORY.md
flowchartTest
jos 9 years ago
parent
commit
4ddf0fe557
10 changed files with 6498 additions and 6474 deletions
  1. +3
    -2
      HISTORY.md
  2. +1
    -1
      bower.json
  3. +6450
    -6441
      dist/vis.js
  4. +1
    -1
      dist/vis.map
  5. +1
    -1
      dist/vis.min.css
  6. +19
    -19
      dist/vis.min.js
  7. +13
    -5
      lib/network/modules/InteractionHandler.js
  8. +8
    -2
      lib/network/modules/SelectionHandler.js
  9. +1
    -1
      package.json
  10. +1
    -1
      test/network_unittests.html

+ 3
- 2
HISTORY.md View File

@ -1,7 +1,8 @@
# vis.js history # vis.js history
http://visjs.org http://visjs.org
## not-yet released, version 4.2.1-SNAPSHOT
## NOT YET RELEASED, verions 4.2.1--SNAPSHOT
### Graph2d ### Graph2d
@ -40,7 +41,7 @@ http://visjs.org
- Added releaseFunction to openCluster. - Added releaseFunction to openCluster.
- Fixed bug where the network could flicker when the pixelRatio is not integer. - Fixed bug where the network could flicker when the pixelRatio is not integer.
- Added enabled property to physics. - Added enabled property to physics.
- Fixed #927, dragStart event didnt contain node that was being dragged
## 2015-05-28, version 4.1.0 ## 2015-05-28, version 4.1.0

+ 1
- 1
bower.json View File

@ -1,6 +1,6 @@
{ {
"name": "vis", "name": "vis",
"version": "4.1.1-SNAPSHOT",
"version": "4.2.1--SNAPSHOT",
"main": ["dist/vis.min.js", "dist/vis.min.css"], "main": ["dist/vis.min.js", "dist/vis.min.css"],
"description": "A dynamic, browser-based visualization library.", "description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/", "homepage": "http://visjs.org/",

+ 6450
- 6441
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


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


+ 13
- 5
lib/network/modules/InteractionHandler.js View File

@ -282,8 +282,6 @@ class InteractionHandler {
this.drag.translation = util.extend({},this.body.view.translation); // copy the object this.drag.translation = util.extend({},this.body.view.translation); // copy the object
this.drag.nodeId = undefined; this.drag.nodeId = undefined;
this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer);
if (node !== undefined && this.options.dragNodes === true) { if (node !== undefined && this.options.dragNodes === true) {
this.drag.nodeId = node.id; this.drag.nodeId = node.id;
// select the clicked node if not yet selected // select the clicked node if not yet selected
@ -292,6 +290,9 @@ class InteractionHandler {
this.selectionHandler.selectObject(node); this.selectionHandler.selectObject(node);
} }
// after select to contain the node
this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer);
let selection = this.selectionHandler.selectionObj.nodes; let selection = this.selectionHandler.selectionObj.nodes;
// create an array with the selected nodes and their original location and status // create an array with the selected nodes and their original location and status
for (let nodeId in selection) { for (let nodeId in selection) {
@ -315,6 +316,10 @@ class InteractionHandler {
} }
} }
} }
else {
// fallback if no node is selected and thus the view is dragged.
this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true);
}
} }
@ -332,10 +337,10 @@ class InteractionHandler {
let pointer = this.getPointer(event.center); let pointer = this.getPointer(event.center);
this.selectionHandler._generateClickEvent('dragging', event, pointer);
let selection = this.drag.selection; let selection = this.drag.selection;
if (selection && selection.length && this.options.dragNodes === true) { if (selection && selection.length && this.options.dragNodes === true) {
this.selectionHandler._generateClickEvent('dragging', event, pointer);
// calculate delta's and new location // calculate delta's and new location
let deltaX = pointer.x - this.drag.pointer.x; let deltaX = pointer.x - this.drag.pointer.x;
let deltaY = pointer.y - this.drag.pointer.y; let deltaY = pointer.y - this.drag.pointer.y;
@ -359,6 +364,8 @@ class InteractionHandler {
else { else {
// move the network // move the network
if (this.options.dragView === true) { if (this.options.dragView === true) {
this.selectionHandler._generateClickEvent('dragging', event, pointer, undefined, true);
// if the drag was not started properly because the click started outside the network div, start it now. // if the drag was not started properly because the click started outside the network div, start it now.
if (this.drag.pointer === undefined) { if (this.drag.pointer === undefined) {
this._handleDragStart(event); this._handleDragStart(event);
@ -382,6 +389,7 @@ class InteractionHandler {
this.drag.dragging = false; this.drag.dragging = false;
let selection = this.drag.selection; let selection = this.drag.selection;
if (selection && selection.length) { if (selection && selection.length) {
this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center));
selection.forEach(function (s) { selection.forEach(function (s) {
// restore original xFixed and yFixed // restore original xFixed and yFixed
s.node.options.fixed.x = s.xFixed; s.node.options.fixed.x = s.xFixed;
@ -390,9 +398,9 @@ class InteractionHandler {
this.body.emitter.emit('startSimulation'); this.body.emitter.emit('startSimulation');
} }
else { else {
this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center), undefined, true);
this.body.emitter.emit('_requestRedraw'); this.body.emitter.emit('_requestRedraw');
} }
this.selectionHandler._generateClickEvent('dragEnd', event, this.getPointer(event.center));
} }

+ 8
- 2
lib/network/modules/SelectionHandler.js View File

@ -74,8 +74,14 @@ class SelectionHandler {
return selectionChanged; return selectionChanged;
} }
_generateClickEvent(eventType, event, pointer, oldSelection) {
let properties = this.getSelection();
_generateClickEvent(eventType, event, pointer, oldSelection, emptySelection = false) {
let properties;
if (emptySelection === true) {
properties = {nodes:[], edges:[]};
}
else {
properties = this.getSelection();
}
properties['pointer'] = { properties['pointer'] = {
DOM: {x: pointer.x, y: pointer.y}, DOM: {x: pointer.x, y: pointer.y},
canvas: this.canvas.DOMtoCanvas(pointer) canvas: this.canvas.DOMtoCanvas(pointer)

+ 1
- 1
package.json View File

@ -1,6 +1,6 @@
{ {
"name": "vis", "name": "vis",
"version": "4.1.1-SNAPSHOT",
"version": "4.2.0--SNAPSHOT",
"description": "A dynamic, browser-based visualization library.", "description": "A dynamic, browser-based visualization library.",
"homepage": "http://visjs.org/", "homepage": "http://visjs.org/",
"license": "(Apache-2.0 OR MIT)", "license": "(Apache-2.0 OR MIT)",

+ 1
- 1
test/network_unittests.html View File

@ -175,7 +175,7 @@
var amountOfOptionChecks = 1;
var amountOfOptionChecks = 200;
var optionCheckTime = 150; var optionCheckTime = 150;
var optionsThreshold = 0.8; var optionsThreshold = 0.8;
function checkOptions(i) { function checkOptions(i) {

Loading…
Cancel
Save