Browse Source

Released version 3.7.2

gh-pages
jos 10 years ago
parent
commit
7768ec162b
8 changed files with 179 additions and 146 deletions
  1. +149
    -116
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +16
    -16
      dist/vis.min.js
  4. +10
    -10
      docs/network.html
  5. +1
    -1
      docs/timeline.html
  6. BIN
      download/vis.zip
  7. +1
    -1
      examples/graph2d/05_bothAxis.html
  8. +1
    -1
      index.html

+ 149
- 116
dist/vis.js View File

@ -4,8 +4,8 @@
* *
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 3.7.1
* @date 2014-11-28
* @version 3.7.2
* @date 2014-12-09
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -23,6 +23,8 @@
* Vis.js may be distributed under either license. * Vis.js may be distributed under either license.
*/ */
"use strict";
(function webpackUniversalModuleDefinition(root, factory) { (function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object') if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(); module.exports = factory();
@ -1259,33 +1261,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
else { else {
mergeTarget[option].enabled = true; mergeTarget[option].enabled = true;
for (prop in options[option]) {
if (options[option].hasOwnProperty(prop)) {
mergeTarget[option][prop] = options[option][prop];
}
}
}
}
}
/**
* this is used to set the options of subobjects in the options object. A requirement of these subobjects
* is that they have an 'enabled' element which is optional for the user but mandatory for the program.
*
* @param [object] mergeTarget | this is either this.options or the options used for the groups.
* @param [object] options | options
* @param [String] option | this is the option key in the options argument
* @private
*/
exports.mergeOptions = function (mergeTarget, options, option) {
if (options[option] !== undefined) {
if (typeof options[option] == 'boolean') {
mergeTarget[option].enabled = options[option];
}
else {
mergeTarget[option].enabled = true;
for (prop in options[option]) {
for (var prop in options[option]) {
if (options[option].hasOwnProperty(prop)) { if (options[option].hasOwnProperty(prop)) {
mergeTarget[option][prop] = options[option][prop]; mergeTarget[option][prop] = options[option][prop];
} }
@ -1295,8 +1271,6 @@ return /******/ (function(modules) { // webpackBootstrap
} }
/** /**
* This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses * This function does a binary search for a visible item in a sorted list. If we find a visible item, the code that uses
* this function will then iterate in both directions over this sorted list to find all visible items. * this function will then iterate in both directions over this sorted list to find all visible items.
@ -3687,9 +3661,9 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
function sortNumber(a, b) {
var sortNumber = function (a, b) {
return a - b; return a - b;
}
};
dataX.sort(sortNumber); dataX.sort(sortNumber);
dataY.sort(sortNumber); dataY.sort(sortNumber);
@ -5422,20 +5396,20 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Event} event * @param {Event} event
* @return {Number} mouse x * @return {Number} mouse x
*/ */
getMouseX = function(event) {
function getMouseX (event) {
if ('clientX' in event) return event.clientX; if ('clientX' in event) return event.clientX;
return event.targetTouches[0] && event.targetTouches[0].clientX || 0; return event.targetTouches[0] && event.targetTouches[0].clientX || 0;
};
}
/** /**
* Get the vertical mouse position from a mouse event * Get the vertical mouse position from a mouse event
* @param {Event} event * @param {Event} event
* @return {Number} mouse y * @return {Number} mouse y
*/ */
getMouseY = function(event) {
function getMouseY (event) {
if ('clientY' in event) return event.clientY; if ('clientY' in event) return event.clientY;
return event.targetTouches[0] && event.targetTouches[0].clientY || 0; return event.targetTouches[0] && event.targetTouches[0].clientY || 0;
};
}
module.exports = Graph3d; module.exports = Graph3d;
@ -5456,7 +5430,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Documentation: * Documentation:
* http://en.wikipedia.org/wiki/3D_projection * http://en.wikipedia.org/wiki/3D_projection
*/ */
Camera = function () {
function Camera() {
this.armLocation = new Point3d(); this.armLocation = new Point3d();
this.armRotation = {}; this.armRotation = {};
this.armRotation.horizontal = 0; this.armRotation.horizontal = 0;
@ -5467,7 +5441,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0); this.cameraRotation = new Point3d(0.5*Math.PI, 0, 0);
this.calculateCameraOrientation(); this.calculateCameraOrientation();
};
}
/** /**
* Set the location (origin) of the arm * Set the location (origin) of the arm
@ -5813,10 +5787,10 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Number} [x] * @param {Number} [x]
* @param {Number} [y] * @param {Number} [y]
*/ */
Point2d = function (x, y) {
function Point2d (x, y) {
this.x = x !== undefined ? x : 0; this.x = x !== undefined ? x : 0;
this.y = y !== undefined ? y : 0; this.y = y !== undefined ? y : 0;
};
}
module.exports = Point2d; module.exports = Point2d;
@ -7861,7 +7835,7 @@ return /******/ (function(modules) { // webpackBootstrap
var initTime = new Date().valueOf(); var initTime = new Date().valueOf();
var anyChanged = false; var anyChanged = false;
function next() {
var next = function () {
if (!me.props.touch.dragging) { if (!me.props.touch.dragging) {
var now = new Date().valueOf(); var now = new Date().valueOf();
var time = now - initTime; var time = now - initTime;
@ -8262,19 +8236,19 @@ return /******/ (function(modules) { // webpackBootstrap
} }
var scale = 1 / (event.gesture.scale + this.scaleOffset); var scale = 1 / (event.gesture.scale + this.scaleOffset);
var center = this._pointerToDate(this.props.touch.center);
var centerDate = this._pointerToDate(this.props.touch.center);
var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end); var hiddenDuration = DateUtil.getHiddenDurationBetween(this.body.hiddenDates, this.start, this.end);
var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.body.hiddenDates, this, center);
var hiddenDurationBefore = DateUtil.getHiddenDurationBefore(this.body.hiddenDates, this, centerDate);
var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore; var hiddenDurationAfter = hiddenDuration - hiddenDurationBefore;
// calculate new start and end // calculate new start and end
var newStart = (center-hiddenDurationBefore) + (this.start - (center-hiddenDurationBefore)) * scale;
var newEnd = (center+hiddenDurationAfter) + (this.end - (center+hiddenDurationAfter)) * scale;
var newStart = (centerDate - hiddenDurationBefore) + (this.props.touch.start - (centerDate - hiddenDurationBefore)) * scale;
var newEnd = (centerDate + hiddenDurationAfter) + (this.props.touch.end - (centerDate + hiddenDurationAfter)) * scale;
// snapping times away from hidden zones // snapping times away from hidden zones
this.startToFront = 1 - scale > 0 ? false : true; // used to do the right autocorrection with periodic hidden times this.startToFront = 1 - scale > 0 ? false : true; // used to do the right autocorrection with periodic hidden times
this.endToFront = scale - 1 > 0 ? false : true; // used to do the right autocorrection with periodic hidden times
this.endToFront = scale - 1 > 0 ? false : true; // used to do the right autocorrection with periodic hidden times
var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true); var safeStart = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newStart, 1 - scale, true);
var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true); var safeEnd = DateUtil.snapAwayFromHidden(this.body.hiddenDates, newEnd, scale - 1, true);
@ -9569,6 +9543,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.width = Number(('' + this.options.width).replace("px","")); this.width = Number(('' + this.options.width).replace("px",""));
this.minWidth = this.width; this.minWidth = this.width;
this.height = this.linegraphSVG.offsetHeight; this.height = this.linegraphSVG.offsetHeight;
this.hidden = false;
this.stepPixels = 25; this.stepPixels = 25;
this.stepPixelsForced = 25; this.stepPixelsForced = 25;
@ -9595,7 +9570,6 @@ return /******/ (function(modules) { // webpackBootstrap
DataAxis.prototype = new Component(); DataAxis.prototype = new Component();
DataAxis.prototype.addGroup = function(label, graphOptions) { DataAxis.prototype.addGroup = function(label, graphOptions) {
if (!this.groups.hasOwnProperty(label)) { if (!this.groups.hasOwnProperty(label)) {
this.groups[label] = graphOptions; this.groups[label] = graphOptions;
@ -9714,6 +9688,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Create the HTML DOM for the DataAxis * Create the HTML DOM for the DataAxis
*/ */
DataAxis.prototype.show = function() { DataAxis.prototype.show = function() {
this.hidden = false;
if (!this.dom.frame.parentNode) { if (!this.dom.frame.parentNode) {
if (this.options.orientation == 'left') { if (this.options.orientation == 'left') {
this.body.dom.left.appendChild(this.dom.frame); this.body.dom.left.appendChild(this.dom.frame);
@ -9732,6 +9707,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Create the HTML DOM for the DataAxis * Create the HTML DOM for the DataAxis
*/ */
DataAxis.prototype.hide = function() { DataAxis.prototype.hide = function() {
this.hidden = true;
if (this.dom.frame.parentNode) { if (this.dom.frame.parentNode) {
this.dom.frame.parentNode.removeChild(this.dom.frame); this.dom.frame.parentNode.removeChild(this.dom.frame);
} }
@ -11166,7 +11142,7 @@ return /******/ (function(modules) { // webpackBootstrap
// of the center container is larger than of the ItemSet, so we // of the center container is larger than of the ItemSet, so we
// can click in the empty area to create a new item or deselect an item. // can click in the empty area to create a new item or deselect an item.
this.hammer = Hammer(this.body.dom.centerContainer, { this.hammer = Hammer(this.body.dom.centerContainer, {
prevent_default: true
preventDefault: true
}); });
// drag items when selected // drag items when selected
@ -12135,6 +12111,8 @@ return /******/ (function(modules) { // webpackBootstrap
* @private * @private
*/ */
ItemSet.prototype._onDrag = function (event) { ItemSet.prototype._onDrag = function (event) {
event.preventDefault()
if (this.touchParams.itemProps) { if (this.touchParams.itemProps) {
var me = this; var me = this;
var snap = this.body.util.snap || null; var snap = this.body.util.snap || null;
@ -12219,6 +12197,8 @@ return /******/ (function(modules) { // webpackBootstrap
* @private * @private
*/ */
ItemSet.prototype._onDragEnd = function (event) { ItemSet.prototype._onDragEnd = function (event) {
event.preventDefault()
if (this.touchParams.itemProps) { if (this.touchParams.itemProps) {
// prepare a change set for the changed items // prepare a change set for the changed items
var changes = [], var changes = [],
@ -12866,11 +12846,11 @@ return /******/ (function(modules) { // webpackBootstrap
this.svgElements = {}; this.svgElements = {};
this.setOptions(options); this.setOptions(options);
this.groupsUsingDefaultStyles = [0]; this.groupsUsingDefaultStyles = [0];
this.COUNTER = 0;
this.body.emitter.on('rangechanged', function() { this.body.emitter.on('rangechanged', function() {
me.lastStart = me.body.range.start; me.lastStart = me.body.range.start;
me.svg.style.left = util.option.asSize(-me.width); me.svg.style.left = util.option.asSize(-me.width);
me._updateGraph.apply(me);
me.redraw.call(me,true);
}); });
// create the HTML DOM // create the HTML DOM
@ -12968,8 +12948,10 @@ return /******/ (function(modules) { // webpackBootstrap
this.groups[UNGROUPED].setOptions(options); this.groups[UNGROUPED].setOptions(options);
} }
} }
// this is used to redraw the graph if the visibility of the groups is changed.
if (this.dom.frame) { if (this.dom.frame) {
this._updateGraph();
this.redraw(true);
} }
}; };
@ -13039,8 +13021,8 @@ return /******/ (function(modules) { // webpackBootstrap
this._onAdd(ids); this._onAdd(ids);
} }
this._updateUngrouped(); this._updateUngrouped();
this._updateGraph();
this.redraw();
//this._updateGraph();
this.redraw(true);
}; };
@ -13098,8 +13080,8 @@ return /******/ (function(modules) { // webpackBootstrap
LineGraph.prototype._onUpdate = function(ids) { LineGraph.prototype._onUpdate = function(ids) {
this._updateUngrouped(); this._updateUngrouped();
this._updateAllGroupData(); this._updateAllGroupData();
this._updateGraph();
this.redraw();
//this._updateGraph();
this.redraw(true);
}; };
LineGraph.prototype._onAdd = function (ids) {this._onUpdate(ids);}; LineGraph.prototype._onAdd = function (ids) {this._onUpdate(ids);};
LineGraph.prototype._onRemove = function (ids) {this._onUpdate(ids);}; LineGraph.prototype._onRemove = function (ids) {this._onUpdate(ids);};
@ -13109,8 +13091,8 @@ return /******/ (function(modules) { // webpackBootstrap
this._updateGroup(group, groupIds[i]); this._updateGroup(group, groupIds[i]);
} }
this._updateGraph();
this.redraw();
//this._updateGraph();
this.redraw(true);
}; };
LineGraph.prototype._onAddGroups = function (groupIds) {this._onUpdateGroups(groupIds);}; LineGraph.prototype._onAddGroups = function (groupIds) {this._onUpdateGroups(groupIds);};
@ -13137,8 +13119,8 @@ return /******/ (function(modules) { // webpackBootstrap
} }
} }
this._updateUngrouped(); this._updateUngrouped();
this._updateGraph();
this.redraw();
//this._updateGraph();
this.redraw(true);
}; };
@ -13264,7 +13246,7 @@ return /******/ (function(modules) { // webpackBootstrap
* Redraw the component, mandatory function * Redraw the component, mandatory function
* @return {boolean} Returns true if the component is resized * @return {boolean} Returns true if the component is resized
*/ */
LineGraph.prototype.redraw = function() {
LineGraph.prototype.redraw = function(forceGraphUpdate) {
var resized = false; var resized = false;
this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px'; this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px';
@ -13275,7 +13257,7 @@ return /******/ (function(modules) { // webpackBootstrap
resized = this._isResized() || resized; resized = this._isResized() || resized;
// check whether zoomed (in that case we need to re-stack everything) // check whether zoomed (in that case we need to re-stack everything)
var visibleInterval = this.body.range.end - this.body.range.start; var visibleInterval = this.body.range.end - this.body.range.start;
var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.width != this.lastWidth);
//var zoomed = (visibleInterval != this.lastVisibleInterval) || (this.width != this.lastWidth); // we get this from the range changed event
this.lastVisibleInterval = visibleInterval; this.lastVisibleInterval = visibleInterval;
this.lastWidth = this.width; this.lastWidth = this.width;
@ -13289,8 +13271,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.svg.style.left = util.option.asSize(-this.width); this.svg.style.left = util.option.asSize(-this.width);
} }
if (zoomed == true || this.abortedGraphUpdate == true) {
this._updateGraph();
if (this.abortedGraphUpdate == true || forceGraphUpdate == true) {
resized = resized || this._updateGraph();
} }
else { else {
// move the whole svg while dragging // move the whole svg while dragging
@ -13348,7 +13330,7 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (groupIds.length > 0) { if (groupIds.length > 0) {
// this is the range of the SVG canvas // this is the range of the SVG canvas
var minDate = this.body.util.toGlobalTime(- this.body.domProps.root.width);
var minDate = this.body.util.toGlobalTime(-this.body.domProps.root.width);
var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width); var maxDate = this.body.util.toGlobalTime(2 * this.body.domProps.root.width);
var groupsData = {}; var groupsData = {};
// fill groups data, this only loads the data we require based on the timewindow // fill groups data, this only loads the data we require based on the timewindow
@ -13368,34 +13350,42 @@ return /******/ (function(modules) { // webpackBootstrap
// update the Y axis first, we use this data to draw at the correct Y points // update the Y axis first, we use this data to draw at the correct Y points
// changeCalled is required to clean the SVG on a change emit. // changeCalled is required to clean the SVG on a change emit.
changeCalled = this._updateYAxis(groupIds, groupRanges); changeCalled = this._updateYAxis(groupIds, groupRanges);
if (changeCalled == true) {
var MAX_CYCLES = 5;
if (changeCalled == true && this.COUNTER < MAX_CYCLES) {
DOMutil.cleanupElements(this.svgElements); DOMutil.cleanupElements(this.svgElements);
this.abortedGraphUpdate = true; this.abortedGraphUpdate = true;
this.COUNTER++;
this.body.emitter.emit('change'); this.body.emitter.emit('change');
return;
}
this.abortedGraphUpdate = false;
// With the yAxis scaled correctly, use this to get the Y values of the points.
for (i = 0; i < groupIds.length; i++) {
group = this.groups[groupIds[i]];
processedGroupData[groupIds[i]] = this._convertYcoordinates(groupsData[groupIds[i]], group);
return true;
} }
else {
if (this.COUNTER > MAX_CYCLES) {
console.log("WARNING: there may be an infinite loop in the _updateGraph emitter cycle.")
}
this.COUNTER = 0;
this.abortedGraphUpdate = false;
// With the yAxis scaled correctly, use this to get the Y values of the points.
for (i = 0; i < groupIds.length; i++) {
group = this.groups[groupIds[i]];
processedGroupData[groupIds[i]] = this._convertYcoordinates(groupsData[groupIds[i]], group);
}
// draw the groups
for (i = 0; i < groupIds.length; i++) {
group = this.groups[groupIds[i]];
if (group.options.style != 'bar') { // bar needs to be drawn enmasse
group.draw(processedGroupData[groupIds[i]], group, this.framework);
// draw the groups
for (i = 0; i < groupIds.length; i++) {
group = this.groups[groupIds[i]];
if (group.options.style != 'bar') { // bar needs to be drawn enmasse
group.draw(processedGroupData[groupIds[i]], group, this.framework);
}
} }
BarGraphFunctions.draw(groupIds, processedGroupData, this.framework);
} }
BarGraphFunctions.draw(groupIds, processedGroupData, this.framework);
} }
} }
// cleanup unused svg elements // cleanup unused svg elements
DOMutil.cleanupElements(this.svgElements); DOMutil.cleanupElements(this.svgElements);
return false;
}; };
@ -13536,6 +13526,22 @@ return /******/ (function(modules) { // webpackBootstrap
var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal; var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal;
// if groups are present // if groups are present
if (groupIds.length > 0) { if (groupIds.length > 0) {
// this is here to make sure that if there are no items in the axis but there are groups, that there is no infinite draw/redraw loop.
for (var i = 0; i < groupIds.length; i++) {
var group = this.groups[groupIds[i]];
if (group && group.options.yAxisOrientation == 'left') {
yAxisLeftUsed = true;
minLeft = 0;
maxLeft = 0;
}
else {
yAxisRightUsed = true;
minRight = 0;
maxRight = 0;
}
}
// if there are items:
for (var i = 0; i < groupIds.length; i++) { for (var i = 0; i < groupIds.length; i++) {
if (groupRanges.hasOwnProperty(groupIds[i])) { if (groupRanges.hasOwnProperty(groupIds[i])) {
if (groupRanges[groupIds[i]].ignore !== true) { if (groupRanges[groupIds[i]].ignore !== true) {
@ -13563,7 +13569,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.yAxisRight.setRange(minRight, maxRight); this.yAxisRight.setRange(minRight, maxRight);
} }
} }
changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled; changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled;
changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled; changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled;
@ -13614,13 +13619,13 @@ return /******/ (function(modules) { // webpackBootstrap
LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) { LineGraph.prototype._toggleAxisVisiblity = function (axisUsed, axis) {
var changed = false; var changed = false;
if (axisUsed == false) { if (axisUsed == false) {
if (axis.dom.frame.parentNode) {
axis.hide();
if (axis.dom.frame.parentNode && axis.hidden == false) {
axis.hide()
changed = true; changed = true;
} }
} }
else { else {
if (!axis.dom.frame.parentNode) {
if (!axis.dom.frame.parentNode && axis.hidden == true) {
axis.show(); axis.show();
changed = true; changed = true;
} }
@ -15537,7 +15542,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.hoverObj = {nodes:{},edges:{}}; this.hoverObj = {nodes:{},edges:{}};
this.controlNodesActive = false; this.controlNodesActive = false;
this.navigationHammers = {existing:[], new: []};
this.navigationHammers = {existing:[], _new: []};
// animation properties // animation properties
this.animationSpeed = 1/this.renderRefreshRate; this.animationSpeed = 1/this.renderRefreshRate;
@ -15549,6 +15554,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.targetTranslation = 0; this.targetTranslation = 0;
this.lockedOnNodeId = null; this.lockedOnNodeId = null;
this.lockedOnNodeOffset = null; this.lockedOnNodeOffset = null;
this.touchTime = 0;
// Node variables // Node variables
var network = this; var network = this;
@ -16098,7 +16104,6 @@ return /******/ (function(modules) { // webpackBootstrap
this.hammerFrame = Hammer(this.frame, { this.hammerFrame = Hammer(this.frame, {
prevent_default: true prevent_default: true
}); });
this.hammerFrame.on('release', me._onRelease.bind(me) ); this.hammerFrame.on('release', me._onRelease.bind(me) );
// add the frame to the container element // add the frame to the container element
@ -16172,11 +16177,16 @@ return /******/ (function(modules) { // webpackBootstrap
* @private * @private
*/ */
Network.prototype._onTouch = function (event) { Network.prototype._onTouch = function (event) {
this.drag.pointer = this._getPointer(event.gesture.center);
this.drag.pinched = false;
this.pinch.scale = this._getScale();
if (new Date().valueOf() - this.touchTime > 100) {
this.drag.pointer = this._getPointer(event.gesture.center);
this.drag.pinched = false;
this.pinch.scale = this._getScale();
// to avoid double fireing of this event because we have two hammer instances. (on canvas and on frame)
this.touchTime = new Date().valueOf();
this._handleTouch(this.drag.pointer);
this._handleTouch(this.drag.pointer);
}
}; };
/** /**
@ -17954,6 +17964,9 @@ return /******/ (function(modules) { // webpackBootstrap
this.to = null; // a node this.to = null; // a node
this.via = null; // a temp node this.via = null; // a temp node
this.fromBackup = null; // used to clean up after reconnect
this.toBackup = null;; // used to clean up after reconnect
// we use this to be able to reconnect the edge to a cluster if its node is put into a cluster // we use this to be able to reconnect the edge to a cluster if its node is put into a cluster
// by storing the original information we can revert to the original connection when the cluser is opened. // by storing the original information we can revert to the original connection when the cluser is opened.
this.originalFromId = []; this.originalFromId = [];
@ -18946,7 +18959,8 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
/** /**
* This function draws the control nodes for the manipulator. In order to enable this, only set the this.controlNodesEnabled to true.
* This function draws the control nodes for the manipulator.
* In order to enable this, only set the this.controlNodesEnabled to true.
* @param ctx * @param ctx
*/ */
Edge.prototype._drawControlNodes = function(ctx) { Edge.prototype._drawControlNodes = function(ctx) {
@ -18992,17 +19006,31 @@ return /******/ (function(modules) { // webpackBootstrap
* @private * @private
*/ */
Edge.prototype._enableControlNodes = function() { Edge.prototype._enableControlNodes = function() {
this.fromBackup = this.from;
this.toBackup = this.to;
this.controlNodesEnabled = true; this.controlNodesEnabled = true;
}; };
/** /**
* disable control nodes
* disable control nodes and remove from dynamicEdges from old node
* @private * @private
*/ */
Edge.prototype._disableControlNodes = function() { Edge.prototype._disableControlNodes = function() {
this.fromId = this.from.id;
this.toId = this.to.id;
if (this.fromId != this.fromBackup.id) { // from was changed, remove edge from old 'from' node dynamic edges
this.fromBackup.detachEdge(this);
}
else if (this.toId != this.toBackup.id) { // to was changed, remove edge from old 'to' node dynamic edges
this.toBackup.detachEdge(this);
}
this.fromBackup = null;
this.toBackup = null;
this.controlNodesEnabled = false; this.controlNodesEnabled = false;
}; };
/** /**
* This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null. * This checks if one of the control nodes is selected and if so, returns the control node object. Else it returns null.
* @param x * @param x
@ -19041,7 +19069,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.connectedNode = null; this.connectedNode = null;
this.controlNodes.from.unselect(); this.controlNodes.from.unselect();
} }
if (this.controlNodes.to.selected == true) {
else if (this.controlNodes.to.selected == true) {
this.to = this.connectedNode; this.to = this.connectedNode;
this.connectedNode = null; this.connectedNode = null;
this.controlNodes.to.unselect(); this.controlNodes.to.unselect();
@ -21180,7 +21208,7 @@ return /******/ (function(modules) { // webpackBootstrap
* @param {Object} dotEdge * @param {Object} dotEdge
* @returns {Object} graphEdge * @returns {Object} graphEdge
*/ */
function convertEdge(dotEdge) {
var convertEdge = function (dotEdge) {
var graphEdge = { var graphEdge = {
from: dotEdge.from, from: dotEdge.from,
to: dotEdge.to to: dotEdge.to
@ -21947,7 +21975,7 @@ return /******/ (function(modules) { // webpackBootstrap
}); });
if (resized) { if (resized) {
// keep repainting until all sizes are settled // keep repainting until all sizes are settled
var MAX_REDRAWS = 2; // maximum number of consecutive redraws
var MAX_REDRAWS = 3; // maximum number of consecutive redraws
if (this.redrawCount < MAX_REDRAWS) { if (this.redrawCount < MAX_REDRAWS) {
this.redrawCount++; this.redrawCount++;
this.redraw(); this.redraw();
@ -22556,7 +22584,7 @@ return /******/ (function(modules) { // webpackBootstrap
Line.prototype.getYRange = function(groupData) { Line.prototype.getYRange = function(groupData) {
var yMin = groupData[0].y; var yMin = groupData[0].y;
var yMax = groupData[0].y; var yMax = groupData[0].y;
for (j = 0; j < groupData.length; j++) {
for (var j = 0; j < groupData.length; j++) {
yMin = yMin > groupData[j].y ? groupData[j].y : yMin; yMin = yMin > groupData[j].y ? groupData[j].y : yMin;
yMax = yMax < groupData[j].y ? groupData[j].y : yMax; yMax = yMax < groupData[j].y ? groupData[j].y : yMax;
} }
@ -23014,7 +23042,7 @@ return /******/ (function(modules) { // webpackBootstrap
Points.prototype.getYRange = function(groupData) { Points.prototype.getYRange = function(groupData) {
var yMin = groupData[0].y; var yMin = groupData[0].y;
var yMax = groupData[0].y; var yMax = groupData[0].y;
for (j = 0; j < groupData.length; j++) {
for (var j = 0; j < groupData.length; j++) {
yMin = yMin > groupData[j].y ? groupData[j].y : yMin; yMin = yMin > groupData[j].y ? groupData[j].y : yMin;
yMax = yMax < groupData[j].y ? groupData[j].y : yMax; yMax = yMax < groupData[j].y ? groupData[j].y : yMax;
} }
@ -23576,7 +23604,8 @@ return /******/ (function(modules) { // webpackBootstrap
/* 57 */ /* 57 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;"use strict";
/**
* Created by Alex on 11/6/2014. * Created by Alex on 11/6/2014.
*/ */
@ -23600,6 +23629,7 @@ return /******/ (function(modules) { // webpackBootstrap
function keycharm(options) { function keycharm(options) {
var preventDefault = options && options.preventDefault || false; var preventDefault = options && options.preventDefault || false;
var _exportFunctions = {};
var _bound = {keydown:{}, keyup:{}}; var _bound = {keydown:{}, keyup:{}};
var _keys = {}; var _keys = {};
var i; var i;
@ -23672,7 +23702,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
// bind a key to a callback // bind a key to a callback
this.bind = function(key, callback, type) {
_exportFunctions.bind = function(key, callback, type) {
if (type === undefined) { if (type === undefined) {
type = 'keydown'; type = 'keydown';
} }
@ -23687,20 +23717,20 @@ return /******/ (function(modules) { // webpackBootstrap
// bind all keys to a call back (demo purposes) // bind all keys to a call back (demo purposes)
this.bindAll = function(callback, type) {
_exportFunctions.bindAll = function(callback, type) {
if (type === undefined) { if (type === undefined) {
type = 'keydown'; type = 'keydown';
} }
for (key in _keys) {
for (var key in _keys) {
if (_keys.hasOwnProperty(key)) { if (_keys.hasOwnProperty(key)) {
this.bind(key,callback,type);
_exportFunctions.bind(key,callback,type);
} }
} }
}
};
// get the key label from an event // get the key label from an event
this.getKey = function(event) {
for (key in _keys) {
_exportFunctions.getKey = function(event) {
for (var key in _keys) {
if (_keys.hasOwnProperty(key)) { if (_keys.hasOwnProperty(key)) {
if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) { if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
return key; return key;
@ -23717,7 +23747,7 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
// unbind either a specific callback from a key or all of them (by leaving callback undefined) // unbind either a specific callback from a key or all of them (by leaving callback undefined)
this.unbind = function(key, callback, type) {
_exportFunctions.unbind = function(key, callback, type) {
if (type === undefined) { if (type === undefined) {
type = 'keydown'; type = 'keydown';
} }
@ -23726,10 +23756,12 @@ return /******/ (function(modules) { // webpackBootstrap
} }
if (callback !== undefined) { if (callback !== undefined) {
var newBindings = []; var newBindings = [];
var bound = _bound[type][_keys[key].code]
for (var i = 0; i < bound.length; i++) {
if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
newBindings.push(_bound[type][_keys[key].code][i]);
var bound = _bound[type][_keys[key].code];
if (bound !== undefined) {
for (var i = 0; i < bound.length; i++) {
if (!(bound[i].fn == callback && bound[i].shift == _keys[key].shift)) {
newBindings.push(_bound[type][_keys[key].code][i]);
}
} }
} }
_bound[type][_keys[key].code] = newBindings; _bound[type][_keys[key].code] = newBindings;
@ -23740,12 +23772,12 @@ return /******/ (function(modules) { // webpackBootstrap
}; };
// reset all bound variables. // reset all bound variables.
this.reset = function() {
_exportFunctions.reset = function() {
_bound = {keydown:{}, keyup:{}}; _bound = {keydown:{}, keyup:{}};
}; };
// unbind all listeners and reset all variables. // unbind all listeners and reset all variables.
this.destroy = function() {
_exportFunctions.destroy = function() {
_bound = {keydown:{}, keyup:{}}; _bound = {keydown:{}, keyup:{}};
window.removeEventListener('keydown', down, true); window.removeEventListener('keydown', down, true);
window.removeEventListener('keyup', up, true); window.removeEventListener('keyup', up, true);
@ -23756,7 +23788,7 @@ return /******/ (function(modules) { // webpackBootstrap
window.addEventListener('keyup',up,true); window.addEventListener('keyup',up,true);
// return the public functions. // return the public functions.
return this;
return _exportFunctions;
} }
return keycharm; return keycharm;
@ -31374,6 +31406,7 @@ return /******/ (function(modules) { // webpackBootstrap
this.edgeBeingEdited = undefined; this.edgeBeingEdited = undefined;
this.selectedControlNode = null; this.selectedControlNode = null;
this.controlNodesActive = false; this.controlNodesActive = false;
this._redraw();
} }
// restore overloaded functions // restore overloaded functions
@ -31699,7 +31732,7 @@ return /******/ (function(modules) { // webpackBootstrap
exports._releaseControlNode = function(pointer) { exports._releaseControlNode = function(pointer) {
var newNode = this._getNodeAt(pointer); var newNode = this._getNodeAt(pointer);
if (newNode != null) {
if (newNode !== null) {
if (this.edgeBeingEdited.controlNodes.from.selected == true) { if (this.edgeBeingEdited.controlNodes.from.selected == true) {
this._editEdge(newNode.id, this.edgeBeingEdited.to.id); this._editEdge(newNode.id, this.edgeBeingEdited.to.id);
this.edgeBeingEdited.controlNodes.from.unselect(); this.edgeBeingEdited.controlNodes.from.unselect();
@ -32025,12 +32058,12 @@ return /******/ (function(modules) { // webpackBootstrap
var hammer = Hammer(this.navigationDivs[navigationDivs[i]], {prevent_default: true}); var hammer = Hammer(this.navigationDivs[navigationDivs[i]], {prevent_default: true});
hammer.on('touch', this[navigationDivActions[i]].bind(this)); hammer.on('touch', this[navigationDivActions[i]].bind(this));
this.navigationHammers.new.push(hammer);
this.navigationHammers._new.push(hammer);
} }
this._navigationReleaseOverload = this._stopMovement; this._navigationReleaseOverload = this._stopMovement;
this.navigationHammers.existing = this.navigationHammers.new;
this.navigationHammers.existing = this.navigationHammers._new;
}; };

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


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


+ 10
- 10
docs/network.html View File

@ -1529,7 +1529,7 @@ var options = {
} }
} }
// OR to just load the module with default values: // OR to just load the module with default values:
var options: {
var options = {
dataManipulation: true dataManipulation: true
} }
</pre> </pre>
@ -1567,7 +1567,7 @@ var options: {
</p> </p>
<pre class="prettyprint"> <pre class="prettyprint">
// If a variable is not supplied, the default value is used. // If a variable is not supplied, the default value is used.
var options: {
var options = {
dataManipulation: true, dataManipulation: true,
onAdd: function(data,callback) { onAdd: function(data,callback) {
/** data = {id: random unique id, /** data = {id: random unique id,
@ -1677,7 +1677,7 @@ var options = {
} }
} }
// OR to just load the module with default values: // OR to just load the module with default values:
var options: {
var options = {
clustering: true clustering: true
} }
</pre> </pre>
@ -1827,7 +1827,7 @@ var options: {
<pre class="prettyprint"> <pre class="prettyprint">
// use of navigation controls // use of navigation controls
var options: {
var options = {
navigation: true navigation: true
} }
@ -1841,12 +1841,12 @@ var options: {
<pre class="prettyprint"> <pre class="prettyprint">
// simple use of keyboard controls // simple use of keyboard controls
var options: {
var options = {
keyboard: true keyboard: true
} }
// advanced configuration for keyboard controls // advanced configuration for keyboard controls
var options: {
var options = {
keyboard: { keyboard: {
speed: { speed: {
x: 10, x: 10,
@ -1897,12 +1897,12 @@ var options: {
<pre class="prettyprint"> <pre class="prettyprint">
// simple use of the hierarchical layout // simple use of the hierarchical layout
var options: {
var options = {
hierarchicalLayout: true hierarchicalLayout: true
} }
// advanced configuration for hierarchical layout // advanced configuration for hierarchical layout
var options: {
var options = {
hierarchicalLayout: { hierarchicalLayout: {
enabled:false, enabled:false,
levelSeparation: 150, levelSeparation: 150,
@ -1912,7 +1912,7 @@ var options: {
} }
} }
// partial configuration automatically sets enabled to true // partial configuration automatically sets enabled to true
var options: {
var options = {
hierarchicalLayout: { hierarchicalLayout: {
nodeSpacing: 100, nodeSpacing: 100,
direction: "UD" direction: "UD"
@ -2062,7 +2062,7 @@ To load a locale into the Timeline not supported by default, one can add a new l
<pre class="prettyprint"> <pre class="prettyprint">
// tooltip behaviour and style options // tooltip behaviour and style options
var options: {
var options = {
tooltip: { tooltip: {
delay: 300, delay: 300,
fontColor: "black", fontColor: "black",

+ 1
- 1
docs/timeline.html View File

@ -343,7 +343,7 @@ var groups = [
<td>title</td> <td>title</td>
<td>String</td> <td>String</td>
<td>none</td> <td>none</td>
<td>A title for the group, displayed when holding the mouse the groups label.
<td>A title for the group, displayed when holding the mouse on the groups label.
The title can only contain plain text. The title can only contain plain text.
</td> </td>
</tr> </tr>

BIN
download/vis.zip View File


+ 1
- 1
examples/graph2d/05_bothAxis.html View File

@ -131,7 +131,7 @@
start: '2014-06-09', start: '2014-06-09',
end: '2014-07-03' end: '2014-07-03'
}; };
var graph2d = new vis.Graph2d(container, items, groups, options);
var graph2d = new vis.Graph2d(container, dataset, groups, options);
</script> </script>
</body> </body>

+ 1
- 1
index.html View File

@ -76,7 +76,7 @@ bower install vis
<h3>download</h3> <h3>download</h3>
<a href="download/vis.zip">Click here to download vis.js</a> <a href="download/vis.zip">Click here to download vis.js</a>
(version <span class="version">3.7.1</span>)
(version <span class="version">3.7.2</span>)
<h2 id="example">Example</h2> <h2 id="example">Example</h2>

Loading…
Cancel
Save