Browse Source

Add support for High Resolution displays

v3_develop
Vincent Lecrubier 10 years ago
parent
commit
8647ead857
4 changed files with 405 additions and 268 deletions
  1. +354
    -246
      dist/vis.js
  2. +1
    -1
      dist/vis.map
  3. +8
    -7
      dist/vis.min.js
  4. +42
    -14
      lib/network/Network.js

+ 354
- 246
dist/vis.js View File

@ -5,7 +5,7 @@
* A dynamic, browser-based visualization library. * A dynamic, browser-based visualization library.
* *
* @version 3.7.0 * @version 3.7.0
* @date 2014-11-14
* @date 2014-11-21
* *
* @license * @license
* Copyright (C) 2011-2014 Almende B.V, http://almende.com * Copyright (C) 2011-2014 Almende B.V, http://almende.com
@ -15410,7 +15410,8 @@ return /******/ (function(modules) { // webpackBootstrap
hideNodesOnDrag: false, hideNodesOnDrag: false,
width : '100%', width : '100%',
height : '100%', height : '100%',
selectable: true
selectable: true,
pixelRatio:1
}; };
this.constants = util.extend({}, this.defaultOptions); this.constants = util.extend({}, this.defaultOptions);
@ -15899,6 +15900,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.start(); this.start();
}; };
/** /**
* Create the main frame for the Network. * Create the main frame for the Network.
* This function is executed once when a Network object is created. The frame * This function is executed once when a Network object is created. The frame
@ -15917,10 +15920,15 @@ return /******/ (function(modules) { // webpackBootstrap
this.frame.style.position = 'relative'; this.frame.style.position = 'relative';
this.frame.style.overflow = 'hidden'; this.frame.style.overflow = 'hidden';
// create the network canvas (HTML canvas element)
this.frame.canvas = document.createElement( 'canvas' );
//////////////////////////////////////////////////////////////////
this.frame.canvas = document.createElement("canvas");
this.frame.canvas.style.position = 'relative'; this.frame.canvas.style.position = 'relative';
this.frame.appendChild(this.frame.canvas); this.frame.appendChild(this.frame.canvas);
if (!this.frame.canvas.getContext) { if (!this.frame.canvas.getContext) {
var noCanvas = document.createElement( 'DIV' ); var noCanvas = document.createElement( 'DIV' );
noCanvas.style.color = 'red'; noCanvas.style.color = 'red';
@ -15929,6 +15937,23 @@ return /******/ (function(modules) { // webpackBootstrap
noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
this.frame.canvas.appendChild(noCanvas); this.frame.canvas.appendChild(noCanvas);
} }
else {
var ctx = this.frame.canvas.getContext("2d");
this.constants.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1);
this.frame.canvas.getContext("2d").setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
}
//////////////////////////////////////////////////////////////////
var me = this; var me = this;
this.drag = {}; this.drag = {};
@ -16515,8 +16540,8 @@ return /******/ (function(modules) { // webpackBootstrap
this.frame.canvas.style.width = '100%'; this.frame.canvas.style.width = '100%';
this.frame.canvas.style.height = '100%'; this.frame.canvas.style.height = '100%';
this.frame.canvas.width = this.frame.canvas.clientWidth;
this.frame.canvas.height = this.frame.canvas.clientHeight;
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
this.constants.width = width; this.constants.width = width;
this.constants.height = height; this.constants.height = height;
@ -16527,18 +16552,18 @@ return /******/ (function(modules) { // webpackBootstrap
// this would adapt the width of the canvas to the width from 100% if and only if // this would adapt the width of the canvas to the width from 100% if and only if
// there is a change. // there is a change.
if (this.frame.canvas.width != this.frame.canvas.clientWidth) {
this.frame.canvas.width = this.frame.canvas.clientWidth;
if (this.frame.canvas.width != this.frame.canvas.clientWidth * this.constants.pixelRatio) {
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
if (this.frame.canvas.height != this.frame.canvas.clientHeight) {
this.frame.canvas.height = this.frame.canvas.clientHeight;
if (this.frame.canvas.height != this.frame.canvas.clientHeight * this.constants.pixelRatio) {
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
} }
if (emitEvent == true) { if (emitEvent == true) {
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height, oldWidth: oldWidth, oldHeight: oldHeight});
this.emit('resize', {width:this.frame.canvas.width * this.constants.pixelRatio,height:this.frame.canvas.height * this.constants.pixelRatio, oldWidth: oldWidth * this.constants.pixelRatio, oldHeight: oldHeight * this.constants.pixelRatio});
} }
}; };
@ -16887,9 +16912,12 @@ return /******/ (function(modules) { // webpackBootstrap
*/ */
Network.prototype._redraw = function() { Network.prototype._redraw = function() {
var ctx = this.frame.canvas.getContext('2d'); var ctx = this.frame.canvas.getContext('2d');
ctx.setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.width;
var h = this.frame.canvas.height;
var w = this.frame.canvas.width * this.constants.pixelRatio;
var h = this.frame.canvas.height * this.constants.pixelRatio;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -16902,8 +16930,8 @@ return /******/ (function(modules) { // webpackBootstrap
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.constants.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.constants.pixelRatio)
}; };
@ -23397,193 +23425,193 @@ 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__;/**
* Created by Alex on 11/6/2014.
*/
// https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
// if the module has no dependencies, the above pattern can be simplified to
(function (root, factory) {
if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.keycharm = factory();
}
}(this, function () {
function keycharm(options) {
var preventDefault = options && options.preventDefault || false;
var _bound = {keydown:{}, keyup:{}};
var _keys = {};
var i;
// a - z
for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};}
// A - Z
for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};}
// 0 - 9
for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};}
// F1 - F12
for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};}
// num0 - num9
for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};}
// numpad misc
_keys['num*'] = {code:106, shift: false};
_keys['num+'] = {code:107, shift: false};
_keys['num-'] = {code:109, shift: false};
_keys['num/'] = {code:111, shift: false};
_keys['num.'] = {code:110, shift: false};
// arrows
_keys['left'] = {code:37, shift: false};
_keys['up'] = {code:38, shift: false};
_keys['right'] = {code:39, shift: false};
_keys['down'] = {code:40, shift: false};
// extra keys
_keys['space'] = {code:32, shift: false};
_keys['enter'] = {code:13, shift: false};
_keys['shift'] = {code:16, shift: undefined};
_keys['esc'] = {code:27, shift: false};
_keys['backspace'] = {code:8, shift: false};
_keys['tab'] = {code:9, shift: false};
_keys['ctrl'] = {code:17, shift: false};
_keys['alt'] = {code:18, shift: false};
_keys['delete'] = {code:46, shift: false};
_keys['pageup'] = {code:33, shift: false};
_keys['pagedown'] = {code:34, shift: false};
// symbols
_keys['='] = {code:187, shift: false};
_keys['-'] = {code:189, shift: false};
_keys[']'] = {code:221, shift: false};
_keys['['] = {code:219, shift: false};
var down = function(event) {handleEvent(event,'keydown');};
var up = function(event) {handleEvent(event,'keyup');};
// handle the actualy bound key with the event
var handleEvent = function(event,type) {
if (_bound[type][event.keyCode] !== undefined) {
var bound = _bound[type][event.keyCode];
for (var i = 0; i < bound.length; i++) {
if (bound[i].shift === undefined) {
bound[i].fn(event);
}
else if (bound[i].shift == true && event.shiftKey == true) {
bound[i].fn(event);
}
else if (bound[i].shift == false && event.shiftKey == false) {
bound[i].fn(event);
}
}
if (preventDefault == true) {
event.preventDefault();
}
}
};
// bind a key to a callback
this.bind = function(key, callback, type) {
if (type === undefined) {
type = 'keydown';
}
if (_keys[key] === undefined) {
throw new Error("unsupported key: " + key);
}
if (_bound[type][_keys[key].code] === undefined) {
_bound[type][_keys[key].code] = [];
}
_bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift});
};
// bind all keys to a call back (demo purposes)
this.bindAll = function(callback, type) {
if (type === undefined) {
type = 'keydown';
}
for (key in _keys) {
if (_keys.hasOwnProperty(key)) {
this.bind(key,callback,type);
}
}
}
// get the key label from an event
this.getKey = function(event) {
for (key in _keys) {
if (_keys.hasOwnProperty(key)) {
if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
return key;
}
else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
return key;
}
else if (event.keyCode == _keys[key].code && key == 'shift') {
return key;
}
}
}
return "unknown key, currently not supported";
};
// unbind either a specific callback from a key or all of them (by leaving callback undefined)
this.unbind = function(key, callback, type) {
if (type === undefined) {
type = 'keydown';
}
if (_keys[key] === undefined) {
throw new Error("unsupported key: " + key);
}
if (callback !== undefined) {
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]);
}
}
_bound[type][_keys[key].code] = newBindings;
}
else {
_bound[type][_keys[key].code] = [];
}
};
// reset all bound variables.
this.reset = function() {
_bound = {keydown:{}, keyup:{}};
};
// unbind all listeners and reset all variables.
this.destroy = function() {
_bound = {keydown:{}, keyup:{}};
window.removeEventListener('keydown', down, true);
window.removeEventListener('keyup', up, true);
};
// create listeners.
window.addEventListener('keydown',down,true);
window.addEventListener('keyup',up,true);
// return the public functions.
return this;
}
return keycharm;
}));
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
* Created by Alex on 11/6/2014.
*/
// https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
// if the module has no dependencies, the above pattern can be simplified to
(function (root, factory) {
if (true) {
// AMD. Register as an anonymous module.
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.keycharm = factory();
}
}(this, function () {
function keycharm(options) {
var preventDefault = options && options.preventDefault || false;
var _bound = {keydown:{}, keyup:{}};
var _keys = {};
var i;
// a - z
for (i = 97; i <= 122; i++) {_keys[String.fromCharCode(i)] = {code:65 + (i - 97), shift: false};}
// A - Z
for (i = 65; i <= 90; i++) {_keys[String.fromCharCode(i)] = {code:i, shift: true};}
// 0 - 9
for (i = 0; i <= 9; i++) {_keys['' + i] = {code:48 + i, shift: false};}
// F1 - F12
for (i = 1; i <= 12; i++) {_keys['F' + i] = {code:111 + i, shift: false};}
// num0 - num9
for (i = 0; i <= 9; i++) {_keys['num' + i] = {code:96 + i, shift: false};}
// numpad misc
_keys['num*'] = {code:106, shift: false};
_keys['num+'] = {code:107, shift: false};
_keys['num-'] = {code:109, shift: false};
_keys['num/'] = {code:111, shift: false};
_keys['num.'] = {code:110, shift: false};
// arrows
_keys['left'] = {code:37, shift: false};
_keys['up'] = {code:38, shift: false};
_keys['right'] = {code:39, shift: false};
_keys['down'] = {code:40, shift: false};
// extra keys
_keys['space'] = {code:32, shift: false};
_keys['enter'] = {code:13, shift: false};
_keys['shift'] = {code:16, shift: undefined};
_keys['esc'] = {code:27, shift: false};
_keys['backspace'] = {code:8, shift: false};
_keys['tab'] = {code:9, shift: false};
_keys['ctrl'] = {code:17, shift: false};
_keys['alt'] = {code:18, shift: false};
_keys['delete'] = {code:46, shift: false};
_keys['pageup'] = {code:33, shift: false};
_keys['pagedown'] = {code:34, shift: false};
// symbols
_keys['='] = {code:187, shift: false};
_keys['-'] = {code:189, shift: false};
_keys[']'] = {code:221, shift: false};
_keys['['] = {code:219, shift: false};
var down = function(event) {handleEvent(event,'keydown');};
var up = function(event) {handleEvent(event,'keyup');};
// handle the actualy bound key with the event
var handleEvent = function(event,type) {
if (_bound[type][event.keyCode] !== undefined) {
var bound = _bound[type][event.keyCode];
for (var i = 0; i < bound.length; i++) {
if (bound[i].shift === undefined) {
bound[i].fn(event);
}
else if (bound[i].shift == true && event.shiftKey == true) {
bound[i].fn(event);
}
else if (bound[i].shift == false && event.shiftKey == false) {
bound[i].fn(event);
}
}
if (preventDefault == true) {
event.preventDefault();
}
}
};
// bind a key to a callback
this.bind = function(key, callback, type) {
if (type === undefined) {
type = 'keydown';
}
if (_keys[key] === undefined) {
throw new Error("unsupported key: " + key);
}
if (_bound[type][_keys[key].code] === undefined) {
_bound[type][_keys[key].code] = [];
}
_bound[type][_keys[key].code].push({fn:callback, shift:_keys[key].shift});
};
// bind all keys to a call back (demo purposes)
this.bindAll = function(callback, type) {
if (type === undefined) {
type = 'keydown';
}
for (key in _keys) {
if (_keys.hasOwnProperty(key)) {
this.bind(key,callback,type);
}
}
}
// get the key label from an event
this.getKey = function(event) {
for (key in _keys) {
if (_keys.hasOwnProperty(key)) {
if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {
return key;
}
else if (event.shiftKey == false && _keys[key].shift == false && event.keyCode == _keys[key].code) {
return key;
}
else if (event.keyCode == _keys[key].code && key == 'shift') {
return key;
}
}
}
return "unknown key, currently not supported";
};
// unbind either a specific callback from a key or all of them (by leaving callback undefined)
this.unbind = function(key, callback, type) {
if (type === undefined) {
type = 'keydown';
}
if (_keys[key] === undefined) {
throw new Error("unsupported key: " + key);
}
if (callback !== undefined) {
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]);
}
}
_bound[type][_keys[key].code] = newBindings;
}
else {
_bound[type][_keys[key].code] = [];
}
};
// reset all bound variables.
this.reset = function() {
_bound = {keydown:{}, keyup:{}};
};
// unbind all listeners and reset all variables.
this.destroy = function() {
_bound = {keydown:{}, keyup:{}};
window.removeEventListener('keydown', down, true);
window.removeEventListener('keyup', up, true);
};
// create listeners.
window.addEventListener('keydown',down,true);
window.addEventListener('keyup',up,true);
// return the public functions.
return this;
}
return keycharm;
}));
/***/ }, /***/ },
@ -23591,7 +23619,7 @@ return /******/ (function(modules) { // webpackBootstrap
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {//! moment.js var __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(global, module) {//! moment.js
//! version : 2.8.3
//! version : 2.8.4
//! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
//! license : MIT //! license : MIT
//! momentjs.com //! momentjs.com
@ -23602,7 +23630,7 @@ return /******/ (function(modules) { // webpackBootstrap
************************************/ ************************************/
var moment, var moment,
VERSION = '2.8.3',
VERSION = '2.8.4',
// the global-scope this is NOT the global object in Node.js // the global-scope this is NOT the global object in Node.js
globalScope = typeof global !== 'undefined' ? global : this, globalScope = typeof global !== 'undefined' ? global : this,
oldGlobalMoment, oldGlobalMoment,
@ -23625,7 +23653,7 @@ return /******/ (function(modules) { // webpackBootstrap
momentProperties = [], momentProperties = [],
// check for nodeJS // check for nodeJS
hasModule = (typeof module !== 'undefined' && module.exports),
hasModule = (typeof module !== 'undefined' && module && module.exports),
// ASP.NET json date format regex // ASP.NET json date format regex
aspNetJsonRegex = /^\/?Date\((\-?\d+)/i, aspNetJsonRegex = /^\/?Date\((\-?\d+)/i,
@ -23636,8 +23664,8 @@ return /******/ (function(modules) { // webpackBootstrap
isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/, isoDurationRegex = /^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,
// format tokens // format tokens
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,
formattingTokens = /(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|x|X|zz?|ZZ?|.)/g,
localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
// parsing token regexes // parsing token regexes
parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99 parseTokenOneOrTwoDigits = /\d\d?/, // 0 - 99
@ -23648,8 +23676,8 @@ return /******/ (function(modules) { // webpackBootstrap
parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic. parseTokenWord = /[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i, // any word (or two) characters or numbers including two/three word month in arabic.
parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z parseTokenTimezone = /Z|[\+\-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
parseTokenT = /T/i, // T (ISO separator) parseTokenT = /T/i, // T (ISO separator)
parseTokenOffsetMs = /[\+\-]?\d+/, // 1234567890123
parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123 parseTokenTimestampMs = /[\+\-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
parseTokenOrdinal = /\d{1,2}/,
//strict parsing regexes //strict parsing regexes
parseTokenOneDigit = /\d/, // 0 - 9 parseTokenOneDigit = /\d/, // 0 - 9
@ -23864,6 +23892,9 @@ return /******/ (function(modules) { // webpackBootstrap
zz : function () { zz : function () {
return this.zoneName(); return this.zoneName();
}, },
x : function () {
return this.valueOf();
},
X : function () { X : function () {
return this.unix(); return this.unix();
}, },
@ -24290,7 +24321,10 @@ return /******/ (function(modules) { // webpackBootstrap
overflow = overflow =
m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH : m._a[MONTH] < 0 || m._a[MONTH] > 11 ? MONTH :
m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE : m._a[DATE] < 1 || m._a[DATE] > daysInMonth(m._a[YEAR], m._a[MONTH]) ? DATE :
m._a[HOUR] < 0 || m._a[HOUR] > 23 ? HOUR :
m._a[HOUR] < 0 || m._a[HOUR] > 24 ||
(m._a[HOUR] === 24 && (m._a[MINUTE] !== 0 ||
m._a[SECOND] !== 0 ||
m._a[MILLISECOND] !== 0)) ? HOUR :
m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE : m._a[MINUTE] < 0 || m._a[MINUTE] > 59 ? MINUTE :
m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND : m._a[SECOND] < 0 || m._a[SECOND] > 59 ? SECOND :
m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND : m._a[MILLISECOND] < 0 || m._a[MILLISECOND] > 999 ? MILLISECOND :
@ -24317,7 +24351,8 @@ return /******/ (function(modules) { // webpackBootstrap
if (m._strict) { if (m._strict) {
m._isValid = m._isValid && m._isValid = m._isValid &&
m._pf.charsLeftOver === 0 && m._pf.charsLeftOver === 0 &&
m._pf.unusedTokens.length === 0;
m._pf.unusedTokens.length === 0 &&
m._pf.bigHour === undefined;
} }
} }
return m._isValid; return m._isValid;
@ -24369,8 +24404,18 @@ return /******/ (function(modules) { // webpackBootstrap
// Return a moment from input, that is local/utc/zone equivalent to model. // Return a moment from input, that is local/utc/zone equivalent to model.
function makeAs(input, model) { function makeAs(input, model) {
return model._isUTC ? moment(input).zone(model._offset || 0) :
moment(input).local();
var res, diff;
if (model._isUTC) {
res = model.clone();
diff = (moment.isMoment(input) || isDate(input) ?
+input : +moment(input)) - (+res);
// Use low-level api, because this fn is low-level api.
res._d.setTime(+res._d + diff);
moment.updateOffset(res, false);
return res;
} else {
return moment(input).local();
}
} }
/************************************ /************************************
@ -24390,6 +24435,9 @@ return /******/ (function(modules) { // webpackBootstrap
this['_' + i] = prop; this['_' + i] = prop;
} }
} }
// Lenient ordinal parsing accepts just a number in addition to
// number + (possibly) stuff coming from _ordinalParseLenient.
this._ordinalParseLenient = new RegExp(this._ordinalParse.source + '|' + /\d{1,2}/.source);
}, },
_months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'), _months : 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
@ -24402,22 +24450,32 @@ return /******/ (function(modules) { // webpackBootstrap
return this._monthsShort[m.month()]; return this._monthsShort[m.month()];
}, },
monthsParse : function (monthName) {
monthsParse : function (monthName, format, strict) {
var i, mom, regex; var i, mom, regex;
if (!this._monthsParse) { if (!this._monthsParse) {
this._monthsParse = []; this._monthsParse = [];
this._longMonthsParse = [];
this._shortMonthsParse = [];
} }
for (i = 0; i < 12; i++) { for (i = 0; i < 12; i++) {
// make the regex if we don't have it already // make the regex if we don't have it already
if (!this._monthsParse[i]) {
mom = moment.utc([2000, i]);
mom = moment.utc([2000, i]);
if (strict && !this._longMonthsParse[i]) {
this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i');
this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i');
}
if (!strict && !this._monthsParse[i]) {
regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
} }
// test the regex // test the regex
if (this._monthsParse[i].test(monthName)) {
if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) {
return i;
} else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) {
return i;
} else if (!strict && this._monthsParse[i].test(monthName)) {
return i; return i;
} }
} }
@ -24460,6 +24518,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, },
_longDateFormat : { _longDateFormat : {
LTS : 'h:mm:ss A',
LT : 'h:mm A', LT : 'h:mm A',
L : 'MM/DD/YYYY', L : 'MM/DD/YYYY',
LL : 'MMMM D, YYYY', LL : 'MMMM D, YYYY',
@ -24500,9 +24559,9 @@ return /******/ (function(modules) { // webpackBootstrap
lastWeek : '[Last] dddd [at] LT', lastWeek : '[Last] dddd [at] LT',
sameElse : 'L' sameElse : 'L'
}, },
calendar : function (key, mom) {
calendar : function (key, mom, now) {
var output = this._calendar[key]; var output = this._calendar[key];
return typeof output === 'function' ? output.apply(mom) : output;
return typeof output === 'function' ? output.apply(mom, [now]) : output;
}, },
_relativeTime : { _relativeTime : {
@ -24537,6 +24596,7 @@ return /******/ (function(modules) { // webpackBootstrap
return this._ordinal.replace('%d', number); return this._ordinal.replace('%d', number);
}, },
_ordinal : '%d', _ordinal : '%d',
_ordinalParse : /\d{1,2}/,
preparse : function (string) { preparse : function (string) {
return string; return string;
@ -24678,6 +24738,8 @@ return /******/ (function(modules) { // webpackBootstrap
case 'a': case 'a':
case 'A': case 'A':
return config._locale._meridiemParse; return config._locale._meridiemParse;
case 'x':
return parseTokenOffsetMs;
case 'X': case 'X':
return parseTokenTimestampMs; return parseTokenTimestampMs;
case 'Z': case 'Z':
@ -24712,7 +24774,7 @@ return /******/ (function(modules) { // webpackBootstrap
case 'E': case 'E':
return parseTokenOneOrTwoDigits; return parseTokenOneOrTwoDigits;
case 'Do': case 'Do':
return parseTokenOrdinal;
return strict ? config._locale._ordinalParse : config._locale._ordinalParseLenient;
default : default :
a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i')); a = new RegExp(regexpEscape(unescapeFormat(token.replace('\\', '')), 'i'));
return a; return a;
@ -24749,7 +24811,7 @@ return /******/ (function(modules) { // webpackBootstrap
break; break;
case 'MMM' : // fall through to MMMM case 'MMM' : // fall through to MMMM
case 'MMMM' : case 'MMMM' :
a = config._locale.monthsParse(input);
a = config._locale.monthsParse(input, token, config._strict);
// if we didn't find a month name, mark the date as invalid. // if we didn't find a month name, mark the date as invalid.
if (a != null) { if (a != null) {
datePartArray[MONTH] = a; datePartArray[MONTH] = a;
@ -24766,7 +24828,8 @@ return /******/ (function(modules) { // webpackBootstrap
break; break;
case 'Do' : case 'Do' :
if (input != null) { if (input != null) {
datePartArray[DATE] = toInt(parseInt(input, 10));
datePartArray[DATE] = toInt(parseInt(
input.match(/\d{1,2}/)[0], 10));
} }
break; break;
// DAY OF YEAR // DAY OF YEAR
@ -24791,11 +24854,13 @@ return /******/ (function(modules) { // webpackBootstrap
case 'A' : case 'A' :
config._isPm = config._locale.isPM(input); config._isPm = config._locale.isPM(input);
break; break;
// 24 HOUR
case 'H' : // fall through to hh
case 'HH' : // fall through to hh
// HOUR
case 'h' : // fall through to hh case 'h' : // fall through to hh
case 'hh' : case 'hh' :
config._pf.bigHour = true;
/* falls through */
case 'H' : // fall through to HH
case 'HH' :
datePartArray[HOUR] = toInt(input); datePartArray[HOUR] = toInt(input);
break; break;
// MINUTE // MINUTE
@ -24815,6 +24880,10 @@ return /******/ (function(modules) { // webpackBootstrap
case 'SSSS' : case 'SSSS' :
datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000); datePartArray[MILLISECOND] = toInt(('0.' + input) * 1000);
break; break;
// UNIX OFFSET (MILLISECONDS)
case 'x':
config._d = new Date(toInt(input));
break;
// UNIX TIMESTAMP WITH MS // UNIX TIMESTAMP WITH MS
case 'X': case 'X':
config._d = new Date(parseFloat(input) * 1000); config._d = new Date(parseFloat(input) * 1000);
@ -24951,12 +25020,25 @@ return /******/ (function(modules) { // webpackBootstrap
config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i]; config._a[i] = input[i] = (config._a[i] == null) ? (i === 2 ? 1 : 0) : config._a[i];
} }
// Check for 24:00:00.000
if (config._a[HOUR] === 24 &&
config._a[MINUTE] === 0 &&
config._a[SECOND] === 0 &&
config._a[MILLISECOND] === 0) {
config._nextDay = true;
config._a[HOUR] = 0;
}
config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input); config._d = (config._useUTC ? makeUTCDate : makeDate).apply(null, input);
// Apply timezone offset from input. The actual zone can be changed // Apply timezone offset from input. The actual zone can be changed
// with parseZone. // with parseZone.
if (config._tzm != null) { if (config._tzm != null) {
config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm); config._d.setUTCMinutes(config._d.getUTCMinutes() + config._tzm);
} }
if (config._nextDay) {
config._a[HOUR] = 24;
}
} }
function dateFromObject(config) { function dateFromObject(config) {
@ -24970,7 +25052,7 @@ return /******/ (function(modules) { // webpackBootstrap
config._a = [ config._a = [
normalizedInput.year, normalizedInput.year,
normalizedInput.month, normalizedInput.month,
normalizedInput.day,
normalizedInput.day || normalizedInput.date,
normalizedInput.hour, normalizedInput.hour,
normalizedInput.minute, normalizedInput.minute,
normalizedInput.second, normalizedInput.second,
@ -25043,6 +25125,10 @@ return /******/ (function(modules) { // webpackBootstrap
config._pf.unusedInput.push(string); config._pf.unusedInput.push(string);
} }
// clear _12h flag if hour is <= 12
if (config._pf.bigHour === true && config._a[HOUR] <= 12) {
config._pf.bigHour = undefined;
}
// handle am pm // handle am pm
if (config._isPm && config._a[HOUR] < 12) { if (config._isPm && config._a[HOUR] < 12) {
config._a[HOUR] += 12; config._a[HOUR] += 12;
@ -25051,7 +25137,6 @@ return /******/ (function(modules) { // webpackBootstrap
if (config._isPm === false && config._a[HOUR] === 12) { if (config._isPm === false && config._a[HOUR] === 12) {
config._a[HOUR] = 0; config._a[HOUR] = 0;
} }
dateFromConfig(config); dateFromConfig(config);
checkOverflow(config); checkOverflow(config);
} }
@ -25311,7 +25396,8 @@ return /******/ (function(modules) { // webpackBootstrap
function makeMoment(config) { function makeMoment(config) {
var input = config._i, var input = config._i,
format = config._f;
format = config._f,
res;
config._locale = config._locale || moment.localeData(config._l); config._locale = config._locale || moment.localeData(config._l);
@ -25335,7 +25421,14 @@ return /******/ (function(modules) { // webpackBootstrap
makeDateFromInput(config); makeDateFromInput(config);
} }
return new Moment(config);
res = new Moment(config);
if (res._nextDay) {
// Adding is smart enough around DST
res.add(1, 'd');
res._nextDay = undefined;
}
return res;
} }
moment = function (input, format, locale, strict) { moment = function (input, format, locale, strict) {
@ -25367,7 +25460,7 @@ return /******/ (function(modules) { // webpackBootstrap
'release. Please refer to ' + 'release. Please refer to ' +
'https://github.com/moment/moment/issues/1407 for more info.', 'https://github.com/moment/moment/issues/1407 for more info.',
function (config) { function (config) {
config._d = new Date(config._i);
config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
} }
); );
@ -25679,7 +25772,12 @@ return /******/ (function(modules) { // webpackBootstrap
toISOString : function () { toISOString : function () {
var m = moment(this).utc(); var m = moment(this).utc();
if (0 < m.year() && m.year() <= 9999) { if (0 < m.year() && m.year() <= 9999) {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
if ('function' === typeof Date.prototype.toISOString) {
// native implementation is ~50x faster, use it when we can
return this.toDate().toISOString();
} else {
return formatMoment(m, 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
}
} else { } else {
return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'); return formatMoment(m, 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]');
} }
@ -25798,7 +25896,7 @@ return /******/ (function(modules) { // webpackBootstrap
diff < 1 ? 'sameDay' : diff < 1 ? 'sameDay' :
diff < 2 ? 'nextDay' : diff < 2 ? 'nextDay' :
diff < 7 ? 'nextWeek' : 'sameElse'; diff < 7 ? 'nextWeek' : 'sameElse';
return this.format(this.localeData().calendar(format, this));
return this.format(this.localeData().calendar(format, this, moment(now)));
}, },
isLeapYear : function () { isLeapYear : function () {
@ -25867,36 +25965,45 @@ return /******/ (function(modules) { // webpackBootstrap
endOf: function (units) { endOf: function (units) {
units = normalizeUnits(units); units = normalizeUnits(units);
if (units === undefined || units === 'millisecond') {
return this;
}
return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms'); return this.startOf(units).add(1, (units === 'isoWeek' ? 'week' : units)).subtract(1, 'ms');
}, },
isAfter: function (input, units) { isAfter: function (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond'); units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this > +input; return +this > +input;
} else { } else {
return +this.clone().startOf(units) > +moment(input).startOf(units);
inputMs = moment.isMoment(input) ? +input : +moment(input);
return inputMs < +this.clone().startOf(units);
} }
}, },
isBefore: function (input, units) { isBefore: function (input, units) {
var inputMs;
units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond'); units = normalizeUnits(typeof units !== 'undefined' ? units : 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this < +input; return +this < +input;
} else { } else {
return +this.clone().startOf(units) < +moment(input).startOf(units);
inputMs = moment.isMoment(input) ? +input : +moment(input);
return +this.clone().endOf(units) < inputMs;
} }
}, },
isSame: function (input, units) { isSame: function (input, units) {
var inputMs;
units = normalizeUnits(units || 'millisecond'); units = normalizeUnits(units || 'millisecond');
if (units === 'millisecond') { if (units === 'millisecond') {
input = moment.isMoment(input) ? input : moment(input); input = moment.isMoment(input) ? input : moment(input);
return +this === +input; return +this === +input;
} else { } else {
return +this.clone().startOf(units) === +makeAs(input, this).startOf(units);
inputMs = +moment(input);
return +(this.clone().startOf(units)) <= inputMs && inputMs <= +(this.clone().endOf(units));
} }
}, },
@ -26073,7 +26180,7 @@ return /******/ (function(modules) { // webpackBootstrap
}, },
lang : deprecate( lang : deprecate(
'moment().lang() is deprecated. Use moment().localeData() instead.',
'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
function (key) { function (key) {
if (key === undefined) { if (key === undefined) {
return this.localeData(); return this.localeData();
@ -26294,7 +26401,7 @@ return /******/ (function(modules) { // webpackBootstrap
return units === 'month' ? months : months / 12; return units === 'month' ? months : months / 12;
} else { } else {
// handle milliseconds separately because of floating point math errors (issue #1867) // handle milliseconds separately because of floating point math errors (issue #1867)
days = this._days + yearsToDays(this._months / 12);
days = this._days + Math.round(yearsToDays(this._months / 12));
switch (units) { switch (units) {
case 'week': return days / 7 + this._milliseconds / 6048e5; case 'week': return days / 7 + this._milliseconds / 6048e5;
case 'day': return days + this._milliseconds / 864e5; case 'day': return days + this._milliseconds / 864e5;
@ -26396,6 +26503,7 @@ return /******/ (function(modules) { // webpackBootstrap
// Set default locale, other locale will inherit from English. // Set default locale, other locale will inherit from English.
moment.locale('en', { moment.locale('en', {
ordinalParse: /\d{1,2}(th|st|nd|rd)/,
ordinal : function (number) { ordinal : function (number) {
var b = number % 10, var b = number % 10,
output = (toInt(number % 100 / 10) === 1) ? 'th' : output = (toInt(number % 100 / 10) === 1) ? 'th' :
@ -33673,16 +33781,16 @@ return /******/ (function(modules) { // webpackBootstrap
/* 71 */ /* 71 */
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
module.exports = function(module) {
if(!module.webpackPolyfill) {
module.deprecate = function() {};
module.paths = [];
// module.parent = undefined by default
module.children = [];
module.webpackPolyfill = 1;
}
return module;
}
/***/ } /***/ }

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


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


+ 42
- 14
lib/network/Network.js View File

@ -212,7 +212,8 @@ function Network (container, data, options) {
hideNodesOnDrag: false, hideNodesOnDrag: false,
width : '100%', width : '100%',
height : '100%', height : '100%',
selectable: true
selectable: true,
pixelRatio:1
}; };
this.constants = util.extend({}, this.defaultOptions); this.constants = util.extend({}, this.defaultOptions);
@ -701,6 +702,8 @@ Network.prototype.setOptions = function (options) {
this.start(); this.start();
}; };
/** /**
* Create the main frame for the Network. * Create the main frame for the Network.
* This function is executed once when a Network object is created. The frame * This function is executed once when a Network object is created. The frame
@ -719,10 +722,15 @@ Network.prototype._create = function () {
this.frame.style.position = 'relative'; this.frame.style.position = 'relative';
this.frame.style.overflow = 'hidden'; this.frame.style.overflow = 'hidden';
// create the network canvas (HTML canvas element)
this.frame.canvas = document.createElement( 'canvas' );
//////////////////////////////////////////////////////////////////
this.frame.canvas = document.createElement("canvas");
this.frame.canvas.style.position = 'relative'; this.frame.canvas.style.position = 'relative';
this.frame.appendChild(this.frame.canvas); this.frame.appendChild(this.frame.canvas);
if (!this.frame.canvas.getContext) { if (!this.frame.canvas.getContext) {
var noCanvas = document.createElement( 'DIV' ); var noCanvas = document.createElement( 'DIV' );
noCanvas.style.color = 'red'; noCanvas.style.color = 'red';
@ -731,6 +739,23 @@ Network.prototype._create = function () {
noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; noCanvas.innerHTML = 'Error: your browser does not support HTML canvas';
this.frame.canvas.appendChild(noCanvas); this.frame.canvas.appendChild(noCanvas);
} }
else {
var ctx = this.frame.canvas.getContext("2d");
this.constants.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio ||
ctx.mozBackingStorePixelRatio ||
ctx.msBackingStorePixelRatio ||
ctx.oBackingStorePixelRatio ||
ctx.backingStorePixelRatio || 1);
this.frame.canvas.getContext("2d").setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
}
//////////////////////////////////////////////////////////////////
var me = this; var me = this;
this.drag = {}; this.drag = {};
@ -1317,8 +1342,8 @@ Network.prototype.setSize = function(width, height) {
this.frame.canvas.style.width = '100%'; this.frame.canvas.style.width = '100%';
this.frame.canvas.style.height = '100%'; this.frame.canvas.style.height = '100%';
this.frame.canvas.width = this.frame.canvas.clientWidth;
this.frame.canvas.height = this.frame.canvas.clientHeight;
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
this.constants.width = width; this.constants.width = width;
this.constants.height = height; this.constants.height = height;
@ -1329,18 +1354,18 @@ Network.prototype.setSize = function(width, height) {
// this would adapt the width of the canvas to the width from 100% if and only if // this would adapt the width of the canvas to the width from 100% if and only if
// there is a change. // there is a change.
if (this.frame.canvas.width != this.frame.canvas.clientWidth) {
this.frame.canvas.width = this.frame.canvas.clientWidth;
if (this.frame.canvas.width != this.frame.canvas.clientWidth * this.constants.pixelRatio) {
this.frame.canvas.width = this.frame.canvas.clientWidth * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
if (this.frame.canvas.height != this.frame.canvas.clientHeight) {
this.frame.canvas.height = this.frame.canvas.clientHeight;
if (this.frame.canvas.height != this.frame.canvas.clientHeight * this.constants.pixelRatio) {
this.frame.canvas.height = this.frame.canvas.clientHeight * this.constants.pixelRatio;
emitEvent = true; emitEvent = true;
} }
} }
if (emitEvent == true) { if (emitEvent == true) {
this.emit('resize', {width:this.frame.canvas.width,height:this.frame.canvas.height, oldWidth: oldWidth, oldHeight: oldHeight});
this.emit('resize', {width:this.frame.canvas.width * this.constants.pixelRatio,height:this.frame.canvas.height * this.constants.pixelRatio, oldWidth: oldWidth * this.constants.pixelRatio, oldHeight: oldHeight * this.constants.pixelRatio});
} }
}; };
@ -1689,9 +1714,12 @@ Network.prototype.redraw = function() {
*/ */
Network.prototype._redraw = function() { Network.prototype._redraw = function() {
var ctx = this.frame.canvas.getContext('2d'); var ctx = this.frame.canvas.getContext('2d');
ctx.setTransform(this.constants.pixelRatio, 0, 0, this.constants.pixelRatio, 0, 0);
// clear the canvas // clear the canvas
var w = this.frame.canvas.width;
var h = this.frame.canvas.height;
var w = this.frame.canvas.width * this.constants.pixelRatio;
var h = this.frame.canvas.height * this.constants.pixelRatio;
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
// set scaling and translation // set scaling and translation
@ -1704,8 +1732,8 @@ Network.prototype._redraw = function() {
"y": this._YconvertDOMtoCanvas(0) "y": this._YconvertDOMtoCanvas(0)
}; };
this.canvasBottomRight = { this.canvasBottomRight = {
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight)
"x": this._XconvertDOMtoCanvas(this.frame.canvas.clientWidth * this.constants.pixelRatio),
"y": this._YconvertDOMtoCanvas(this.frame.canvas.clientHeight * this.constants.pixelRatio)
}; };

Loading…
Cancel
Save