diff --git a/HISTORY.md b/HISTORY.md index e6e10ee6..4dfaf2a9 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -11,6 +11,7 @@ http://visjs.org ### Network - Fixed #1152, updating images now works. +- Fixed cleaning up of nodes. ## 2015-07-27, version 4.7.0 diff --git a/dist/vis.js b/dist/vis.js index 870731f2..0ae82114 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -493,17 +493,23 @@ return /******/ (function(modules) { // webpackBootstrap /** * Repaint the item */ - Item.prototype.redraw = function () {}; + Item.prototype.redraw = function () { + // should be implemented by the item + }; /** * Reposition the Item horizontally */ - Item.prototype.repositionX = function () {}; + Item.prototype.repositionX = function () { + // should be implemented by the item + }; /** * Reposition the Item vertically */ - Item.prototype.repositionY = function () {}; + Item.prototype.repositionY = function () { + // should be implemented by the item + }; /** * Repaint a delete button on the top right of the item when the item is selected @@ -662,12 +668,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = Item; - // should be implemented by the item - - // should be implemented by the item - - // should be implemented by the item - /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { @@ -3781,11 +3781,11 @@ return /******/ (function(modules) { // webpackBootstrap // object is an ASP date return new Date(Number(match[1])); // parse number } else { - return moment(object).toDate(); // parse string - } + return moment(object).toDate(); // parse string + } } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); - } + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); + } case 'Moment': if (exports.isNumber(object)) { @@ -3802,11 +3802,11 @@ return /******/ (function(modules) { // webpackBootstrap // object is an ASP date return moment(Number(match[1])); // parse number } else { - return moment(object); // parse string - } + return moment(object); // parse string + } } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); - } + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type Date'); + } case 'ISODate': if (exports.isNumber(object)) { @@ -3821,11 +3821,11 @@ return /******/ (function(modules) { // webpackBootstrap // object is an ASP date return new Date(Number(match[1])).toISOString(); // parse number } else { - return new Date(object).toISOString(); // parse string - } + return new Date(object).toISOString(); // parse string + } } else { - throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ISODate'); - } + throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ISODate'); + } case 'ASPDate': if (exports.isNumber(object)) { @@ -3839,8 +3839,8 @@ return /******/ (function(modules) { // webpackBootstrap // object is an ASP date value = new Date(Number(match[1])).valueOf(); // parse number } else { - value = new Date(object).valueOf(); // parse string - } + value = new Date(object).valueOf(); // parse string + } return '/Date(' + value + ')/'; } else { throw new Error('Cannot convert object of type ' + exports.getType(object) + ' to type ASPDate'); @@ -4072,13 +4072,13 @@ return /******/ (function(modules) { // webpackBootstrap if (element.addEventListener) { if (useCapture === undefined) useCapture = false; - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox } element.addEventListener(action, listener, useCapture); } else { - element.attachEvent('on' + action, listener); // IE browsers + element.attachEvent("on" + action, listener); // IE browsers } }; @@ -4094,14 +4094,14 @@ return /******/ (function(modules) { // webpackBootstrap // non-IE browsers if (useCapture === undefined) useCapture = false; - if (action === 'mousewheel' && navigator.userAgent.indexOf('Firefox') >= 0) { - action = 'DOMMouseScroll'; // For Firefox + if (action === "mousewheel" && navigator.userAgent.indexOf("Firefox") >= 0) { + action = "DOMMouseScroll"; // For Firefox } element.removeEventListener(action, listener, useCapture); } else { // IE browsers - element.detachEvent('on' + action, listener); + element.detachEvent("on" + action, listener); } }; @@ -4114,8 +4114,8 @@ return /******/ (function(modules) { // webpackBootstrap if (event.preventDefault) { event.preventDefault(); // non-IE browsers } else { - event.returnValue = false; // IE browsers - } + event.returnValue = false; // IE browsers + } }; /** @@ -4280,17 +4280,17 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} */ exports.overrideOpacity = function (color, opacity) { - if (color.indexOf('rgba') != -1) { + if (color.indexOf("rgba") != -1) { return color; - } else if (color.indexOf('rgb') != -1) { - var rgb = color.substr(color.indexOf('(') + 1).replace(')', '').split(','); - return 'rgba(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ',' + opacity + ')'; + } else if (color.indexOf("rgb") != -1) { + var rgb = color.substr(color.indexOf("(") + 1).replace(")", "").split(","); + return "rgba(" + rgb[0] + "," + rgb[1] + "," + rgb[2] + "," + opacity + ")"; } else { var rgb = exports.hexToRGB(color); if (rgb == null) { return color; } else { - return 'rgba(' + rgb.r + ',' + rgb.g + ',' + rgb.b + ',' + opacity + ')'; + return "rgba(" + rgb.r + "," + rgb.g + "," + rgb.b + "," + opacity + ")"; } } }; @@ -4304,7 +4304,7 @@ return /******/ (function(modules) { // webpackBootstrap * @constructor */ exports.RGBToHex = function (red, green, blue) { - return '#' + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1); + return "#" + ((1 << 24) + (red << 16) + (green << 8) + blue).toString(16).slice(1); }; /** @@ -4520,12 +4520,12 @@ return /******/ (function(modules) { // webpackBootstrap }; exports.isValidRGB = function (rgb) { - rgb = rgb.replace(' ', ''); + rgb = rgb.replace(" ", ""); var isOk = /rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)/i.test(rgb); return isOk; }; exports.isValidRGBA = function (rgba) { - rgba = rgba.replace(' ', ''); + rgba = rgba.replace(" ", ""); var isOk = /rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(.{1,3})\)/i.test(rgba); return isOk; }; @@ -4538,11 +4538,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} */ exports.selectiveBridgeObject = function (fields, referenceObject) { - if (typeof referenceObject == 'object') { + if (typeof referenceObject == "object") { var objectTo = Object.create(referenceObject); for (var i = 0; i < fields.length; i++) { if (referenceObject.hasOwnProperty(fields[i])) { - if (typeof referenceObject[fields[i]] == 'object') { + if (typeof referenceObject[fields[i]] == "object") { objectTo[fields[i]] = exports.bridgeObject(referenceObject[fields[i]]); } } @@ -4561,11 +4561,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} */ exports.bridgeObject = function (referenceObject) { - if (typeof referenceObject == 'object') { + if (typeof referenceObject == "object") { var objectTo = Object.create(referenceObject); for (var i in referenceObject) { if (referenceObject.hasOwnProperty(i)) { - if (typeof referenceObject[i] == 'object') { + if (typeof referenceObject[i] == "object") { objectTo[i] = exports.bridgeObject(referenceObject[i]); } } @@ -4777,13 +4777,13 @@ return /******/ (function(modules) { // webpackBootstrap /***/ function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {//! moment.js - //! version : 2.10.5 + //! version : 2.10.3 //! authors : Tim Wood, Iskren Chernev, Moment.js contributors //! license : MIT //! momentjs.com (function (global, factory) { - true ? module.exports = factory() : + true ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.moment = factory() }(this, function () { 'use strict'; @@ -4872,7 +4872,6 @@ return /******/ (function(modules) { // webpackBootstrap flags.overflow < 0 && !flags.empty && !flags.invalidMonth && - !flags.invalidWeekday && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated; @@ -4953,7 +4952,7 @@ return /******/ (function(modules) { // webpackBootstrap // Moment prototype object function Moment(config) { copyConfig(this, config); - this._d = new Date(config._d.getTime()); + this._d = new Date(+config._d); // Prevent infinite loop in case updateOffset creates new moment // objects. if (updateInProgress === false) { @@ -4967,20 +4966,16 @@ return /******/ (function(modules) { // webpackBootstrap return obj instanceof Moment || (obj != null && obj._isAMomentObject != null); } - function absFloor (number) { - if (number < 0) { - return Math.ceil(number); - } else { - return Math.floor(number); - } - } - function toInt(argumentForCoercion) { var coercedNumber = +argumentForCoercion, value = 0; if (coercedNumber !== 0 && isFinite(coercedNumber)) { - value = absFloor(coercedNumber); + if (coercedNumber >= 0) { + value = Math.floor(coercedNumber); + } else { + value = Math.ceil(coercedNumber); + } } return value; @@ -5078,7 +5073,9 @@ return /******/ (function(modules) { // webpackBootstrap function defineLocale (name, values) { if (values !== null) { values.abbr = name; - locales[name] = locales[name] || new Locale(); + if (!locales[name]) { + locales[name] = new Locale(); + } locales[name].set(values); // backwards compat for now: also set the locale @@ -5182,14 +5179,16 @@ return /******/ (function(modules) { // webpackBootstrap } function zeroFill(number, targetLength, forceSign) { - var absNumber = '' + Math.abs(number), - zerosToFill = targetLength - absNumber.length, + var output = '' + Math.abs(number), sign = number >= 0; - return (sign ? (forceSign ? '+' : '') : '-') + - Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; + + while (output.length < targetLength) { + output = '0' + output; + } + return (sign ? (forceSign ? '+' : '') : '-') + output; } - var 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,9}|x|X|zz?|ZZ?|.)/g; + var 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; var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; @@ -5257,7 +5256,10 @@ return /******/ (function(modules) { // webpackBootstrap } format = expandFormat(format, m.localeData()); - formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); + + if (!formatFunctions[format]) { + formatFunctions[format] = makeFormatFunction(format); + } return formatFunctions[format](m); } @@ -5301,15 +5303,8 @@ return /******/ (function(modules) { // webpackBootstrap var regexes = {}; - function isFunction (sth) { - // https://github.com/moment/moment/issues/2325 - return typeof sth === 'function' && - Object.prototype.toString.call(sth) === '[object Function]'; - } - - function addRegexToken (token, regex, strictRegex) { - regexes[token] = isFunction(regex) ? regex : function (isStrict) { + regexes[token] = typeof regex === 'function' ? regex : function (isStrict) { return (isStrict && strictRegex) ? strictRegex : regex; }; } @@ -5517,11 +5512,12 @@ return /******/ (function(modules) { // webpackBootstrap } function deprecate(msg, fn) { - var firstTime = true; + var firstTime = true, + msgWithStack = msg + '\n' + (new Error()).stack; return extend(function () { if (firstTime) { - warn(msg + '\n' + (new Error()).stack); + warn(msgWithStack); firstTime = false; } return fn.apply(this, arguments); @@ -5569,14 +5565,14 @@ return /******/ (function(modules) { // webpackBootstrap getParsingFlags(config).iso = true; for (i = 0, l = isoDates.length; i < l; i++) { if (isoDates[i][1].exec(string)) { - config._f = isoDates[i][0]; + // match[5] should be 'T' or undefined + config._f = isoDates[i][0] + (match[6] || ' '); break; } } for (i = 0, l = isoTimes.length; i < l; i++) { if (isoTimes[i][1].exec(string)) { - // match[6] should be 'T' or space - config._f += (match[6] || ' ') + isoTimes[i][0]; + config._f += isoTimes[i][0]; break; } } @@ -5655,10 +5651,7 @@ return /******/ (function(modules) { // webpackBootstrap addRegexToken('YYYYY', match1to6, match6); addRegexToken('YYYYYY', match1to6, match6); - addParseToken(['YYYYY', 'YYYYYY'], YEAR); - addParseToken('YYYY', function (input, array) { - array[YEAR] = input.length === 2 ? utils_hooks__hooks.parseTwoDigitYear(input) : toInt(input); - }); + addParseToken(['YYYY', 'YYYYY', 'YYYYYY'], YEAR); addParseToken('YY', function (input, array) { array[YEAR] = utils_hooks__hooks.parseTwoDigitYear(input); }); @@ -5785,18 +5778,18 @@ return /******/ (function(modules) { // webpackBootstrap //http://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday function dayOfYearFromWeeks(year, week, weekday, firstDayOfWeekOfYear, firstDayOfWeek) { - var week1Jan = 6 + firstDayOfWeek - firstDayOfWeekOfYear, janX = createUTCDate(year, 0, 1 + week1Jan), d = janX.getUTCDay(), dayOfYear; - if (d < firstDayOfWeek) { - d += 7; - } + var d = createUTCDate(year, 0, 1).getUTCDay(); + var daysToAdd; + var dayOfYear; - weekday = weekday != null ? 1 * weekday : firstDayOfWeek; - - dayOfYear = 1 + week1Jan + 7 * (week - 1) - d + weekday; + d = d === 0 ? 7 : d; + weekday = weekday != null ? weekday : firstDayOfWeek; + daysToAdd = firstDayOfWeek - d + (d > firstDayOfWeekOfYear ? 7 : 0) - (d < firstDayOfWeek ? 7 : 0); + dayOfYear = 7 * (week - 1) + (weekday - firstDayOfWeek) + daysToAdd + 1; return { - year: dayOfYear > 0 ? year : year - 1, - dayOfYear: dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear + year : dayOfYear > 0 ? year : year - 1, + dayOfYear : dayOfYear > 0 ? dayOfYear : daysInYear(year - 1) + dayOfYear }; } @@ -6082,19 +6075,9 @@ return /******/ (function(modules) { // webpackBootstrap } function createFromConfig (config) { - var res = new Moment(checkOverflow(prepareConfig(config))); - if (res._nextDay) { - // Adding is smart enough around DST - res.add(1, 'd'); - res._nextDay = undefined; - } - - return res; - } - - function prepareConfig (config) { var input = config._i, - format = config._f; + format = config._f, + res; config._locale = config._locale || locale_locales__getLocale(config._l); @@ -6118,7 +6101,14 @@ return /******/ (function(modules) { // webpackBootstrap configFromInput(config); } - return config; + res = new Moment(checkOverflow(config)); + if (res._nextDay) { + // Adding is smart enough around DST + res.add(1, 'd'); + res._nextDay = undefined; + } + + return res; } function configFromInput(config) { @@ -6198,7 +6188,7 @@ return /******/ (function(modules) { // webpackBootstrap } res = moments[0]; for (i = 1; i < moments.length; ++i) { - if (!moments[i].isValid() || moments[i][fn](res)) { + if (moments[i][fn](res)) { res = moments[i]; } } @@ -6310,6 +6300,7 @@ return /******/ (function(modules) { // webpackBootstrap } else { return local__createLocal(input).local(); } + return model._isUTC ? local__createLocal(input).zone(model._offset || 0) : local__createLocal(input).local(); } function getDateOffset (m) { @@ -6409,7 +6400,12 @@ return /******/ (function(modules) { // webpackBootstrap } function hasAlignedHourOffset (input) { - input = input ? local__createLocal(input).utcOffset() : 0; + if (!input) { + input = 0; + } + else { + input = local__createLocal(input).utcOffset(); + } return (this.utcOffset() - input) % 60 === 0; } @@ -6422,24 +6418,12 @@ return /******/ (function(modules) { // webpackBootstrap } function isDaylightSavingTimeShifted () { - if (typeof this._isDSTShifted !== 'undefined') { - return this._isDSTShifted; + if (this._a) { + var other = this._isUTC ? create_utc__createUTC(this._a) : local__createLocal(this._a); + return this.isValid() && compareArrays(this._a, other.toArray()) > 0; } - var c = {}; - - copyConfig(c, this); - c = prepareConfig(c); - - if (c._a) { - var other = c._isUTC ? create_utc__createUTC(c._a) : local__createLocal(c._a); - this._isDSTShifted = this.isValid() && - compareArrays(c._a, other.toArray()) > 0; - } else { - this._isDSTShifted = false; - } - - return this._isDSTShifted; + return false; } function isLocal () { @@ -6599,7 +6583,7 @@ return /******/ (function(modules) { // webpackBootstrap var add_subtract__add = createAdder(1, 'add'); var add_subtract__subtract = createAdder(-1, 'subtract'); - function moment_calendar__calendar (time, formats) { + function moment_calendar__calendar (time) { // We want to compare the start of today, vs this. // Getting start-of-today depends on whether we're local/utc/offset or not. var now = time || local__createLocal(), @@ -6611,7 +6595,7 @@ return /******/ (function(modules) { // webpackBootstrap diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; - return this.format(formats && formats[format] || this.localeData().calendar(format, this, local__createLocal(now))); + return this.format(this.localeData().calendar(format, this, local__createLocal(now))); } function clone () { @@ -6658,6 +6642,14 @@ return /******/ (function(modules) { // webpackBootstrap } } + function absFloor (number) { + if (number < 0) { + return Math.ceil(number); + } else { + return Math.floor(number); + } + } + function diff (input, units, asFloat) { var that = cloneWithOffset(input, this), zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4, @@ -6848,19 +6840,6 @@ return /******/ (function(modules) { // webpackBootstrap return [m.year(), m.month(), m.date(), m.hour(), m.minute(), m.second(), m.millisecond()]; } - function toObject () { - var m = this; - return { - years: m.year(), - months: m.month(), - date: m.date(), - hours: m.hours(), - minutes: m.minutes(), - seconds: m.seconds(), - milliseconds: m.milliseconds() - }; - } - function moment_valid__isValid () { return valid__isValid(this); } @@ -7032,20 +7011,18 @@ return /******/ (function(modules) { // webpackBootstrap // HELPERS function parseWeekday(input, locale) { - if (typeof input !== 'string') { - return input; - } - - if (!isNaN(input)) { - return parseInt(input, 10); - } - - input = locale.weekdaysParse(input); - if (typeof input === 'number') { - return input; + if (typeof input === 'string') { + if (!isNaN(input)) { + input = parseInt(input, 10); + } + else { + input = locale.weekdaysParse(input); + if (typeof input !== 'number') { + return null; + } + } } - - return null; + return input; } // LOCALES @@ -7068,7 +7045,9 @@ return /******/ (function(modules) { // webpackBootstrap function localeWeekdaysParse (weekdayName) { var i, mom, regex; - this._weekdaysParse = this._weekdaysParse || []; + if (!this._weekdaysParse) { + this._weekdaysParse = []; + } for (i = 0; i < 7; i++) { // make the regex if we don't have it already @@ -7215,26 +7194,12 @@ return /******/ (function(modules) { // webpackBootstrap return ~~(this.millisecond() / 10); }); - addFormatToken(0, ['SSS', 3], 0, 'millisecond'); - addFormatToken(0, ['SSSS', 4], 0, function () { - return this.millisecond() * 10; - }); - addFormatToken(0, ['SSSSS', 5], 0, function () { - return this.millisecond() * 100; - }); - addFormatToken(0, ['SSSSSS', 6], 0, function () { - return this.millisecond() * 1000; - }); - addFormatToken(0, ['SSSSSSS', 7], 0, function () { - return this.millisecond() * 10000; - }); - addFormatToken(0, ['SSSSSSSS', 8], 0, function () { - return this.millisecond() * 100000; - }); - addFormatToken(0, ['SSSSSSSSS', 9], 0, function () { - return this.millisecond() * 1000000; - }); + function millisecond__milliseconds (token) { + addFormatToken(0, [token, 3], 0, 'millisecond'); + } + millisecond__milliseconds('SSS'); + millisecond__milliseconds('SSSS'); // ALIASES @@ -7245,19 +7210,11 @@ return /******/ (function(modules) { // webpackBootstrap addRegexToken('S', match1to3, match1); addRegexToken('SS', match1to3, match2); addRegexToken('SSS', match1to3, match3); - - var token; - for (token = 'SSSS'; token.length <= 9; token += 'S') { - addRegexToken(token, matchUnsigned); - } - - function parseMs(input, array) { + addRegexToken('SSSS', matchUnsigned); + addParseToken(['S', 'SS', 'SSS', 'SSSS'], function (input, array) { array[MILLISECOND] = toInt(('0.' + input) * 1000); - } + }); - for (token = 'S'; token.length <= 9; token += 'S') { - addParseToken(token, parseMs); - } // MOMENTS var getSetMillisecond = makeGetSet('Milliseconds', false); @@ -7304,7 +7261,6 @@ return /******/ (function(modules) { // webpackBootstrap momentPrototype__proto.startOf = startOf; momentPrototype__proto.subtract = add_subtract__subtract; momentPrototype__proto.toArray = toArray; - momentPrototype__proto.toObject = toObject; momentPrototype__proto.toDate = toDate; momentPrototype__proto.toISOString = moment_format__toISOString; momentPrototype__proto.toJSON = moment_format__toISOString; @@ -7404,23 +7360,19 @@ return /******/ (function(modules) { // webpackBootstrap LT : 'h:mm A', L : 'MM/DD/YYYY', LL : 'MMMM D, YYYY', - LLL : 'MMMM D, YYYY h:mm A', - LLLL : 'dddd, MMMM D, YYYY h:mm A' + LLL : 'MMMM D, YYYY LT', + LLLL : 'dddd, MMMM D, YYYY LT' }; function longDateFormat (key) { - var format = this._longDateFormat[key], - formatUpper = this._longDateFormat[key.toUpperCase()]; - - if (format || !formatUpper) { - return format; + var output = this._longDateFormat[key]; + if (!output && this._longDateFormat[key.toUpperCase()]) { + output = this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g, function (val) { + return val.slice(1); + }); + this._longDateFormat[key] = output; } - - this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function (val) { - return val.slice(1); - }); - - return this._longDateFormat[key]; + return output; } var defaultInvalidDate = 'Invalid date'; @@ -7629,29 +7581,12 @@ return /******/ (function(modules) { // webpackBootstrap return duration_add_subtract__addSubtract(this, input, value, -1); } - function absCeil (number) { - if (number < 0) { - return Math.floor(number); - } else { - return Math.ceil(number); - } - } - function bubble () { var milliseconds = this._milliseconds; var days = this._days; var months = this._months; var data = this._data; - var seconds, minutes, hours, years, monthsFromDays; - - // if we have a mix of positive and negative values, bubble down first - // check: https://github.com/moment/moment/issues/2166 - if (!((milliseconds >= 0 && days >= 0 && months >= 0) || - (milliseconds <= 0 && days <= 0 && months <= 0))) { - milliseconds += absCeil(monthsToDays(months) + days) * 864e5; - days = 0; - months = 0; - } + var seconds, minutes, hours, years = 0; // The following code bubbles up values, see the tests for // examples of what that means. @@ -7668,13 +7603,17 @@ return /******/ (function(modules) { // webpackBootstrap days += absFloor(hours / 24); - // convert days to months - monthsFromDays = absFloor(daysToMonths(days)); - months += monthsFromDays; - days -= absCeil(monthsToDays(monthsFromDays)); + // Accurately convert days to years, assume start from year 0. + years = absFloor(daysToYears(days)); + days -= absFloor(yearsToDays(years)); + + // 30 days to a month + // TODO (iskren): Use anchor date (like 1st Jan) to compute this. + months += absFloor(days / 30); + days %= 30; // 12 months -> 1 year - years = absFloor(months / 12); + years += absFloor(months / 12); months %= 12; data.days = days; @@ -7684,15 +7623,15 @@ return /******/ (function(modules) { // webpackBootstrap return this; } - function daysToMonths (days) { + function daysToYears (days) { // 400 years have 146097 days (taking into account leap year rules) - // 400 years have 12 months === 4800 - return days * 4800 / 146097; + return days * 400 / 146097; } - function monthsToDays (months) { - // the reverse of daysToMonths - return months * 146097 / 4800; + function yearsToDays (years) { + // years * 365 + absFloor(years / 4) - + // absFloor(years / 100) + absFloor(years / 400); + return years * 146097 / 400; } function as (units) { @@ -7704,11 +7643,11 @@ return /******/ (function(modules) { // webpackBootstrap if (units === 'month' || units === 'year') { days = this._days + milliseconds / 864e5; - months = this._months + daysToMonths(days); + months = this._months + daysToYears(days) * 12; return units === 'month' ? months : months / 12; } else { // handle milliseconds separately because of floating point math errors (issue #1867) - days = this._days + Math.round(monthsToDays(this._months)); + days = this._days + Math.round(yearsToDays(this._months / 12)); switch (units) { case 'week' : return days / 7 + milliseconds / 6048e5; case 'day' : return days + milliseconds / 864e5; @@ -7758,7 +7697,7 @@ return /******/ (function(modules) { // webpackBootstrap }; } - var milliseconds = makeGetter('milliseconds'); + var duration_get__milliseconds = makeGetter('milliseconds'); var seconds = makeGetter('seconds'); var minutes = makeGetter('minutes'); var hours = makeGetter('hours'); @@ -7836,36 +7775,13 @@ return /******/ (function(modules) { // webpackBootstrap var iso_string__abs = Math.abs; function iso_string__toISOString() { - // for ISO strings we do not use the normal bubbling rules: - // * milliseconds bubble up until they become hours - // * days do not bubble at all - // * months bubble up until they become years - // This is because there is no context-free conversion between hours and days - // (think of clock changes) - // and also not between days and months (28-31 days per month) - var seconds = iso_string__abs(this._milliseconds) / 1000; - var days = iso_string__abs(this._days); - var months = iso_string__abs(this._months); - var minutes, hours, years; - - // 3600 seconds -> 60 minutes -> 1 hour - minutes = absFloor(seconds / 60); - hours = absFloor(minutes / 60); - seconds %= 60; - minutes %= 60; - - // 12 months -> 1 year - years = absFloor(months / 12); - months %= 12; - - // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js - var Y = years; - var M = months; - var D = days; - var h = hours; - var m = minutes; - var s = seconds; + var Y = iso_string__abs(this.years()); + var M = iso_string__abs(this.months()); + var D = iso_string__abs(this.days()); + var h = iso_string__abs(this.hours()); + var m = iso_string__abs(this.minutes()); + var s = iso_string__abs(this.seconds() + this.milliseconds() / 1000); var total = this.asSeconds(); if (!total) { @@ -7902,7 +7818,7 @@ return /******/ (function(modules) { // webpackBootstrap duration_prototype__proto.valueOf = duration_as__valueOf; duration_prototype__proto._bubble = bubble; duration_prototype__proto.get = duration_get__get; - duration_prototype__proto.milliseconds = milliseconds; + duration_prototype__proto.milliseconds = duration_get__milliseconds; duration_prototype__proto.seconds = seconds; duration_prototype__proto.minutes = minutes; duration_prototype__proto.hours = hours; @@ -7940,7 +7856,7 @@ return /******/ (function(modules) { // webpackBootstrap // Side effect imports - utils_hooks__hooks.version = '2.10.5'; + utils_hooks__hooks.version = '2.10.3'; setHookCallback(local__createLocal); @@ -8355,21 +8271,21 @@ return /******/ (function(modules) { // webpackBootstrap var point; if (groupTemplate.style == 'circle') { point = exports.getSVGElement('circle', JSONcontainer, svgContainer); - point.setAttributeNS(null, 'cx', x); - point.setAttributeNS(null, 'cy', y); - point.setAttributeNS(null, 'r', 0.5 * groupTemplate.size); + point.setAttributeNS(null, "cx", x); + point.setAttributeNS(null, "cy", y); + point.setAttributeNS(null, "r", 0.5 * groupTemplate.size); } else { point = exports.getSVGElement('rect', JSONcontainer, svgContainer); - point.setAttributeNS(null, 'x', x - 0.5 * groupTemplate.size); - point.setAttributeNS(null, 'y', y - 0.5 * groupTemplate.size); - point.setAttributeNS(null, 'width', groupTemplate.size); - point.setAttributeNS(null, 'height', groupTemplate.size); + point.setAttributeNS(null, "x", x - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "y", y - 0.5 * groupTemplate.size); + point.setAttributeNS(null, "width", groupTemplate.size); + point.setAttributeNS(null, "height", groupTemplate.size); } if (groupTemplate.style !== undefined) { - point.setAttributeNS(null, 'style', groupTemplate.style); + point.setAttributeNS(null, "style", groupTemplate.style); } - point.setAttributeNS(null, 'class', groupTemplate.className + ' vis-point'); + point.setAttributeNS(null, "class", groupTemplate.className + " vis-point"); //handle label if (labelObj) { @@ -8386,10 +8302,10 @@ return /******/ (function(modules) { // webpackBootstrap } if (labelObj.className) { - label.setAttributeNS(null, 'class', labelObj.className + ' vis-label'); + label.setAttributeNS(null, "class", labelObj.className + " vis-label"); } - label.setAttributeNS(null, 'x', x); - label.setAttributeNS(null, 'y', y); + label.setAttributeNS(null, "x", x); + label.setAttributeNS(null, "y", y); } return point; @@ -8409,13 +8325,13 @@ return /******/ (function(modules) { // webpackBootstrap y -= height; } var rect = exports.getSVGElement('rect', JSONcontainer, svgContainer); - rect.setAttributeNS(null, 'x', x - 0.5 * width); - rect.setAttributeNS(null, 'y', y); - rect.setAttributeNS(null, 'width', width); - rect.setAttributeNS(null, 'height', height); - rect.setAttributeNS(null, 'class', className); + rect.setAttributeNS(null, "x", x - 0.5 * width); + rect.setAttributeNS(null, "y", y); + rect.setAttributeNS(null, "width", width); + rect.setAttributeNS(null, "height", height); + rect.setAttributeNS(null, "class", className); if (style) { - rect.setAttributeNS(null, 'style', style); + rect.setAttributeNS(null, "style", style); } } }; @@ -9045,8 +8961,8 @@ return /******/ (function(modules) { // webpackBootstrap // TODO: extend order by an Object {field:String, direction:String} // where direction can be 'asc' or 'desc' else { - throw new TypeError('Order must be a function or a string'); - } + throw new TypeError('Order must be a function or a string'); + } }; /** @@ -9822,7 +9738,9 @@ return /******/ (function(modules) { // webpackBootstrap if (this._ids[id]) { delete this._ids[id]; removed.push(id); - } else {} + } else { + // nothing interesting for me :-( + } } } @@ -9866,8 +9784,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = DataView; - // nothing interesting for me :-( - /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { @@ -10111,9 +10027,11 @@ return /******/ (function(modules) { // webpackBootstrap if (backgroundColor.fill !== undefined) fill = backgroundColor.fill; if (backgroundColor.stroke !== undefined) stroke = backgroundColor.stroke; if (backgroundColor.strokeWidth !== undefined) strokeWidth = backgroundColor.strokeWidth; - } else if (backgroundColor === undefined) {} else { - throw 'Unsupported type of backgroundColor'; - } + } else if (backgroundColor === undefined) { + // use use defaults + } else { + throw 'Unsupported type of backgroundColor'; + } this.frame.style.backgroundColor = fill; this.frame.style.borderColor = stroke; @@ -10819,9 +10737,9 @@ return /******/ (function(modules) { // webpackBootstrap widthMin = dotSize / 2; // px widthMax = dotSize / 2 + dotSize * 2; // Todo: put this in one function } else { - widthMin = 20; // px - widthMax = 20; // px - } + widthMin = 20; // px + widthMax = 20; // px + } var height = Math.max(this.frame.clientHeight * 0.25, 100); var top = this.margin; @@ -11357,9 +11275,9 @@ return /******/ (function(modules) { // webpackBootstrap strokeStyle = this.axisColor; // TODO: should be customizable } } else { - fillStyle = 'gray'; - strokeStyle = this.axisColor; - } + fillStyle = 'gray'; + strokeStyle = this.axisColor; + } ctx.lineWidth = this._getStrokeWidth(point); ctx.fillStyle = fillStyle; @@ -12114,8 +12032,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = Graph3d; - // use use defaults - /***/ }, /* 18 */ /***/ function(module, exports) { @@ -13634,7 +13550,10 @@ return /******/ (function(modules) { // webpackBootstrap var getEnd = function getEnd(item) { var end = item.data.end != undefined ? item.data.end : item.data.start; return util.convert(end, 'Date').valueOf(); - }; + } + + // calculate the date of the left side and right side of the items given + ; interval = max - min; // ms @@ -13642,8 +13561,6 @@ return /******/ (function(modules) { // webpackBootstrap interval = 10; } factor = interval / _this.props.center.width; - - // calculate the date of the left side and right side of the items given util.forEach(_this.itemSet.items, (function (item) { item.show(); @@ -14586,7 +14503,9 @@ return /******/ (function(modules) { // webpackBootstrap /** * Destroy the component. Cleanup DOM and event listeners */ - Component.prototype.destroy = function () {}; + Component.prototype.destroy = function () { + // should be implemented by the component + }; /** * Test whether the component is resized since the last time _isResized() was @@ -14605,8 +14524,6 @@ return /******/ (function(modules) { // webpackBootstrap module.exports = Component; - // should be implemented by the component - /***/ }, /* 29 */ /***/ function(module, exports) { @@ -14681,16 +14598,16 @@ return /******/ (function(modules) { // webpackBootstrap } startDate.dayOfYear(start.dayOfYear()); startDate.year(start.year()); - startDate.subtract(7, "days"); + startDate.subtract(7, 'days'); endDate.dayOfYear(start.dayOfYear()); endDate.year(start.year()); - endDate.subtract(7 - offset, "days"); + endDate.subtract(7 - offset, 'days'); - runUntil.add(1, "weeks"); + runUntil.add(1, 'weeks'); break; case "weekly": - var dayOffset = endDate.diff(startDate, "days"); + var dayOffset = endDate.diff(startDate, 'days'); var day = startDate.day(); // set the start date to the range.start @@ -14702,12 +14619,12 @@ return /******/ (function(modules) { // webpackBootstrap // force startDate.day(day); endDate.day(day); - endDate.add(dayOffset, "days"); + endDate.add(dayOffset, 'days'); - startDate.subtract(1, "weeks"); - endDate.subtract(1, "weeks"); + startDate.subtract(1, 'weeks'); + endDate.subtract(1, 'weeks'); - runUntil.add(1, "weeks"); + runUntil.add(1, 'weeks'); break; case "monthly": if (startDate.month() != endDate.month()) { @@ -14715,26 +14632,26 @@ return /******/ (function(modules) { // webpackBootstrap } startDate.month(start.month()); startDate.year(start.year()); - startDate.subtract(1, "months"); + startDate.subtract(1, 'months'); endDate.month(start.month()); endDate.year(start.year()); - endDate.subtract(1, "months"); - endDate.add(offset, "months"); + endDate.subtract(1, 'months'); + endDate.add(offset, 'months'); - runUntil.add(1, "months"); + runUntil.add(1, 'months'); break; case "yearly": if (startDate.year() != endDate.year()) { offset = 1; } startDate.year(start.year()); - startDate.subtract(1, "years"); + startDate.subtract(1, 'years'); endDate.year(start.year()); - endDate.subtract(1, "years"); - endDate.add(offset, "years"); + endDate.subtract(1, 'years'); + endDate.add(offset, 'years'); - runUntil.add(1, "years"); + runUntil.add(1, 'years'); break; default: console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); @@ -14744,20 +14661,20 @@ return /******/ (function(modules) { // webpackBootstrap body.hiddenDates.push({ start: startDate.valueOf(), end: endDate.valueOf() }); switch (hiddenDates[i].repeat) { case "daily": - startDate.add(1, "days"); - endDate.add(1, "days"); + startDate.add(1, 'days'); + endDate.add(1, 'days'); break; case "weekly": - startDate.add(1, "weeks"); - endDate.add(1, "weeks"); + startDate.add(1, 'weeks'); + endDate.add(1, 'weeks'); break; case "monthly": - startDate.add(1, "months"); - endDate.add(1, "months"); + startDate.add(1, 'months'); + endDate.add(1, 'months'); break; case "yearly": - startDate.add(1, "y"); - endDate.add(1, "y"); + startDate.add(1, 'y'); + endDate.add(1, 'y'); break; default: console.log("Wrong repeat format, allowed are: daily, weekly, monthly, yearly. Given:", hiddenDates[i].repeat); @@ -14804,14 +14721,14 @@ return /******/ (function(modules) { // webpackBootstrap } // j start inside i else if (hiddenDates[j].start >= hiddenDates[i].start && hiddenDates[j].start <= hiddenDates[i].end) { - hiddenDates[i].end = hiddenDates[j].end; - hiddenDates[j].remove = true; - } - // j end inside i - else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { - hiddenDates[i].start = hiddenDates[j].start; - hiddenDates[j].remove = true; - } + hiddenDates[i].end = hiddenDates[j].end; + hiddenDates[j].remove = true; + } + // j end inside i + else if (hiddenDates[j].end >= hiddenDates[i].start && hiddenDates[j].end <= hiddenDates[i].end) { + hiddenDates[i].start = hiddenDates[j].start; + hiddenDates[j].remove = true; + } } } } @@ -16009,7 +15926,7 @@ return /******/ (function(modules) { // webpackBootstrap if (newScrollTop != oldScrollTop) { this._redraw(); // TODO: this causes two redraws when dragging, the other is triggered by rangechange already - this.emit('verticalDrag'); + this.emit("verticalDrag"); } }; @@ -17594,25 +17511,25 @@ return /******/ (function(modules) { // webpackBootstrap } // if dragged group was move downwards everything above should have an offset else if (origOrder[curPos + orgOffset] == draggedId) { - orgOffset = 1; - continue; - } - // found a group (apart from dragged group) that has the wrong position -> switch with the - // group at the position where other one should be, fix index arrays and continue - else { - var slippedPosition = newOrder.indexOf(origOrder[curPos + orgOffset]); - var switchGroup = groupsData.get(newOrder[curPos + newOffset]); - var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]); - this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData); - groupsData.update(switchGroup); - groupsData.update(shouldBeGroup); - - var switchGroupId = newOrder[curPos + newOffset]; - newOrder[curPos + newOffset] = origOrder[curPos + orgOffset]; - newOrder[slippedPosition] = switchGroupId; - - curPos++; - } + orgOffset = 1; + continue; + } + // found a group (apart from dragged group) that has the wrong position -> switch with the + // group at the position where other one should be, fix index arrays and continue + else { + var slippedPosition = newOrder.indexOf(origOrder[curPos + orgOffset]); + var switchGroup = groupsData.get(newOrder[curPos + newOffset]); + var shouldBeGroup = groupsData.get(origOrder[curPos + orgOffset]); + this.options.groupOrderSwap(switchGroup, shouldBeGroup, groupsData); + groupsData.update(switchGroup); + groupsData.update(shouldBeGroup); + + var switchGroupId = newOrder[curPos + newOffset]; + newOrder[curPos + newOffset] = origOrder[curPos + orgOffset]; + newOrder[slippedPosition] = switchGroupId; + + curPos++; + } } } } @@ -17973,7 +17890,7 @@ return /******/ (function(modules) { // webpackBootstrap }; this.checkRangedItems = false; // needed to refresh the ranged items if the window is programatically changed with NO overlap. var me = this; - this.itemSet.body.emitter.on('checkRangedItems', function () { + this.itemSet.body.emitter.on("checkRangedItems", function () { me.checkRangedItems = true; }); @@ -18862,10 +18779,10 @@ return /******/ (function(modules) { // webpackBootstrap // a width which will not change when moving the Timeline // So no re-stacking needed, which is nicer for the eye; } else { - this.left = start; - this.width = boxWidth; - contentWidth = Math.min(end - start, this.props.content.width); - } + this.left = start; + this.width = boxWidth; + contentWidth = Math.min(end - start, this.props.content.width); + } this.dom.box.style.left = this.left + 'px'; this.dom.box.style.width = boxWidth + 'px'; @@ -18893,12 +18810,12 @@ return /******/ (function(modules) { // webpackBootstrap contentLeft = -contentWidth; // ensure it's not visible anymore } } else { - if (start < 0) { - contentLeft = -start; - } else { - contentLeft = 0; + if (start < 0) { + contentLeft = -start; + } else { + contentLeft = 0; + } } - } this.dom.content.style.left = contentLeft + 'px'; } }; @@ -19088,7 +19005,7 @@ return /******/ (function(modules) { // webpackBootstrap */ TimeStep.prototype.setRange = function (start, end, minimumStep) { if (!(start instanceof Date) || !(end instanceof Date)) { - throw 'No legal start or end date in method setRange'; + throw "No legal start or end date in method setRange"; } this._start = start != undefined ? this.moment(start.valueOf()) : new Date(); @@ -19130,7 +19047,7 @@ return /******/ (function(modules) { // webpackBootstrap this.current.seconds(0); case 'second': this.current.milliseconds(0); - //case 'millisecond': // nothing to do for milliseconds + //case 'millisecond': // nothing to do for milliseconds } if (this.step != 1) { @@ -19423,8 +19340,8 @@ return /******/ (function(modules) { // webpackBootstrap clone.add(1, 'month'); // important: first set Date to 1, after that change the month. } else { - clone.date(1); - } + clone.date(1); + } clone.hours(0); clone.minutes(0); @@ -20158,23 +20075,23 @@ return /******/ (function(modules) { // webpackBootstrap } // and when the orientation is bottom: else { - var newTop = this.parent.top; - var totalHeight = 0; - for (var subgroup in subgroups) { - if (subgroups.hasOwnProperty(subgroup)) { - if (subgroups[subgroup].visible == true) { - var newHeight = subgroups[subgroup].height + margin.item.vertical; - totalHeight += newHeight; - if (subgroups[subgroup].index > subgroupIndex) { - newTop += newHeight; + var newTop = this.parent.top; + var totalHeight = 0; + for (var subgroup in subgroups) { + if (subgroups.hasOwnProperty(subgroup)) { + if (subgroups[subgroup].visible == true) { + var newHeight = subgroups[subgroup].height + margin.item.vertical; + totalHeight += newHeight; + if (subgroups[subgroup].index > subgroupIndex) { + newTop += newHeight; + } } } } + height = this.parent.subgroups[itemSubgroup].height + margin.item.vertical; + this.dom.box.style.top = this.parent.height - totalHeight + newTop + 'px'; + this.dom.box.style.bottom = ''; } - height = this.parent.subgroups[itemSubgroup].height + margin.item.vertical; - this.dom.box.style.top = this.parent.height - totalHeight + newTop + 'px'; - this.dom.box.style.bottom = ''; - } } // and in the case of no subgroups: else { @@ -21471,10 +21388,6 @@ return /******/ (function(modules) { // webpackBootstrap var _ColorPicker = __webpack_require__(46); - var _ColorPicker2 = _interopRequireDefault(_ColorPicker); - - var util = __webpack_require__(7); - /** * The way this works is for all properties of this.possible options, you can supply the property name in any form to list the options. * Boolean options are recognised as Boolean @@ -21490,6 +21403,10 @@ return /******/ (function(modules) { // webpackBootstrap * @param pixelRatio | canvas pixel ratio */ + var _ColorPicker2 = _interopRequireDefault(_ColorPicker); + + var util = __webpack_require__(7); + var Configurator = (function () { function Configurator(parentModule, defaultContainer, configureOptions) { var pixelRatio = arguments.length <= 3 || arguments[3] === undefined ? 1 : arguments[3]; @@ -21517,15 +21434,15 @@ return /******/ (function(modules) { // webpackBootstrap this.wrapper = undefined; } + /** + * refresh all options. + * Because all modules parse their options by themselves, we just use their options. We copy them here. + * + * @param options + */ + _createClass(Configurator, [{ key: 'setOptions', - - /** - * refresh all options. - * Because all modules parse their options by themselves, we just use their options. We copy them here. - * - * @param options - */ value: function setOptions(options) { if (options !== undefined) { var enabled = true; @@ -21573,13 +21490,13 @@ return /******/ (function(modules) { // webpackBootstrap this._create(); } } - }, { - key: '_create', /** * Create all DOM elements * @private */ + }, { + key: '_create', value: function _create() { var _this = this; @@ -21643,13 +21560,13 @@ return /******/ (function(modules) { // webpackBootstrap this._push(); this.colorPicker.insertTo(this.container); } - }, { - key: '_push', /** * draw all DOM elements on the screen * @private */ + }, { + key: '_push', value: function _push() { this.wrapper = document.createElement('div'); this.wrapper.className = 'vis-network-configuration-wrapper'; @@ -21658,13 +21575,13 @@ return /******/ (function(modules) { // webpackBootstrap this.wrapper.appendChild(this.domElements[i]); } } - }, { - key: '_clean', /** * delete all DOM elements * @private */ + }, { + key: '_clean', value: function _clean() { for (var i = 0; i < this.domElements.length; i++) { this.wrapper.removeChild(this.domElements[i]); @@ -21676,8 +21593,6 @@ return /******/ (function(modules) { // webpackBootstrap } this.domElements = []; } - }, { - key: '_getValue', /** * get the value from the actualOptions if it exists @@ -21685,6 +21600,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} * @private */ + }, { + key: '_getValue', value: function _getValue(path) { var base = this.moduleOptions; for (var i = 0; i < path.length; i++) { @@ -21697,8 +21614,6 @@ return /******/ (function(modules) { // webpackBootstrap } return base; } - }, { - key: '_makeItem', /** * all option elements are wrapped in an item @@ -21706,6 +21621,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param domElements * @private */ + }, { + key: '_makeItem', value: function _makeItem(path) { var _arguments = arguments, _this2 = this; @@ -21728,22 +21645,20 @@ return /******/ (function(modules) { // webpackBootstrap })(); } } - }, { - key: '_makeHeader', /** * header for major subjects * @param name * @private */ + }, { + key: '_makeHeader', value: function _makeHeader(name) { var div = document.createElement('div'); div.className = 'vis-network-configuration header'; div.innerHTML = name; this._makeItem([], div); } - }, { - key: '_makeLabel', /** * make a label, if it is an object label, it gets different styling. @@ -21753,6 +21668,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {HTMLElement} * @private */ + }, { + key: '_makeLabel', value: function _makeLabel(name, path) { var objectLabel = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; @@ -21765,8 +21682,6 @@ return /******/ (function(modules) { // webpackBootstrap } return div; } - }, { - key: '_makeDropdown', /** * make a dropdown list for multiple possible string optoins @@ -21775,6 +21690,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_makeDropdown', value: function _makeDropdown(arr, value, path) { var select = document.createElement('select'); select.className = 'vis-network-configuration select'; @@ -21803,8 +21720,6 @@ return /******/ (function(modules) { // webpackBootstrap var label = this._makeLabel(path[path.length - 1], path); this._makeItem(path, label, select); } - }, { - key: '_makeRange', /** * make a range object for numeric options @@ -21813,6 +21728,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_makeRange', value: function _makeRange(arr, value, path) { var defaultValue = arr[0]; var min = arr[1]; @@ -21856,8 +21773,6 @@ return /******/ (function(modules) { // webpackBootstrap var label = this._makeLabel(path[path.length - 1], path); this._makeItem(path, label, range, input); } - }, { - key: '_makeCheckbox', /** * make a checkbox for boolean options. @@ -21866,6 +21781,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_makeCheckbox', value: function _makeCheckbox(defaultValue, value, path) { var checkbox = document.createElement('input'); checkbox.type = 'checkbox'; @@ -21892,8 +21809,6 @@ return /******/ (function(modules) { // webpackBootstrap var label = this._makeLabel(path[path.length - 1], path); this._makeItem(path, label, checkbox); } - }, { - key: '_makeTextInput', /** * make a text input field for string options. @@ -21902,6 +21817,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_makeTextInput', value: function _makeTextInput(defaultValue, value, path) { var checkbox = document.createElement('input'); checkbox.type = 'text'; @@ -21919,8 +21836,6 @@ return /******/ (function(modules) { // webpackBootstrap var label = this._makeLabel(path[path.length - 1], path); this._makeItem(path, label, checkbox); } - }, { - key: '_makeColorField', /** * make a color field with a color picker for color fields @@ -21929,6 +21844,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_makeColorField', value: function _makeColorField(arr, value, path) { var _this3 = this; @@ -21951,8 +21868,6 @@ return /******/ (function(modules) { // webpackBootstrap var label = this._makeLabel(path[path.length - 1], path); this._makeItem(path, label, div); } - }, { - key: '_showColorPicker', /** * used by the color buttons to call the color picker. @@ -21962,6 +21877,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_showColorPicker', value: function _showColorPicker(value, div, path) { var _this4 = this; @@ -21977,8 +21894,6 @@ return /******/ (function(modules) { // webpackBootstrap _this4._update(colorString, path); }); } - }, { - key: '_handleObject', /** * parse an object and draw the correct items @@ -21986,6 +21901,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_handleObject', value: function _handleObject(obj) { var path = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; var checkOnly = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; @@ -22056,8 +21973,6 @@ return /******/ (function(modules) { // webpackBootstrap } return visibleInSet; } - }, { - key: '_handleArray', /** * handle the array type of option @@ -22067,6 +21982,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_handleArray', value: function _handleArray(arr, value, path) { if (typeof arr[0] === 'string' && arr[0] === 'color') { this._makeColorField(arr, value, path); @@ -22085,8 +22002,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_update', /** * called to update the network with the new settings. @@ -22094,11 +22009,13 @@ return /******/ (function(modules) { // webpackBootstrap * @param path * @private */ + }, { + key: '_update', value: function _update(value, path) { var options = this._constructOptions(value, path); if (this.parent.body && this.parent.body.emitter && this.parent.body.emitter.emit) { - this.parent.body.emitter.emit('configChange', options); + this.parent.body.emitter.emit("configChange", options); } this.parent.setOptions(options); @@ -22192,13 +22109,13 @@ return /******/ (function(modules) { // webpackBootstrap this._create(); } + /** + * this inserts the colorPicker into a div from the DOM + * @param container + */ + _createClass(ColorPicker, [{ key: 'insertTo', - - /** - * this inserts the colorPicker into a div from the DOM - * @param container - */ value: function insertTo(container) { if (this.hammer !== undefined) { this.hammer.destroy(); @@ -22210,18 +22127,18 @@ return /******/ (function(modules) { // webpackBootstrap this._setSize(); } - }, { - key: 'setCallback', /** * the callback is executed on apply and save. Bind it to the application * @param callback */ + }, { + key: 'setCallback', value: function setCallback(callback) { if (typeof callback === 'function') { this.updateCallback = callback; } else { - throw new Error('Function attempted to set as colorPicker callback is not a function.'); + throw new Error("Function attempted to set as colorPicker callback is not a function."); } } }, { @@ -22232,8 +22149,6 @@ return /******/ (function(modules) { // webpackBootstrap return htmlColors[color]; } } - }, { - key: 'setColor', /** * Set the color of the colorPicker @@ -22247,6 +22162,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param color * @param setInitial */ + }, { + key: 'setColor', value: function setColor(color) { var setInitial = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; @@ -22285,19 +22202,19 @@ return /******/ (function(modules) { // webpackBootstrap // set color if (rgba === undefined) { - throw new Error('Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: ' + JSON.stringify(color)); + throw new Error("Unknown color passed to the colorPicker. Supported are strings: rgb, hex, rgba. Object: rgb ({r:r,g:g,b:b,[a:a]}). Supplied: " + JSON.stringify(color)); } else { this._setColor(rgba, setInitial); } } - }, { - key: 'show', /** * this shows the color picker at a location. The hue circle is constructed once and stored. * @param x * @param y */ + }, { + key: 'show', value: function show(x, y) { this.applied = false; this.frame.style.display = 'block'; @@ -22305,8 +22222,6 @@ return /******/ (function(modules) { // webpackBootstrap this.frame.style.left = x + 'px'; this._generateHueCircle(); } - }, { - key: '_hide', // ------------------------------------------ PRIVATE ----------------------------- // @@ -22316,6 +22231,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param storePrevious * @private */ + }, { + key: '_hide', value: function _hide() { var storePrevious = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; @@ -22330,46 +22247,44 @@ return /******/ (function(modules) { // webpackBootstrap this.frame.style.display = 'none'; } - }, { - key: '_save', /** * bound to the save button. Saves and hides. * @private */ + }, { + key: '_save', value: function _save() { this.updateCallback(this.color); this.applied = false; this._hide(); } - }, { - key: '_apply', /** * Bound to apply button. Saves but does not close. Is undone by the cancel button. * @private */ + }, { + key: '_apply', value: function _apply() { this.applied = true; this.updateCallback(this.color); this._updatePicker(this.color); } - }, { - key: '_loadLast', /** * load the color from the previous session. * @private */ + }, { + key: '_loadLast', value: function _loadLast() { if (this.previousColor !== undefined) { this.setColor(this.previousColor, false); } else { - alert('There is no last color to load...'); + alert("There is no last color to load..."); } } - }, { - key: '_setColor', /** * set the color, place the picker @@ -22377,6 +22292,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param setInitial * @private */ + }, { + key: '_setColor', value: function _setColor(rgba) { var setInitial = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; @@ -22398,26 +22315,26 @@ return /******/ (function(modules) { // webpackBootstrap this._updatePicker(rgba); } - }, { - key: '_setOpacity', /** * bound to opacity control * @param value * @private */ + }, { + key: '_setOpacity', value: function _setOpacity(value) { this.color.a = value / 100; this._updatePicker(this.color); } - }, { - key: '_setBrightness', /** * bound to brightness control * @param value * @private */ + }, { + key: '_setBrightness', value: function _setBrightness(value) { var hsv = util.RGBToHSV(this.color.r, this.color.g, this.color.b); hsv.v = value / 100; @@ -22426,14 +22343,14 @@ return /******/ (function(modules) { // webpackBootstrap this.color = rgba; this._updatePicker(); } - }, { - key: '_updatePicker', /** * update the colorpicker. A black circle overlays the hue circle to mimic the brightness decreasing. * @param rgba * @private */ + }, { + key: '_updatePicker', value: function _updatePicker() { var rgba = arguments.length <= 0 || arguments[0] === undefined ? this.color : arguments[0]; @@ -22460,13 +22377,13 @@ return /******/ (function(modules) { // webpackBootstrap this.initialColorDiv.style.backgroundColor = 'rgba(' + this.initialColor.r + ',' + this.initialColor.g + ',' + this.initialColor.b + ',' + this.initialColor.a + ')'; this.newColorDiv.style.backgroundColor = 'rgba(' + this.color.r + ',' + this.color.g + ',' + this.color.b + ',' + this.color.a + ')'; } - }, { - key: '_setSize', /** * used by create to set the size of the canvas. * @private */ + }, { + key: '_setSize', value: function _setSize() { this.colorPickerCanvas.style.width = '100%'; this.colorPickerCanvas.style.height = '100%'; @@ -22474,14 +22391,14 @@ return /******/ (function(modules) { // webpackBootstrap this.colorPickerCanvas.width = 289 * this.pixelRatio; this.colorPickerCanvas.height = 289 * this.pixelRatio; } - }, { - key: '_create', /** * create all dom elements * TODO: cleanup, lots of similar dom elements * @private */ + }, { + key: '_create', value: function _create() { this.frame = document.createElement('div'); this.frame.className = 'vis-color-picker'; @@ -22502,10 +22419,10 @@ return /******/ (function(modules) { // webpackBootstrap noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; this.colorPickerCanvas.appendChild(noCanvas); } else { - var ctx = this.colorPickerCanvas.getContext('2d'); + var ctx = this.colorPickerCanvas.getContext("2d"); this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); - this.colorPickerCanvas.getContext('2d').setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + this.colorPickerCanvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); } this.colorPickerDiv.className = 'vis-color'; @@ -22554,39 +22471,39 @@ return /******/ (function(modules) { // webpackBootstrap me._setBrightness(this.value); }; - this.brightnessLabel = document.createElement('div'); - this.brightnessLabel.className = 'vis-label vis-brightness'; + this.brightnessLabel = document.createElement("div"); + this.brightnessLabel.className = "vis-label vis-brightness"; this.brightnessLabel.innerHTML = 'brightness:'; - this.opacityLabel = document.createElement('div'); - this.opacityLabel.className = 'vis-label vis-opacity'; + this.opacityLabel = document.createElement("div"); + this.opacityLabel.className = "vis-label vis-opacity"; this.opacityLabel.innerHTML = 'opacity:'; - this.newColorDiv = document.createElement('div'); - this.newColorDiv.className = 'vis-new-color'; + this.newColorDiv = document.createElement("div"); + this.newColorDiv.className = "vis-new-color"; this.newColorDiv.innerHTML = 'new'; - this.initialColorDiv = document.createElement('div'); - this.initialColorDiv.className = 'vis-initial-color'; + this.initialColorDiv = document.createElement("div"); + this.initialColorDiv.className = "vis-initial-color"; this.initialColorDiv.innerHTML = 'initial'; - this.cancelButton = document.createElement('div'); - this.cancelButton.className = 'vis-button vis-cancel'; + this.cancelButton = document.createElement("div"); + this.cancelButton.className = "vis-button vis-cancel"; this.cancelButton.innerHTML = 'cancel'; this.cancelButton.onclick = this._hide.bind(this, false); - this.applyButton = document.createElement('div'); - this.applyButton.className = 'vis-button vis-apply'; + this.applyButton = document.createElement("div"); + this.applyButton.className = "vis-button vis-apply"; this.applyButton.innerHTML = 'apply'; this.applyButton.onclick = this._apply.bind(this); - this.saveButton = document.createElement('div'); - this.saveButton.className = 'vis-button vis-save'; + this.saveButton = document.createElement("div"); + this.saveButton.className = "vis-button vis-save"; this.saveButton.innerHTML = 'save'; this.saveButton.onclick = this._save.bind(this); - this.loadButton = document.createElement('div'); - this.loadButton.className = 'vis-button vis-load'; + this.loadButton = document.createElement("div"); + this.loadButton.className = "vis-button vis-load"; this.loadButton.innerHTML = 'load last'; this.loadButton.onclick = this._loadLast.bind(this); @@ -22604,13 +22521,13 @@ return /******/ (function(modules) { // webpackBootstrap this.frame.appendChild(this.saveButton); this.frame.appendChild(this.loadButton); } - }, { - key: '_bindHammer', /** * bind hammer to the color picker * @private */ + }, { + key: '_bindHammer', value: function _bindHammer() { var _this = this; @@ -22635,13 +22552,13 @@ return /******/ (function(modules) { // webpackBootstrap _this._moveSelector(event); }); } - }, { - key: '_generateHueCircle', /** * generate the hue circle. This is relatively heavy (200ms) and is done only once on the first time it is shown. * @private */ + }, { + key: '_generateHueCircle', value: function _generateHueCircle() { if (this.generated === false) { var ctx = this.colorPickerCanvas.getContext('2d'); @@ -22683,8 +22600,6 @@ return /******/ (function(modules) { // webpackBootstrap } this.generated = true; } - }, { - key: '_moveSelector', /** * move the selector. This is called by hammer functions. @@ -22692,6 +22607,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param event * @private */ + }, { + key: '_moveSelector', value: function _moveSelector(event) { var rect = this.colorPickerDiv.getBoundingClientRect(); var left = event.center.x - rect.left; @@ -22763,15 +22680,15 @@ return /******/ (function(modules) { // webpackBootstrap _classCallCheck(this, Validator); } + /** + * Main function to be called + * @param options + * @param subObject + * @returns {boolean} + */ + _createClass(Validator, null, [{ key: 'validate', - - /** - * Main function to be called - * @param options - * @param subObject - * @returns {boolean} - */ value: function validate(options, referenceOptions, subObject) { errorFound = false; allOptions = referenceOptions; @@ -22782,8 +22699,6 @@ return /******/ (function(modules) { // webpackBootstrap Validator.parse(options, usedOptions, []); return errorFound; } - }, { - key: 'parse', /** * Will traverse an object recursively and check every value @@ -22791,6 +22706,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param referenceOptions * @param path */ + }, { + key: 'parse', value: function parse(options, referenceOptions, path) { for (var option in options) { if (options.hasOwnProperty(option)) { @@ -22798,8 +22715,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'check', /** * Check every value. If the value is an object, call the parse function on that object. @@ -22808,6 +22723,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param referenceOptions * @param path */ + }, { + key: 'check', value: function check(option, options, referenceOptions, path) { if (referenceOptions[option] === undefined && referenceOptions.__any__ === undefined) { Validator.getSuggestion(option, referenceOptions, path); @@ -22829,8 +22746,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'checkFields', /** * @@ -22841,6 +22756,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {String} refOptionType | This is the type object from the reference options * @param {Array} path | where in the object is the option */ + }, { + key: 'checkFields', value: function checkFields(option, options, referenceOptions, referenceOption, refOptionObj, path) { var optionType = Validator.getType(options[option]); var refOptionType = refOptionObj[optionType]; @@ -22850,11 +22767,11 @@ return /******/ (function(modules) { // webpackBootstrap if (refOptionType.indexOf(options[option]) === -1) { console.log('%cInvalid option detected in "' + option + '".' + ' Allowed values are:' + Validator.print(refOptionType) + ' not "' + options[option] + '". ' + Validator.printLocation(path, option), printStyle); errorFound = true; - } else if (optionType === 'object' && referenceOption !== '__any__') { + } else if (optionType === 'object' && referenceOption !== "__any__") { path = util.copyAndExtendArray(path, option); Validator.parse(options[option], referenceOptions[referenceOption], path); } - } else if (optionType === 'object' && referenceOption !== '__any__') { + } else if (optionType === 'object' && referenceOption !== "__any__") { path = util.copyAndExtendArray(path, option); Validator.parse(options[option], referenceOptions[referenceOption], path); } @@ -22927,8 +22844,6 @@ return /******/ (function(modules) { // webpackBootstrap errorFound = true; } - }, { - key: 'findInOptions', /** * traverse the options in search for a match. @@ -22938,6 +22853,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param recursive * @returns {{closestMatch: string, path: Array, distance: number}} */ + }, { + key: 'findInOptions', value: function findInOptions(option, options, path) { var recursive = arguments.length <= 3 || arguments[3] === undefined ? false : arguments[3]; @@ -22997,10 +22914,8 @@ return /******/ (function(modules) { // webpackBootstrap }, { key: 'print', value: function print(options) { - return JSON.stringify(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, '').replace(/(\,)/g, ', '); + return JSON.stringify(options).replace(/(\")|(\[)|(\])|(,"__type__")/g, "").replace(/(\,)/g, ', '); } - }, { - key: 'levenshteinDistance', // Compute the edit distance between the two given strings // http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance#JavaScript @@ -23010,6 +22925,8 @@ return /******/ (function(modules) { // webpackBootstrap The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + }, { + key: 'levenshteinDistance', value: function levenshteinDistance(a, b) { if (a.length === 0) return b.length; if (b.length === 0) return a.length; @@ -23504,7 +23421,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.linegraph.groups[groupId] !== undefined) { return this.linegraph.groups[groupId].getLegend(width, height); } else { - return 'cannot find group:' + groupId; + return "cannot find group:" + groupId; } }; @@ -23821,7 +23738,7 @@ return /******/ (function(modules) { // webpackBootstrap this.updateSVGheight = true; this.updateSVGheightOnResize = true; } else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) { - if (parseInt((options.graphHeight + '').replace('px', '')) < this.body.domProps.centerContainer.height) { + if (parseInt((options.graphHeight + '').replace("px", '')) < this.body.domProps.centerContainer.height) { this.updateSVGheight = true; } } @@ -24175,7 +24092,7 @@ return /******/ (function(modules) { // webpackBootstrap this.svg.style.left = util.option.asSize(-this.props.width); // if the height of the graph is set as proportional, change the height of the svg - if ((this.options.height + '').indexOf('%') != -1 || this.updateSVGheightOnResize == true) { + if ((this.options.height + '').indexOf("%") != -1 || this.updateSVGheightOnResize == true) { this.updateSVGheight = true; } } @@ -24267,7 +24184,7 @@ return /******/ (function(modules) { // webpackBootstrap return true; } else { if (this.COUNTER > MAX_CYCLES) { - console.log('WARNING: there may be an infinite loop in the _updateGraph emitter cycle.'); + console.log("WARNING: there may be an infinite loop in the _updateGraph emitter cycle."); } this.COUNTER = 0; this.abortedGraphUpdate = false; @@ -24666,7 +24583,7 @@ return /******/ (function(modules) { // webpackBootstrap this.conversionFactor = 1; this.setOptions(options); - this.width = Number(('' + this.options.width).replace('px', '')); + this.width = Number(('' + this.options.width).replace("px", "")); this.minWidth = this.width; this.height = this.linegraphSVG.offsetHeight; this.hidden = false; @@ -24687,7 +24604,7 @@ return /******/ (function(modules) { // webpackBootstrap this._create(); var me = this; - this.body.emitter.on('verticalDrag', function () { + this.body.emitter.on("verticalDrag", function () { me.dom.lineContainer.style.top = me.body.domProps.scrollTop + 'px'; }); } @@ -24721,7 +24638,7 @@ return /******/ (function(modules) { // webpackBootstrap var fields = ['orientation', 'showMinorLabels', 'showMajorLabels', 'icons', 'majorLinesOffset', 'minorLinesOffset', 'labelOffsetX', 'labelOffsetY', 'iconWidth', 'width', 'visible', 'left', 'right', 'alignZeros']; util.selectiveExtend(fields, this.options, options); - this.minWidth = Number(('' + this.options.width).replace('px', '')); + this.minWidth = Number(('' + this.options.width).replace("px", "")); if (redraw === true && this.dom.frame) { this.hide(); @@ -24744,12 +24661,12 @@ return /******/ (function(modules) { // webpackBootstrap this.dom.lineContainer.style.position = 'relative'; // create svg element for graph drawing. - this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); - this.svg.style.position = 'absolute'; + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); + this.svg.style.position = "absolute"; this.svg.style.top = '0px'; this.svg.style.height = '100%'; this.svg.style.width = '100%'; - this.svg.style.display = 'block'; + this.svg.style.display = "block"; this.dom.frame.appendChild(this.svg); }; @@ -24863,11 +24780,11 @@ return /******/ (function(modules) { // webpackBootstrap this.hide(); } else { this.show(); - this.height = Number(this.linegraphSVG.style.height.replace('px', '')); + this.height = Number(this.linegraphSVG.style.height.replace("px", "")); // svg offsetheight did not work in firefox and explorer... this.dom.lineContainer.style.height = this.height + 'px'; - this.width = this.options.visible === true ? Number(('' + this.options.width).replace('px', '')) : 0; + this.width = this.options.visible === true ? Number(('' + this.options.width).replace("px", "")) : 0; var props = this.props; var frame = this.dom.frame; @@ -24897,7 +24814,7 @@ return /******/ (function(modules) { // webpackBootstrap frame.style.left = '0'; frame.style.bottom = ''; frame.style.width = this.width + 'px'; - frame.style.height = this.height + 'px'; + frame.style.height = this.height + "px"; this.props.width = this.body.domProps.left.width; this.props.height = this.body.domProps.left.height; } else { @@ -24906,7 +24823,7 @@ return /******/ (function(modules) { // webpackBootstrap frame.style.bottom = '0'; frame.style.left = '0'; frame.style.width = this.width + 'px'; - frame.style.height = this.height + 'px'; + frame.style.height = this.height + "px"; this.props.width = this.body.domProps.right.width; this.props.height = this.body.domProps.right.height; } @@ -25030,7 +24947,7 @@ return /******/ (function(modules) { // webpackBootstrap // this will resize the yAxis to accommodate the labels. if (this.maxLabelSize > this.width - offset && this.options.visible === true) { this.width = this.maxLabelSize + offset; - this.options.width = this.width + 'px'; + this.options.width = this.width + "px"; DOMutil.cleanupElements(this.DOMelements.lines); DOMutil.cleanupElements(this.DOMelements.labels); this.redraw(); @@ -25038,17 +24955,17 @@ return /******/ (function(modules) { // webpackBootstrap } // this will resize the yAxis if it is too big for the labels. else if (this.maxLabelSize < this.width - offset && this.options.visible === true && this.width > this.minWidth) { - this.width = Math.max(this.minWidth, this.maxLabelSize + offset); - this.options.width = this.width + 'px'; - DOMutil.cleanupElements(this.DOMelements.lines); - DOMutil.cleanupElements(this.DOMelements.labels); - this.redraw(); - resized = true; - } else { - DOMutil.cleanupElements(this.DOMelements.lines); - DOMutil.cleanupElements(this.DOMelements.labels); - resized = false; - } + this.width = Math.max(this.minWidth, this.maxLabelSize + offset); + this.options.width = this.width + "px"; + DOMutil.cleanupElements(this.DOMelements.lines); + DOMutil.cleanupElements(this.DOMelements.labels); + this.redraw(); + resized = true; + } else { + DOMutil.cleanupElements(this.DOMelements.lines); + DOMutil.cleanupElements(this.DOMelements.labels); + resized = false; + } return resized; }; @@ -25079,10 +24996,10 @@ return /******/ (function(modules) { // webpackBootstrap label.innerHTML = text; if (orientation === 'left') { label.style.left = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = 'right'; + label.style.textAlign = "right"; } else { label.style.right = '-' + this.options.labelOffsetX + 'px'; - label.style.textAlign = 'left'; + label.style.textAlign = "left"; } label.style.top = y - 0.5 * characterHeight + this.options.labelOffsetY + 'px'; @@ -25566,29 +25483,29 @@ return /******/ (function(modules) { // webpackBootstrap var fillHeight = iconHeight * 0.5; var path, fillPath; - var outline = DOMutil.getSVGElement('rect', JSONcontainer, SVGcontainer); - outline.setAttributeNS(null, 'x', x); - outline.setAttributeNS(null, 'y', y - fillHeight); - outline.setAttributeNS(null, 'width', iconWidth); - outline.setAttributeNS(null, 'height', 2 * fillHeight); - outline.setAttributeNS(null, 'class', 'vis-outline'); + var outline = DOMutil.getSVGElement("rect", JSONcontainer, SVGcontainer); + outline.setAttributeNS(null, "x", x); + outline.setAttributeNS(null, "y", y - fillHeight); + outline.setAttributeNS(null, "width", iconWidth); + outline.setAttributeNS(null, "height", 2 * fillHeight); + outline.setAttributeNS(null, "class", "vis-outline"); if (this.options.style == 'line') { - path = DOMutil.getSVGElement('path', JSONcontainer, SVGcontainer); - path.setAttributeNS(null, 'class', this.className); + path = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); + path.setAttributeNS(null, "class", this.className); if (this.style !== undefined) { - path.setAttributeNS(null, 'style', this.style); + path.setAttributeNS(null, "style", this.style); } - path.setAttributeNS(null, 'd', 'M' + x + ',' + y + ' L' + (x + iconWidth) + ',' + y + ''); + path.setAttributeNS(null, "d", "M" + x + "," + y + " L" + (x + iconWidth) + "," + y + ""); if (this.options.shaded.enabled == true) { - fillPath = DOMutil.getSVGElement('path', JSONcontainer, SVGcontainer); + fillPath = DOMutil.getSVGElement("path", JSONcontainer, SVGcontainer); if (this.options.shaded.orientation == 'top') { - fillPath.setAttributeNS(null, 'd', 'M' + x + ', ' + (y - fillHeight) + 'L' + x + ',' + y + ' L' + (x + iconWidth) + ',' + y + ' L' + (x + iconWidth) + ',' + (y - fillHeight)); + fillPath.setAttributeNS(null, "d", "M" + x + ", " + (y - fillHeight) + "L" + x + "," + y + " L" + (x + iconWidth) + "," + y + " L" + (x + iconWidth) + "," + (y - fillHeight)); } else { - fillPath.setAttributeNS(null, 'd', 'M' + x + ',' + y + ' ' + 'L' + x + ',' + (y + fillHeight) + ' ' + 'L' + (x + iconWidth) + ',' + (y + fillHeight) + 'L' + (x + iconWidth) + ',' + y); + fillPath.setAttributeNS(null, "d", "M" + x + "," + y + " " + "L" + x + "," + (y + fillHeight) + " " + "L" + (x + iconWidth) + "," + (y + fillHeight) + "L" + (x + iconWidth) + "," + y); } - fillPath.setAttributeNS(null, 'class', this.className + ' vis-icon-fill'); + fillPath.setAttributeNS(null, "class", this.className + " vis-icon-fill"); } if (this.options.drawPoints.enabled == true) { @@ -25619,7 +25536,7 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{icon: HTMLElement, label: (group.content|*|string), orientation: (.options.yAxisOrientation|*)}} */ GraphGroup.prototype.getLegend = function (iconWidth, iconHeight) { - var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + var svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); this.drawIcon(0, 0.5 * iconHeight, [], svg, iconWidth, iconHeight); return { icon: svg, label: this.content, orientation: this.options.yAxisOrientation }; }; @@ -25759,9 +25676,9 @@ return /******/ (function(modules) { // webpackBootstrap var path, d; var svgHeight = Number(framework.svg.style.height.replace('px', '')); path = DOMutil.getSVGElement('path', framework.svgElements, framework.svg); - path.setAttributeNS(null, 'class', group.className); + path.setAttributeNS(null, "class", group.className); if (group.style !== undefined) { - path.setAttributeNS(null, 'style', group.style); + path.setAttributeNS(null, "style", group.style); } // construct path from dataset @@ -26337,16 +26254,16 @@ return /******/ (function(modules) { // webpackBootstrap Legend.prototype._create = function () { this.dom.frame = document.createElement('div'); this.dom.frame.className = 'vis-legend'; - this.dom.frame.style.position = 'absolute'; - this.dom.frame.style.top = '10px'; - this.dom.frame.style.display = 'block'; + this.dom.frame.style.position = "absolute"; + this.dom.frame.style.top = "10px"; + this.dom.frame.style.display = "block"; this.dom.textArea = document.createElement('div'); this.dom.textArea.className = 'vis-legend-text'; - this.dom.textArea.style.position = 'relative'; - this.dom.textArea.style.top = '0px'; + this.dom.textArea.style.position = "relative"; + this.dom.textArea.style.top = "0px"; - this.svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'); + this.svg = document.createElementNS('http://www.w3.org/2000/svg', "svg"); this.svg.style.position = 'absolute'; this.svg.style.top = 0 + 'px'; this.svg.style.width = this.options.iconSize + 5 + 'px'; @@ -26402,16 +26319,16 @@ return /******/ (function(modules) { // webpackBootstrap this.show(); if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'bottom-left') { this.dom.frame.style.left = '4px'; - this.dom.frame.style.textAlign = 'left'; - this.dom.textArea.style.textAlign = 'left'; + this.dom.frame.style.textAlign = "left"; + this.dom.textArea.style.textAlign = "left"; this.dom.textArea.style.left = this.options.iconSize + 15 + 'px'; this.dom.textArea.style.right = ''; this.svg.style.left = 0 + 'px'; this.svg.style.right = ''; } else { this.dom.frame.style.right = '4px'; - this.dom.frame.style.textAlign = 'right'; - this.dom.textArea.style.textAlign = 'right'; + this.dom.frame.style.textAlign = "right"; + this.dom.textArea.style.textAlign = "right"; this.dom.textArea.style.right = this.options.iconSize + 15 + 'px'; this.dom.textArea.style.left = ''; this.svg.style.right = 0 + 'px'; @@ -26419,11 +26336,11 @@ return /******/ (function(modules) { // webpackBootstrap } if (this.options[this.side].position == 'top-left' || this.options[this.side].position == 'top-right') { - this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace('px', '')) + 'px'; + this.dom.frame.style.top = 4 - Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; this.dom.frame.style.bottom = ''; } else { var scrollableHeight = this.body.domProps.center.height - this.body.domProps.centerContainer.height; - this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace('px', '')) + 'px'; + this.dom.frame.style.bottom = 4 + scrollableHeight + Number(this.body.dom.center.style.top.replace("px", "")) + 'px'; this.dom.frame.style.top = ''; } @@ -26821,6 +26738,17 @@ return /******/ (function(modules) { // webpackBootstrap var _optionsJs = __webpack_require__(110); + /** + * @constructor Network + * Create a network visualization, displaying nodes and edges. + * + * @param {Element} container The DOM element in which the Network will + * be created. Normally a div element. + * @param {Object} data An object containing parameters + * {Array} nodes + * {Array} edges + * @param {Object} options Options + */ __webpack_require__(111); var Emitter = __webpack_require__(19); @@ -26834,17 +26762,6 @@ return /******/ (function(modules) { // webpackBootstrap var Activator = __webpack_require__(40); var locales = __webpack_require__(115); - /** - * @constructor Network - * Create a network visualization, displaying nodes and edges. - * - * @param {Element} container The DOM element in which the Network will - * be created. Normally a div element. - * @param {Object} data An object containing parameters - * {Array} nodes - * {Array} edges - * @param {Object} options Options - */ function Network(container, data, options) { var _this = this; @@ -26908,7 +26825,7 @@ return /******/ (function(modules) { // webpackBootstrap // setting up all modules this.images = new Images(function () { - return _this.body.emitter.emit('_requestRedraw'); + return _this.body.emitter.emit("_requestRedraw"); }); // object with images this.groups = new _modulesGroups2['default'](); // object with groups this.canvas = new _modulesCanvas2['default'](this.body); // DOM handler @@ -26973,7 +26890,7 @@ return /******/ (function(modules) { // webpackBootstrap // reload the settings of the nodes to apply changes in groups that are not referenced by pointer. if (options.groups !== undefined) { - this.body.emitter.emit('refreshNodes'); + this.body.emitter.emit("refreshNodes"); } // these two do not have options at the moment, here for completeness //this.view.setOptions(options.view); @@ -27014,7 +26931,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.activator === undefined) { this.activator = new Activator(this.canvas.frame); this.activator.on('change', function () { - _this2.body.emitter.emit('activate'); + _this2.body.emitter.emit("activate"); }); } } else { @@ -27022,15 +26939,15 @@ return /******/ (function(modules) { // webpackBootstrap this.activator.destroy(); delete this.activator; } - this.body.emitter.emit('activate'); + this.body.emitter.emit("activate"); } } else { - this.body.emitter.emit('activate'); + this.body.emitter.emit("activate"); } this.canvas.setSize(); // start the physics simulation. Can be safely called multiple times. - this.body.emitter.emit('startSimulation'); + this.body.emitter.emit("startSimulation"); } }; @@ -27068,23 +26985,23 @@ return /******/ (function(modules) { // webpackBootstrap var _this3 = this; // this event will trigger a rebuilding of the cache everything. Used when nodes or edges have been added or removed. - this.body.emitter.on('_dataChanged', function () { + this.body.emitter.on("_dataChanged", function () { // update shortcut lists _this3._updateVisibleIndices(); _this3.physics.updatePhysicsData(); - _this3.body.emitter.emit('_requestRedraw'); + _this3.body.emitter.emit("_requestRedraw"); // call the dataUpdated event because the only difference between the two is the updating of the indices - _this3.body.emitter.emit('_dataUpdated'); + _this3.body.emitter.emit("_dataUpdated"); }); // this is called when options of EXISTING nodes or edges have changed. - this.body.emitter.on('_dataUpdated', function () { + this.body.emitter.on("_dataUpdated", function () { // update values _this3._updateValueRange(_this3.body.nodes); _this3._updateValueRange(_this3.body.edges); // start simulation (can be called safely, even if already running) - _this3.body.emitter.emit('startSimulation'); - _this3.body.emitter.emit('_requestRedraw'); + _this3.body.emitter.emit("startSimulation"); + _this3.body.emitter.emit("_requestRedraw"); }); }; @@ -27100,8 +27017,8 @@ return /******/ (function(modules) { // webpackBootstrap */ Network.prototype.setData = function (data) { // reset the physics engine. - this.body.emitter.emit('resetPhysics'); - this.body.emitter.emit('_resetData'); + this.body.emitter.emit("resetPhysics"); + this.body.emitter.emit("_resetData"); // unselect all to ensure no selections from old data are carried over. this.selectionHandler.unselectAll(); @@ -27131,10 +27048,10 @@ return /******/ (function(modules) { // webpackBootstrap } // emit change in data - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); // find a stable position or start animating to a stable position - this.body.emitter.emit('initPhysics'); + this.body.emitter.emit("initPhysics"); }; /** @@ -27144,7 +27061,7 @@ return /******/ (function(modules) { // webpackBootstrap * network = null; */ Network.prototype.destroy = function () { - this.body.emitter.emit('destroy'); + this.body.emitter.emit("destroy"); // clear events this.body.emitter.off(); this.off(); @@ -27269,7 +27186,7 @@ return /******/ (function(modules) { // webpackBootstrap return this.manipulation.editNode.apply(this.manipulation, arguments); }; Network.prototype.editNodeMode = function () { - console.log('Depricated: Please use editNode instead of editNodeMode.');return this.manipulation.editNode.apply(this.manipulation, arguments); + console.log("Depricated: Please use editNode instead of editNodeMode.");return this.manipulation.editNode.apply(this.manipulation, arguments); }; Network.prototype.addEdgeMode = function () { return this.manipulation.addEdgeMode.apply(this.manipulation, arguments); @@ -27439,7 +27356,7 @@ return /******/ (function(modules) { // webpackBootstrap _createClass(Groups, [{ key: "setOptions", value: function setOptions(options) { - var optionFields = ["useDefaultGroups"]; + var optionFields = ['useDefaultGroups']; if (options !== undefined) { for (var groupName in options) { @@ -27452,18 +27369,16 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "clear", /** * Clear all groups */ + }, { + key: "clear", value: function clear() { this.groups = {}; this.groupsArray = []; } - }, { - key: "get", /** * get group options of a groupname. If groupname is not found, a new group @@ -27471,6 +27386,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {*} groupname Can be a number, string, Date, etc. * @return {Object} group The created group, containing all group options */ + }, { + key: "get", value: function get(groupname) { var group = this.groups[groupname]; if (group === undefined) { @@ -27493,8 +27410,6 @@ return /******/ (function(modules) { // webpackBootstrap return group; } - }, { - key: "add", /** * Add a custom group style @@ -27503,6 +27418,8 @@ return /******/ (function(modules) { // webpackBootstrap * backgroundColor, etc. * @return {Object} group The created group object */ + }, { + key: "add", value: function add(groupName, style) { this.groups[groupName] = style; this.groupsArray.push(groupName); @@ -27713,14 +27630,14 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'setData', /** * Set a data set with nodes for the network * @param {Array | DataSet | DataView} nodes The data containing the nodes. * @private */ + }, { + key: 'setData', value: function setData(nodes) { var _this3 = this; @@ -27764,17 +27681,17 @@ return /******/ (function(modules) { // webpackBootstrap } if (doNotEmit === false) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } } - }, { - key: 'add', /** * Add nodes * @param {Number[] | String[]} ids * @private */ + }, { + key: 'add', value: function add(ids) { var doNotEmit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; @@ -27791,17 +27708,17 @@ return /******/ (function(modules) { // webpackBootstrap this.layoutEngine.positionInitially(newNodes); if (doNotEmit === false) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } } - }, { - key: 'update', /** * Update existing nodes, or create them when not yet existing * @param {Number[] | String[]} ids * @private */ + }, { + key: 'update', value: function update(ids, changedData) { var nodes = this.body.nodes; var dataChanged = false; @@ -27820,19 +27737,19 @@ return /******/ (function(modules) { // webpackBootstrap } } if (dataChanged === true) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } else { - this.body.emitter.emit('_dataUpdated'); + this.body.emitter.emit("_dataUpdated"); } } - }, { - key: 'remove', /** * Remove existing nodes. If nodes do not exist, the method will just ignore it. * @param {Number[] | String[]} ids * @private */ + }, { + key: 'remove', value: function remove(ids) { var nodes = this.body.nodes; @@ -27841,16 +27758,16 @@ return /******/ (function(modules) { // webpackBootstrap delete nodes[id]; } - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } - }, { - key: 'create', /** * create a node * @param properties * @param constructorClass */ + }, { + key: 'create', value: function create(properties) { var constructorClass = arguments.length <= 1 || arguments[1] === undefined ? _componentsNode2['default'] : arguments[1]; @@ -27877,14 +27794,14 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'getPositions', /** * Returns the positions of the nodes. * @param ids --> optional, can be array of nodeIds, can be string * @returns {{}} */ + }, { + key: 'getPositions', value: function getPositions(ids) { var dataArray = {}; if (ids !== undefined) { @@ -27911,12 +27828,12 @@ return /******/ (function(modules) { // webpackBootstrap } return dataArray; } - }, { - key: 'storePositions', /** * Load the XY positions of the nodes into the dataset. */ + }, { + key: 'storePositions', value: function storePositions() { // todo: add support for clusters and hierarchical. var dataArray = []; @@ -27932,27 +27849,27 @@ return /******/ (function(modules) { // webpackBootstrap } dataset.update(dataArray); } - }, { - key: 'getBoundingBox', /** * get the bounding box of a node. * @param nodeId * @returns {j|*} */ + }, { + key: 'getBoundingBox', value: function getBoundingBox(nodeId) { if (this.body.nodes[nodeId] !== undefined) { return this.body.nodes[nodeId].shape.boundingBox; } } - }, { - key: 'getConnectedNodes', /** * Get the Ids of nodes connected to this node. * @param nodeId * @returns {Array} */ + }, { + key: 'getConnectedNodes', value: function getConnectedNodes(nodeId) { var nodeList = []; if (this.body.nodes[nodeId] !== undefined) { @@ -27977,14 +27894,14 @@ return /******/ (function(modules) { // webpackBootstrap } return nodeList; } - }, { - key: 'getConnectedEdges', /** * Get the ids of the edges connected to this node. * @param nodeId * @returns {*} */ + }, { + key: 'getConnectedEdges', value: function getConnectedEdges(nodeId) { var edgeList = []; if (this.body.nodes[nodeId] !== undefined) { @@ -27993,12 +27910,10 @@ return /******/ (function(modules) { // webpackBootstrap edgeList.push(node.edges[i].id); } } else { - console.log('NodeId provided for getConnectedEdges does not exist. Provided: ', nodeId); + console.log("NodeId provided for getConnectedEdges does not exist. Provided: ", nodeId); } return edgeList; } - }, { - key: 'moveNode', /** * Move a node. @@ -28006,6 +27921,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param Number x * @param Number y */ + }, { + key: 'moveNode', value: function moveNode(nodeId, x, y) { var _this4 = this; @@ -28013,10 +27930,10 @@ return /******/ (function(modules) { // webpackBootstrap this.body.nodes[nodeId].x = Number(x); this.body.nodes[nodeId].y = Number(y); setTimeout(function () { - _this4.body.emitter.emit('startSimulation'); + _this4.body.emitter.emit("startSimulation"); }, 0); } else { - console.log('Node id supplied to moveNode does not exist. Provided: ', nodeId); + console.log("Node id supplied to moveNode does not exist. Provided: ", nodeId); } } }]); @@ -28162,39 +28079,39 @@ return /******/ (function(modules) { // webpackBootstrap this.setOptions(options); } + /** + * Attach a edge to the node + * @param {Edge} edge + */ + _createClass(Node, [{ key: 'attachEdge', - - /** - * Attach a edge to the node - * @param {Edge} edge - */ value: function attachEdge(edge) { if (this.edges.indexOf(edge) === -1) { this.edges.push(edge); } } - }, { - key: 'detachEdge', /** * Detach a edge from the node * @param {Edge} edge */ + }, { + key: 'detachEdge', value: function detachEdge(edge) { var index = this.edges.indexOf(edge); if (index != -1) { this.edges.splice(index, 1); } } - }, { - key: 'setOptions', /** * Set or overwrite options for the node * @param {Object} options an object with options * @param {Object} constants and object with default, global options */ + }, { + key: 'setOptions', value: function setOptions(options) { var currentShape = this.options.shape; if (!options) { @@ -28206,7 +28123,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (this.id === undefined) { - throw 'Node must have an id'; + throw "Node must have an id"; } // set these options locally @@ -28248,7 +28165,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.imagelist) { this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); } else { - throw 'No imagelist provided'; + throw "No imagelist provided"; } } @@ -28260,6 +28177,13 @@ return /******/ (function(modules) { // webpackBootstrap } return false; } + + /** + * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. + * Static so it can also be used by the handler. + * @param parentOptions + * @param newOptions + */ }, { key: 'updateLabelModule', value: function updateLabelModule() { @@ -28328,50 +28252,48 @@ return /******/ (function(modules) { // webpackBootstrap } this._reset(); } - }, { - key: 'select', /** * select this node */ + }, { + key: 'select', value: function select() { this.selected = true; this._reset(); } - }, { - key: 'unselect', /** * unselect this node */ + }, { + key: 'unselect', value: function unselect() { this.selected = false; this._reset(); } - }, { - key: '_reset', /** * Reset the calculated size of the node, forces it to recalculate its size * @private */ + }, { + key: '_reset', value: function _reset() { this.shape.width = undefined; this.shape.height = undefined; } - }, { - key: 'getTitle', /** * get the title of this node. * @return {string} title The title of the node, or undefined when no title * has been set. */ + }, { + key: 'getTitle', value: function getTitle() { return this.options.title; } - }, { - key: 'distanceToBorder', /** * Calculate the distance to the border of the Node @@ -28379,41 +28301,41 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} angle Angle in radians * @returns {number} distance Distance to the border in pixels */ + }, { + key: 'distanceToBorder', value: function distanceToBorder(ctx, angle) { return this.shape.distanceToBorder(ctx, angle); } - }, { - key: 'isFixed', /** * Check if this node has a fixed x and y position * @return {boolean} true if fixed, false if not */ + }, { + key: 'isFixed', value: function isFixed() { return this.options.fixed.x && this.options.fixed.y; } - }, { - key: 'isSelected', /** * check if this node is selecte * @return {boolean} selected True if node is selected, else false */ + }, { + key: 'isSelected', value: function isSelected() { return this.selected; } - }, { - key: 'getValue', /** * Retrieve the value of the node. Can be undefined * @return {Number} value */ + }, { + key: 'getValue', value: function getValue() { return this.options.value; } - }, { - key: 'setValueRange', /** * Adjust the value range of the node. The node will adjust it's size @@ -28421,6 +28343,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} min * @param {Number} max */ + }, { + key: 'setValueRange', value: function setValueRange(min, max, total) { if (this.options.value !== undefined) { var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); @@ -28435,68 +28359,61 @@ return /******/ (function(modules) { // webpackBootstrap this.options.font.size = this.baseFontSize; } } - }, { - key: 'draw', /** * Draw this node in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ + }, { + key: 'draw', value: function draw(ctx) { this.shape.draw(ctx, this.x, this.y, this.selected, this.hover); } - }, { - key: 'updateBoundingBox', /** * Update the bounding box of the shape */ + }, { + key: 'updateBoundingBox', value: function updateBoundingBox(ctx) { this.shape.updateBoundingBox(this.x, this.y, ctx); } - }, { - key: 'resize', /** * Recalculate the size of this node in the given canvas * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ + }, { + key: 'resize', value: function resize(ctx) { this.shape.resize(ctx, this.selected); } - }, { - key: 'isOverlappingWith', /** * Check if this object is overlapping with the provided object * @param {Object} obj an object with parameters left, top, right, bottom * @return {boolean} True if location is located on node */ + }, { + key: 'isOverlappingWith', value: function isOverlappingWith(obj) { return this.shape.left < obj.right && this.shape.left + this.shape.width > obj.left && this.shape.top < obj.bottom && this.shape.top + this.shape.height > obj.top; } - }, { - key: 'isBoundingBoxOverlappingWith', /** * Check if this object is overlapping with the provided object * @param {Object} obj an object with parameters left, top, right, bottom * @return {boolean} True if location is located on node */ + }, { + key: 'isBoundingBoxOverlappingWith', value: function isBoundingBoxOverlappingWith(obj) { return this.shape.boundingBox.left < obj.right && this.shape.boundingBox.right > obj.left && this.shape.boundingBox.top < obj.bottom && this.shape.boundingBox.bottom > obj.top; } }], [{ key: 'parseOptions', - - /** - * This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. - * Static so it can also be used by the handler. - * @param parentOptions - * @param newOptions - */ value: function parseOptions(parentOptions, newOptions) { var allowDeletion = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; @@ -28629,16 +28546,16 @@ return /******/ (function(modules) { // webpackBootstrap // draw text this._drawText(ctx, selected, x, y, baseline); } - }, { - key: '_drawBackground', /** * Draws the label background * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_drawBackground', value: function _drawBackground(ctx) { - if (this.options.font.background !== undefined && this.options.font.background !== 'none') { + if (this.options.font.background !== undefined && this.options.font.background !== "none") { ctx.fillStyle = this.options.font.background; var lineMargin = 2; @@ -28659,8 +28576,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_drawText', /** * @@ -28669,6 +28584,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param baseline * @private */ + }, { + key: '_drawText', value: function _drawText(ctx, selected, x, y) { var baseline = arguments.length <= 4 || arguments[4] === undefined ? 'middle' : arguments[4]; @@ -28688,15 +28605,15 @@ return /******/ (function(modules) { // webpackBootstrap var fontColor = _getColor22[0]; var strokeColor = _getColor22[1]; + // configure context for drawing the text + var _setAlignment2 = this._setAlignment(ctx, x, yLine, baseline); var _setAlignment22 = _slicedToArray(_setAlignment2, 2); x = _setAlignment22[0]; yLine = _setAlignment22[1]; - - // configure context for drawing the text - ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + fontSize + 'px ' + this.options.font.face; + ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + fontSize + "px " + this.options.font.face; ctx.fillStyle = fontColor; ctx.textAlign = 'center'; @@ -28730,19 +28647,17 @@ return /******/ (function(modules) { // webpackBootstrap ctx.textBaseline = 'alphabetic'; yLine -= 2 * lineMargin; // distance from edge, required because we use alphabetic. Alphabetic has less difference between browsers } else if (this.options.font.align === 'bottom') { - ctx.textBaseline = 'hanging'; - yLine += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers - } else { - ctx.textBaseline = 'middle'; - } + ctx.textBaseline = 'hanging'; + yLine += 2 * lineMargin; // distance from edge, required because we use hanging. Hanging has less difference between browsers + } else { + ctx.textBaseline = 'middle'; + } } else { ctx.textBaseline = baseline; } return [x, yLine]; } - }, { - key: '_getColor', /** * fade in when relative scale is between threshold and threshold - 1. @@ -28752,6 +28667,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*[]} * @private */ + }, { + key: '_getColor', value: function _getColor(viewFontSize) { var fontColor = this.options.font.color || '#000000'; var strokeColor = this.options.font.strokeColor || '#ffffff'; @@ -28762,8 +28679,6 @@ return /******/ (function(modules) { // webpackBootstrap } return [fontColor, strokeColor]; } - }, { - key: 'getTextSize', /** * @@ -28771,6 +28686,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param selected * @returns {{width: number, height: number}} */ + }, { + key: 'getTextSize', value: function getTextSize(ctx) { var selected = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; @@ -28781,8 +28698,6 @@ return /******/ (function(modules) { // webpackBootstrap }; return size; } - }, { - key: 'calculateLabelSize', /** * @@ -28792,6 +28707,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param y * @param baseline */ + }, { + key: 'calculateLabelSize', value: function calculateLabelSize(ctx, selected) { var x = arguments.length <= 2 || arguments[2] === undefined ? 0 : arguments[2]; var y = arguments.length <= 3 || arguments[3] === undefined ? 0 : arguments[3]; @@ -28804,7 +28721,7 @@ return /******/ (function(modules) { // webpackBootstrap this.size.left = x - this.size.width * 0.5; this.size.top = y - this.size.height * 0.5; this.size.yLine = y + (1 - this.lineCount) * 0.5 * this.options.font.size; - if (baseline === 'hanging') { + if (baseline === "hanging") { this.size.top += 0.5 * this.options.font.size; this.size.top += 4; // distance from node, required because we use hanging. Hanging has less difference between browsers this.size.yLine += 4; // distance from node @@ -28812,8 +28729,6 @@ return /******/ (function(modules) { // webpackBootstrap this.labelDirty = false; } - }, { - key: '_processLabel', /** * This calculates the width as well as explodes the label string and calculates the amount of lines. @@ -28822,6 +28737,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_processLabel', value: function _processLabel(ctx, selected) { var width = 0; var lines = ['']; @@ -28829,7 +28746,7 @@ return /******/ (function(modules) { // webpackBootstrap if (this.options.label !== undefined) { lines = String(this.options.label).split('\n'); lineCount = lines.length; - ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + this.options.font.size + 'px ' + this.options.font.face; + ctx.font = (selected && this.options.labelHighlightBold ? 'bold ' : '') + this.options.font.size + "px " + this.options.font.face; width = ctx.measureText(lines[0]).width; for (var i = 1; i < lineCount; i++) { var lineWidth = ctx.measureText(lines[i]).width; @@ -28847,8 +28764,8 @@ return /******/ (function(modules) { // webpackBootstrap var allowDeletion = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; if (typeof newOptions.font === 'string') { - var newOptionsArray = newOptions.font.split(' '); - parentOptions.size = newOptionsArray[0].replace('px', ''); + var newOptionsArray = newOptions.font.split(" "); + parentOptions.size = newOptionsArray[0].replace("px", ''); parentOptions.face = newOptionsArray[1]; parentOptions.color = newOptionsArray[2]; } else if (typeof newOptions.font === 'object') { @@ -29047,7 +28964,7 @@ return /******/ (function(modules) { // webpackBootstrap } ctx.setLineDash(dashes); } else { - console.warn('setLineDash is not supported in this browser. The dashed borders cannot be used.'); + console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); this.options.shapeProperties.borderDashes = false; } } @@ -29059,7 +28976,7 @@ return /******/ (function(modules) { // webpackBootstrap if (ctx.setLineDash !== undefined) { ctx.setLineDash([0]); } else { - console.warn('setLineDash is not supported in this browser. The dashed borders cannot be used.'); + console.warn("setLineDash is not supported in this browser. The dashed borders cannot be used."); this.options.shapeProperties.borderDashes = false; } } @@ -29214,13 +29131,6 @@ return /******/ (function(modules) { // webpackBootstrap */ }, { key: '_resizeImage', - - /** - * This function resizes the image by the options size when the image has not yet loaded. If the image has loaded, we - * force the update of the size again. - * - * @private - */ value: function _resizeImage() { var force = false; if (!this.imageObj.width || !this.imageObj.height) { @@ -29978,12 +29888,12 @@ return /******/ (function(modules) { // webpackBootstrap var iconSize = Number(this.options.icon.size); if (this.options.icon.code !== undefined) { - ctx.font = (selected ? 'bold ' : '') + iconSize + 'px ' + this.options.icon.face; + ctx.font = (selected ? "bold " : "") + iconSize + "px " + this.options.icon.face; // draw icon - ctx.fillStyle = this.options.icon.color || 'black'; - ctx.textAlign = 'center'; - ctx.textBaseline = 'middle'; + ctx.fillStyle = this.options.icon.color || "black"; + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; // draw shadow if enabled this.enableShadow(ctx); @@ -30521,7 +30431,7 @@ return /******/ (function(modules) { // webpackBootstrap }, smooth: { enabled: true, - type: 'dynamic', + type: "dynamic", forceDirection: 'none', roundness: 0.5 }, @@ -30541,7 +30451,7 @@ return /******/ (function(modules) { // webpackBootstrap var _this2 = this; // this allows external modules to force all dynamic curves to turn static. - this.body.emitter.on('_forceDisableDynamicCurves', function (type) { + this.body.emitter.on("_forceDisableDynamicCurves", function (type) { if (type === 'dynamic') { type = 'continuous'; } @@ -30569,20 +30479,20 @@ return /******/ (function(modules) { // webpackBootstrap } } if (emitChange === true) { - _this2.body.emitter.emit('_dataChanged'); + _this2.body.emitter.emit("_dataChanged"); } }); // this is called when options of EXISTING nodes or edges have changed. - this.body.emitter.on('_dataUpdated', function () { + this.body.emitter.on("_dataUpdated", function () { _this2.reconnectEdges(); _this2.markAllEdgesAsDirty(); }); // refresh the edges. Used when reverting from hierarchical layout - this.body.emitter.on('refreshEdges', this.refresh.bind(this)); - this.body.emitter.on('refresh', this.refresh.bind(this)); - this.body.emitter.on('destroy', function () { + this.body.emitter.on("refreshEdges", this.refresh.bind(this)); + this.body.emitter.on("refresh", this.refresh.bind(this)); + this.body.emitter.on("destroy", function () { delete _this2.body.functions.createEdge; delete _this2.edgesListeners.add; delete _this2.edgesListeners.update; @@ -30629,8 +30539,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'setData', /** * Load edges by reading the data table @@ -30638,6 +30546,8 @@ return /******/ (function(modules) { // webpackBootstrap * @private * @private */ + }, { + key: 'setData', value: function setData(edges) { var _this3 = this; @@ -30680,17 +30590,17 @@ return /******/ (function(modules) { // webpackBootstrap } if (doNotEmit === false) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } } - }, { - key: 'add', /** * Add edges * @param {Number[] | String[]} ids * @private */ + }, { + key: 'add', value: function add(ids) { var doNotEmit = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; @@ -30705,22 +30615,22 @@ return /******/ (function(modules) { // webpackBootstrap oldEdge.disconnect(); } - var data = edgesData.get(id, { 'showInternalIds': true }); + var data = edgesData.get(id, { "showInternalIds": true }); edges[id] = this.create(data); } if (doNotEmit === false) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } } - }, { - key: 'update', /** * Update existing edges, or create them when not yet existing * @param {Number[] | String[]} ids * @private */ + }, { + key: 'update', value: function update(ids) { var edges = this.body.edges; var edgesData = this.body.data.edges; @@ -30742,19 +30652,19 @@ return /******/ (function(modules) { // webpackBootstrap } if (dataChanged === true) { - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } else { - this.body.emitter.emit('_dataUpdated'); + this.body.emitter.emit("_dataUpdated"); } } - }, { - key: 'remove', /** * Remove existing edges. Non existing ids will be ignored * @param {Number[] | String[]} ids * @private */ + }, { + key: 'remove', value: function remove(ids) { var edges = this.body.edges; for (var i = 0; i < ids.length; i++) { @@ -30767,7 +30677,7 @@ return /******/ (function(modules) { // webpackBootstrap } } - this.body.emitter.emit('_dataChanged'); + this.body.emitter.emit("_dataChanged"); } }, { key: 'refresh', @@ -30796,13 +30706,13 @@ return /******/ (function(modules) { // webpackBootstrap this.body.edges[edgeId].edgeType.colorDirty = true; } } - }, { - key: 'reconnectEdges', /** * Reconnect all edges * @private */ + }, { + key: 'reconnectEdges', value: function reconnectEdges() { var id; var nodes = this.body.nodes; @@ -30880,10 +30790,6 @@ return /******/ (function(modules) { // webpackBootstrap var _edgesStraightEdge = __webpack_require__(89); - var _edgesStraightEdge2 = _interopRequireDefault(_edgesStraightEdge); - - var util = __webpack_require__(7); - /** * @class Edge * @@ -30900,12 +30806,16 @@ return /******/ (function(modules) { // webpackBootstrap * example for the color */ + var _edgesStraightEdge2 = _interopRequireDefault(_edgesStraightEdge); + + var util = __webpack_require__(7); + var Edge = (function () { function Edge(options, body, globalOptions) { _classCallCheck(this, Edge); if (body === undefined) { - throw 'No body provided'; + throw "No body provided"; } this.options = util.bridgeObject(globalOptions); this.body = body; @@ -30934,14 +30844,14 @@ return /******/ (function(modules) { // webpackBootstrap this.setOptions(options); } + /** + * Set or overwrite options for the edge + * @param {Object} options an object with options + * @param doNotEmit + */ + _createClass(Edge, [{ key: 'setOptions', - - /** - * Set or overwrite options for the edge - * @param {Object} options an object with options - * @param doNotEmit - */ value: function setOptions(options) { if (!options) { return; @@ -30995,13 +30905,13 @@ return /******/ (function(modules) { // webpackBootstrap this.baseFontSize = this.labelModule.baseSize; } } - }, { - key: 'updateEdgeType', /** * update the edge type, set the options * @returns {boolean} */ + }, { + key: 'updateEdgeType', value: function updateEdgeType() { var dataChanged = false; var changeInType = true; @@ -31045,12 +30955,12 @@ return /******/ (function(modules) { // webpackBootstrap return dataChanged; } - }, { - key: 'connect', /** * Connect an edge to its nodes */ + }, { + key: 'connect', value: function connect() { this.disconnect(); @@ -31072,12 +30982,12 @@ return /******/ (function(modules) { // webpackBootstrap this.edgeType.connect(); } - }, { - key: 'disconnect', /** * Disconnect an edge from its nodes */ + }, { + key: 'disconnect', value: function disconnect() { if (this.from) { this.from.detachEdge(this); @@ -31090,39 +31000,37 @@ return /******/ (function(modules) { // webpackBootstrap this.connected = false; } - }, { - key: 'getTitle', /** * get the title of this edge. * @return {string} title The title of the edge, or undefined when no title * has been set. */ + }, { + key: 'getTitle', value: function getTitle() { return this.title; } - }, { - key: 'isSelected', /** * check if this node is selecte * @return {boolean} selected True if node is selected, else false */ + }, { + key: 'isSelected', value: function isSelected() { return this.selected; } - }, { - key: 'getValue', /** * Retrieve the value of the edge. Can be undefined * @return {Number} value */ + }, { + key: 'getValue', value: function getValue() { return this.options.value; } - }, { - key: 'setValueRange', /** * Adjust the value range of the edge. The edge will adjust it's width @@ -31131,6 +31039,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} max * @param total */ + }, { + key: 'setValueRange', value: function setValueRange(min, max, total) { if (this.options.value !== undefined) { var scale = this.options.scaling.customScalingFunction(min, max, total, this.options.value); @@ -31162,8 +31072,6 @@ return /******/ (function(modules) { // webpackBootstrap this.edgeType.selectionWidth = this.options.selectionWidth + this.options.width; } } - }, { - key: 'draw', /** * Redraw a edge @@ -31171,6 +31079,8 @@ return /******/ (function(modules) { // webpackBootstrap * The 2d context of a HTML canvas can be retrieved by canvas.getContext("2d"); * @param {CanvasRenderingContext2D} ctx */ + }, { + key: 'draw', value: function draw(ctx) { var via = this.edgeType.drawLine(ctx, this.selected, this.hover); this.drawArrows(ctx, via); @@ -31203,7 +31113,7 @@ return /******/ (function(modules) { // webpackBootstrap ctx.save(); // if the label has to be rotated: - if (this.options.font.align !== 'horizontal') { + if (this.options.font.align !== "horizontal") { this.labelModule.calculateLabelSize(ctx, selected, point.x, point.y); ctx.translate(point.x, this.labelModule.size.yLine); this._rotateForLabelAlignment(ctx); @@ -31229,14 +31139,14 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'isOverlappingWith', /** * Check if this object is overlapping with the provided object * @param {Object} obj an object with parameters left, top * @return {boolean} True if location is located on the edge */ + }, { + key: 'isOverlappingWith', value: function isOverlappingWith(obj) { if (this.connected) { var distMax = 10; @@ -31254,14 +31164,14 @@ return /******/ (function(modules) { // webpackBootstrap return false; } } - }, { - key: '_rotateForLabelAlignment', /** * Rotates the canvas so the text is most readable * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_rotateForLabelAlignment', value: function _rotateForLabelAlignment(ctx) { var dy = this.from.y - this.to.y; var dx = this.from.x - this.to.x; @@ -31274,8 +31184,6 @@ return /******/ (function(modules) { // webpackBootstrap ctx.rotate(angleInDegrees); } - }, { - key: '_pointOnCircle', /** * Get a point on a circle @@ -31286,6 +31194,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Object} point * @private */ + }, { + key: '_pointOnCircle', value: function _pointOnCircle(x, y, radius, percentage) { var angle = percentage * 2 * Math.PI; return { @@ -31303,13 +31213,13 @@ return /******/ (function(modules) { // webpackBootstrap value: function unselect() { this.selected = false; } - }, { - key: 'cleanup', /** * cleans all required things on delete * @returns {*} */ + }, { + key: 'cleanup', value: function cleanup() { return this.edgeType.cleanup(); } @@ -31351,13 +31261,13 @@ return /******/ (function(modules) { // webpackBootstrap if (newOptions.arrows !== undefined && newOptions.arrows !== null) { if (typeof newOptions.arrows === 'string') { var arrows = newOptions.arrows.toLowerCase(); - if (arrows.indexOf('to') != -1) { + if (arrows.indexOf("to") != -1) { parentOptions.arrows.to.enabled = true; } - if (arrows.indexOf('middle') != -1) { + if (arrows.indexOf("middle") != -1) { parentOptions.arrows.middle.enabled = true; } - if (arrows.indexOf('from') != -1) { + if (arrows.indexOf("from") != -1) { parentOptions.arrows.from.enabled = true; } } else if (typeof newOptions.arrows === 'object') { @@ -31365,7 +31275,7 @@ return /******/ (function(modules) { // webpackBootstrap util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'middle'); util.mergeOptions(parentOptions.arrows, newOptions.arrows, 'from'); } else { - throw new Error('The arrow newOptions can only be an object or a string. Refer to the documentation. You used:' + JSON.stringify(newOptions.arrows)); + throw new Error("The arrow newOptions can only be an object or a string. Refer to the documentation. You used:" + JSON.stringify(newOptions.arrows)); } } else if (allowDeletion === true && newOptions.arrows === null) { parentOptions.arrows = undefined; @@ -31452,14 +31362,14 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(BezierEdgeStatic.prototype), 'constructor', this).call(this, options, body, labelModule); } + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @private + */ + _createClass(BezierEdgeStatic, [{ key: '_line', - - /** - * Draw a line between two nodes - * @param {CanvasRenderingContext2D} ctx - * @private - */ value: function _line(ctx) { // draw a straight line ctx.beginPath(); @@ -31508,7 +31418,7 @@ return /******/ (function(modules) { // webpackBootstrap yVia = this.from.y + factor * dy; } } - if (type === 'discrete') { + if (type === "discrete") { xVia = dx < factor * dy ? this.from.x : xVia; } } else if (Math.abs(this.from.x - this.to.x) > Math.abs(this.from.y - this.to.y)) { @@ -31529,11 +31439,11 @@ return /******/ (function(modules) { // webpackBootstrap yVia = this.from.y + factor * dx; } } - if (type === 'discrete') { + if (type === "discrete") { yVia = dy < factor * dx ? this.from.y : yVia; } } - } else if (type === 'straightCross') { + } else if (type === "straightCross") { if (Math.abs(this.from.x - this.to.x) <= Math.abs(this.from.y - this.to.y)) { // up - down xVia = this.from.x; @@ -31651,8 +31561,6 @@ return /******/ (function(modules) { // webpackBootstrap // x3,y3 is the point return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via); } - }, { - key: 'getPoint', /** * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way @@ -31661,6 +31569,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @private */ + }, { + key: 'getPoint', value: function getPoint(percentage) { var via = arguments.length <= 1 || arguments[1] === undefined ? this._getViaCoordinates() : arguments[1]; @@ -31711,22 +31621,22 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(BezierEdgeBase.prototype), 'constructor', this).call(this, options, body, labelModule); } + /** + * This function uses binary search to look for the point where the bezier curve crosses the border of the node. + * + * @param nearNode + * @param ctx + * @param viaNode + * @param nearNode + * @param ctx + * @param viaNode + * @param nearNode + * @param ctx + * @param viaNode + */ + _createClass(BezierEdgeBase, [{ key: '_findBorderPositionBezier', - - /** - * This function uses binary search to look for the point where the bezier curve crosses the border of the node. - * - * @param nearNode - * @param ctx - * @param viaNode - * @param nearNode - * @param ctx - * @param viaNode - * @param nearNode - * @param ctx - * @param viaNode - */ value: function _findBorderPositionBezier(nearNode, ctx) { var viaNode = arguments.length <= 2 || arguments[2] === undefined ? this._getViaCoordinates() : arguments[2]; @@ -31754,19 +31664,19 @@ return /******/ (function(modules) { // webpackBootstrap if (Math.abs(difference) < threshold) { break; // found } else if (difference < 0) { - // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. - if (from === false) { - low = middle; - } else { - high = middle; - } - } else { - if (from === false) { - high = middle; + // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. + if (from === false) { + low = middle; + } else { + high = middle; + } } else { - low = middle; + if (from === false) { + high = middle; + } else { + low = middle; + } } - } iteration++; } @@ -31774,8 +31684,6 @@ return /******/ (function(modules) { // webpackBootstrap return pos; } - }, { - key: '_getDistanceToBezierEdge', /** * Calculate the distance between a point (x3,y3) and a line segment from @@ -31789,6 +31697,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} y3 point to check y * @private */ + }, { + key: '_getDistanceToBezierEdge', value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via) { // x3,y3 is the point var minDistance = 1e9; @@ -31871,8 +31781,6 @@ return /******/ (function(modules) { // webpackBootstrap this.to = this.body.nodes[this.options.to]; this.id = this.options.id; } - }, { - key: 'drawLine', /** * Redraw a edge as a line @@ -31881,6 +31789,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: 'drawLine', value: function drawLine(ctx, selected, hover) { // set style ctx.strokeStyle = this.getColor(ctx, selected, hover); @@ -32032,8 +31942,6 @@ return /******/ (function(modules) { // webpackBootstrap } return [x, y, radius]; } - }, { - key: '_pointOnCircle', /** * Get a point on a circle @@ -32044,6 +31952,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Object} point * @private */ + }, { + key: '_pointOnCircle', value: function _pointOnCircle(x, y, radius, percentage) { var angle = percentage * 2 * Math.PI; return { @@ -32051,8 +31961,6 @@ return /******/ (function(modules) { // webpackBootstrap y: y - radius * Math.sin(angle) }; } - }, { - key: '_findBorderPositionCircle', /** * This function uses binary search to look for the point where the circle crosses the border of the node. @@ -32062,6 +31970,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} * @private */ + }, { + key: '_findBorderPositionCircle', value: function _findBorderPositionCircle(node, ctx, options) { var x = options.x; var y = options.y; @@ -32091,27 +32001,25 @@ return /******/ (function(modules) { // webpackBootstrap if (Math.abs(difference) < threshold) { break; // found } else if (difference > 0) { - // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. - if (direction > 0) { - low = middle; - } else { - high = middle; - } - } else { - if (direction > 0) { - high = middle; + // distance to nodes is larger than distance to border --> t needs to be bigger if we're looking at the to node. + if (direction > 0) { + low = middle; + } else { + high = middle; + } } else { - low = middle; + if (direction > 0) { + high = middle; + } else { + low = middle; + } } - } iteration++; } pos.t = middle; return pos; } - }, { - key: 'getLineWidth', /** * Get the line width of the edge. Depends on width and whether one of the @@ -32119,6 +32027,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Number} width * @private */ + }, { + key: 'getLineWidth', value: function getLineWidth(selected, hover) { if (selected === true) { return Math.max(this.selectionWidth, 0.3 / this.body.view.scale); @@ -32159,7 +32069,7 @@ return /******/ (function(modules) { // webpackBootstrap } if (this.colorDirty === true) { - if (colorOptions.inherit === 'to') { + if (colorOptions.inherit === "to") { this.color.highlight = this.to.options.color.highlight.border; this.color.hover = this.to.options.color.hover.border; this.color.color = util.overrideOpacity(this.to.options.color.border, colorOptions.opacity); @@ -32187,8 +32097,6 @@ return /******/ (function(modules) { // webpackBootstrap return this.color.color; } } - }, { - key: '_circle', /** * Draw a line from a node to itself, a circle @@ -32198,6 +32106,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} radius * @private */ + }, { + key: '_circle', value: function _circle(ctx, x, y, radius) { // draw shadow if enabled this.enableShadow(ctx); @@ -32210,8 +32120,6 @@ return /******/ (function(modules) { // webpackBootstrap // disable shadows for other elements. this.disableShadow(ctx); } - }, { - key: 'getDistanceToEdge', /** * Calculate the distance between a point (x3,y3) and a line segment from @@ -32225,6 +32133,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {number} y3 * @private */ + }, { + key: 'getDistanceToEdge', value: function getDistanceToEdge(x1, y1, x2, y2, x3, y3, via) { // x3,y3 is the point var returnValue = 0; @@ -32277,8 +32187,6 @@ return /******/ (function(modules) { // webpackBootstrap return Math.sqrt(dx * dx + dy * dy); } - }, { - key: 'drawArrowHead', /** * @@ -32286,6 +32194,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param position * @param viaNode */ + }, { + key: 'drawArrowHead', value: function drawArrowHead(ctx, position, viaNode, selected, hover) { // set style ctx.strokeStyle = this.getColor(ctx, selected, hover); @@ -32444,17 +32354,15 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(CubicBezierEdge.prototype), 'constructor', this).call(this, options, body, labelModule); } + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @private + */ + _createClass(CubicBezierEdge, [{ key: '_line', - - /** - * Draw a line between two nodes - * @param {CanvasRenderingContext2D} ctx - * @private - */ value: function _line(ctx) { - // get the coordinates of the support points. - var _getViaCoordinates2 = this._getViaCoordinates(); var _getViaCoordinates22 = _slicedToArray(_getViaCoordinates2, 2); @@ -32525,8 +32433,6 @@ return /******/ (function(modules) { // webpackBootstrap // x3,y3 is the point return this._getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2); } - }, { - key: 'getPoint', /** * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way @@ -32535,6 +32441,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @private */ + }, { + key: 'getPoint', value: function getPoint(percentage) { var _ref3 = arguments.length <= 1 || arguments[1] === undefined ? this._getViaCoordinates() : arguments[1]; @@ -32562,6 +32470,8 @@ return /******/ (function(modules) { // webpackBootstrap exports['default'] = CubicBezierEdge; module.exports = exports['default']; + // get the coordinates of the support points. + /***/ }, /* 87 */ /***/ function(module, exports, __webpack_require__) { @@ -32595,22 +32505,22 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(CubicBezierEdgeBase.prototype), 'constructor', this).call(this, options, body, labelModule); } + /** + * Calculate the distance between a point (x3,y3) and a line segment from + * (x1,y1) to (x2,y2). + * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment + * https://en.wikipedia.org/wiki/B%C3%A9zier_curve + * @param {number} x1 from x + * @param {number} y1 from y + * @param {number} x2 to x + * @param {number} y2 to y + * @param {number} x3 point to check x + * @param {number} y3 point to check y + * @private + */ + _createClass(CubicBezierEdgeBase, [{ key: '_getDistanceToBezierEdge', - - /** - * Calculate the distance between a point (x3,y3) and a line segment from - * (x1,y1) to (x2,y2). - * http://stackoverflow.com/questions/849211/shortest-distancae-between-a-point-and-a-line-segment - * https://en.wikipedia.org/wiki/B%C3%A9zier_curve - * @param {number} x1 from x - * @param {number} y1 from y - * @param {number} x2 to x - * @param {number} y2 to y - * @param {number} x3 point to check x - * @param {number} y3 point to check y - * @private - */ value: function _getDistanceToBezierEdge(x1, y1, x2, y2, x3, y3, via1, via2) { // x3,y3 is the point var minDistance = 1e9; @@ -32712,13 +32622,13 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'cleanup', /** * remove the support nodes * @returns {boolean} */ + }, { + key: 'cleanup', value: function cleanup() { if (this.via !== undefined) { delete this.body.nodes[this.via.id]; @@ -32727,8 +32637,6 @@ return /******/ (function(modules) { // webpackBootstrap } return false; } - }, { - key: 'setupSupportNode', /** * Bezier curves require an anchor point to calculate the smooth flow. These points are nodes. These nodes are invisible but @@ -32737,9 +32645,11 @@ return /******/ (function(modules) { // webpackBootstrap * The changed data is not called, if needed, it is returned by the main edge constructor. * @private */ + }, { + key: 'setupSupportNode', value: function setupSupportNode() { if (this.via === undefined) { - var nodeId = 'edgeId:' + this.id; + var nodeId = "edgeId:" + this.id; var node = this.body.functions.createNode({ id: nodeId, shape: 'circle', @@ -32763,14 +32673,14 @@ return /******/ (function(modules) { // webpackBootstrap this.via.y = 0; } } - }, { - key: '_line', /** * Draw a line between two nodes * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_line', value: function _line(ctx) { // draw a straight line ctx.beginPath(); @@ -32782,8 +32692,6 @@ return /******/ (function(modules) { // webpackBootstrap this.disableShadow(ctx); return this.via; } - }, { - key: 'getPoint', /** * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way @@ -32792,6 +32700,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @private */ + }, { + key: 'getPoint', value: function getPoint(percentage) { var t = percentage; var x = Math.pow(1 - t, 2) * this.from.x + 2 * t * (1 - t) * this.via.x + Math.pow(t, 2) * this.to.x; @@ -32851,14 +32761,14 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(StraightEdge.prototype), 'constructor', this).call(this, options, body, labelModule); } + /** + * Draw a line between two nodes + * @param {CanvasRenderingContext2D} ctx + * @private + */ + _createClass(StraightEdge, [{ key: '_line', - - /** - * Draw a line between two nodes - * @param {CanvasRenderingContext2D} ctx - * @private - */ value: function _line(ctx) { // draw a straight line ctx.beginPath(); @@ -32870,8 +32780,6 @@ return /******/ (function(modules) { // webpackBootstrap this.disableShadow(ctx); return undefined; } - }, { - key: 'getPoint', /** * Combined function of pointOnLine and pointOnBezier. This gives the coordinates of a point on the line at a certain percentage of the way @@ -32880,6 +32788,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @private */ + }, { + key: 'getPoint', value: function getPoint(percentage) { return { x: (1 - percentage) * this.from.x + percentage * this.to.x, @@ -33151,18 +33061,18 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit('fit'); } } - }, { - key: 'startSimulation', /** * Start the simulation */ + }, { + key: 'startSimulation', value: function startSimulation() { if (this.physicsEnabled === true && this.options.enabled === true) { this.stabilized = false; // this sets the width of all nodes initially which could be required for the avoidOverlap - this.body.emitter.emit('_resizeNodes'); + this.body.emitter.emit("_resizeNodes"); if (this.viewFunction === undefined) { this.viewFunction = this.simulationStep.bind(this); this.body.emitter.on('initRedraw', this.viewFunction); @@ -33172,12 +33082,12 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit('_redraw'); } } - }, { - key: 'stopSimulation', /** * Stop the simulation, force stabilization. */ + }, { + key: 'stopSimulation', value: function stopSimulation() { var emit = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0]; @@ -33193,13 +33103,13 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'simulationStep', /** * The viewFunction inserts this step into each renderloop. It calls the physics tick and handles the cleanup at stabilized. * */ + }, { + key: 'simulationStep', value: function simulationStep() { // check if the physics have settled var startTime = Date.now(); @@ -33239,14 +33149,14 @@ return /******/ (function(modules) { // webpackBootstrap }, 0); } } - }, { - key: 'physicsTick', /** * A single simulation step (or 'tick') in the physics simulation * * @private */ + }, { + key: 'physicsTick', value: function physicsTick() { if (this.stabilized === false) { this.calculateForces(); @@ -33266,14 +33176,14 @@ return /******/ (function(modules) { // webpackBootstrap this.stabilizationIterations++; } } - }, { - key: 'updatePhysicsData', /** * Nodes and edges can have the physics toggles on or off. A collection of indices is created here so we can skip the check all the time. * * @private */ + }, { + key: 'updatePhysicsData', value: function updatePhysicsData() { this.physicsBody.forces = {}; this.physicsBody.physicsNodeIndices = []; @@ -33317,12 +33227,12 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'revert', /** * Revert the simulation one step. This is done so after stabilization, every new start of the simulation will also say stabilized. */ + }, { + key: 'revert', value: function revert() { var nodeIds = Object.keys(this.previousStates); var nodes = this.body.nodes; @@ -33342,13 +33252,13 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'moveNodes', /** * move the nodes one timestap and check if they are stabilized * @returns {boolean} */ + }, { + key: 'moveNodes', value: function moveNodes() { var nodesPresent = false; var nodeIndices = this.physicsBody.physicsNodeIndices; @@ -33373,8 +33283,6 @@ return /******/ (function(modules) { // webpackBootstrap } return true; } - }, { - key: '_performStep', /** * Perform the actual step @@ -33384,6 +33292,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_performStep', value: function _performStep(nodeId, maxVelocity) { var node = this.body.nodes[nodeId]; var timestep = this.options.timestep; @@ -33400,9 +33310,9 @@ return /******/ (function(modules) { // webpackBootstrap velocities[nodeId].x = Math.abs(velocities[nodeId].x) > maxVelocity ? velocities[nodeId].x > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].x; node.x += velocities[nodeId].x * timestep; // position } else { - forces[nodeId].x = 0; - velocities[nodeId].x = 0; - } + forces[nodeId].x = 0; + velocities[nodeId].x = 0; + } if (node.options.fixed.y === false) { var dy = this.modelOptions.damping * velocities[nodeId].y; // damping force @@ -33411,26 +33321,24 @@ return /******/ (function(modules) { // webpackBootstrap velocities[nodeId].y = Math.abs(velocities[nodeId].y) > maxVelocity ? velocities[nodeId].y > 0 ? maxVelocity : -maxVelocity : velocities[nodeId].y; node.y += velocities[nodeId].y * timestep; // position } else { - forces[nodeId].y = 0; - velocities[nodeId].y = 0; - } + forces[nodeId].y = 0; + velocities[nodeId].y = 0; + } var totalVelocity = Math.sqrt(Math.pow(velocities[nodeId].x, 2) + Math.pow(velocities[nodeId].y, 2)); return totalVelocity; } - }, { - key: 'calculateForces', /** * calculate the forces for one physics iteration. */ + }, { + key: 'calculateForces', value: function calculateForces() { this.gravitySolver.solve(); this.nodesSolver.solve(); this.edgesSolver.solve(); } - }, { - key: '_freezeNodes', /** * When initializing and stabilizing, we can freeze nodes with a predefined position. This greatly speeds up stabilization @@ -33438,6 +33346,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: '_freezeNodes', value: function _freezeNodes() { var nodes = this.body.nodes; for (var id in nodes) { @@ -33450,14 +33360,14 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_restoreFrozenNodes', /** * Unfreezes the nodes that have been frozen by _freezeDefinedNodes. * * @private */ + }, { + key: '_restoreFrozenNodes', value: function _restoreFrozenNodes() { var nodes = this.body.nodes; for (var id in nodes) { @@ -33470,13 +33380,13 @@ return /******/ (function(modules) { // webpackBootstrap } this.freezeCache = {}; } - }, { - key: 'stabilize', /** * Find a stable position for all nodes * @private */ + }, { + key: 'stabilize', value: function stabilize() { var _this3 = this; @@ -33493,7 +33403,7 @@ return /******/ (function(modules) { // webpackBootstrap } // this sets the width of all nodes initially which could be required for the avoidOverlap - this.body.emitter.emit('_resizeNodes'); + this.body.emitter.emit("_resizeNodes"); // stop the render loop this.stopSimulation(); @@ -33601,8 +33511,6 @@ return /******/ (function(modules) { // webpackBootstrap var x = Math.sin(this.randomSeed++) * 10000; return x - Math.floor(x); } - }, { - key: "solve", /** * This function calculates the forces the nodes apply on eachother based on a gravitational model. @@ -33610,6 +33518,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: "solve", value: function solve() { if (this.options.gravitationalConstant !== 0 && this.physicsBody.physicsNodeIndices.length > 0) { var node = undefined; @@ -33636,8 +33546,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "_getForceContribution", /** * This function traverses the barnesHutTree. It checks when it can approximate distant nodes with their center of mass. @@ -33647,6 +33555,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param node * @private */ + }, { + key: "_getForceContribution", value: function _getForceContribution(parentBranch, node) { // we get no force contribution from an empty region if (parentBranch.childrenCount > 0) { @@ -33681,8 +33591,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "_calculateForces", /** * Calculate the forces based on the distance. @@ -33694,6 +33602,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentBranch * @private */ + }, { + key: "_calculateForces", value: function _calculateForces(distance, dx, dy, node, parentBranch) { if (distance === 0) { distance = 0.1; @@ -33713,8 +33623,6 @@ return /******/ (function(modules) { // webpackBootstrap this.physicsBody.forces[node.id].x += fx; this.physicsBody.forces[node.id].y += fy; } - }, { - key: "_formBarnesHutTree", /** * This function constructs the barnesHut tree recursively. It creates the root, splits it and starts placing the nodes. @@ -33723,6 +33631,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param nodeIndices * @private */ + }, { + key: "_formBarnesHutTree", value: function _formBarnesHutTree(nodes, nodeIndices) { var node = undefined; var nodeCount = nodeIndices.length; @@ -33758,9 +33668,9 @@ return /******/ (function(modules) { // webpackBootstrap maxY += 0.5 * sizeDiff; } // xSize > ySize else { - minX += 0.5 * sizeDiff; - maxX -= 0.5 * sizeDiff; - } // xSize < ySize + minX += 0.5 * sizeDiff; + maxX -= 0.5 * sizeDiff; + } // xSize < ySize var minimumTreeSize = 1e-5; var rootSize = Math.max(minimumTreeSize, Math.abs(maxX - minX)); @@ -33798,8 +33708,6 @@ return /******/ (function(modules) { // webpackBootstrap // make global return barnesHutTree; } - }, { - key: "_updateBranchMass", /** * this updates the mass of a branch. this is increased by adding a node. @@ -33808,6 +33716,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param node * @private */ + }, { + key: "_updateBranchMass", value: function _updateBranchMass(parentBranch, node) { var totalMass = parentBranch.mass + node.options.mass; var totalMassInv = 1 / totalMass; @@ -33822,8 +33732,6 @@ return /******/ (function(modules) { // webpackBootstrap var biggestSize = Math.max(Math.max(node.height, node.radius), node.width); parentBranch.maxWidth = parentBranch.maxWidth < biggestSize ? biggestSize : parentBranch.maxWidth; } - }, { - key: "_placeInTree", /** * determine in which branch the node will be placed. @@ -33833,6 +33741,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param skipMassUpdate * @private */ + }, { + key: "_placeInTree", value: function _placeInTree(parentBranch, node, skipMassUpdate) { if (skipMassUpdate != true || skipMassUpdate === undefined) { // update the mass of the branch. @@ -33859,8 +33769,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "_placeInRegion", /** * actually place the node in a region (or branch) @@ -33870,6 +33778,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param region * @private */ + }, { + key: "_placeInRegion", value: function _placeInRegion(parentBranch, node, region) { switch (parentBranch.children[region].childrenCount) { case 0: @@ -33896,8 +33806,6 @@ return /******/ (function(modules) { // webpackBootstrap break; } } - }, { - key: "_splitBranch", /** * this function splits a branch into 4 sub branches. If the branch contained a node, we place it in the subbranch @@ -33906,6 +33814,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentBranch * @private */ + }, { + key: "_splitBranch", value: function _splitBranch(parentBranch) { // if the branch is shaded with a node, replace the node in the new subset. var containedNode = null; @@ -33926,8 +33836,6 @@ return /******/ (function(modules) { // webpackBootstrap this._placeInTree(parentBranch, containedNode); } } - }, { - key: "_insertRegion", /** * This function subdivides the region into four new segments. @@ -33939,6 +33847,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentRange * @private */ + }, { + key: "_insertRegion", value: function _insertRegion(parentBranch, region) { var minX = undefined, maxX = undefined, @@ -33984,8 +33894,6 @@ return /******/ (function(modules) { // webpackBootstrap childrenCount: 0 }; } - }, { - key: "_debug", //--------------------------- DEBUGGING BELOW ---------------------------// @@ -33996,6 +33904,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param color * @private */ + }, { + key: "_debug", value: function _debug(ctx, color) { if (this.barnesHutTree !== undefined) { @@ -34004,8 +33914,6 @@ return /******/ (function(modules) { // webpackBootstrap this._drawBranch(this.barnesHutTree.root, ctx, color); } } - }, { - key: "_drawBranch", /** * This function is for debugging purposes. It draws the branches recursively. @@ -34015,6 +33923,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param color * @private */ + }, { + key: "_drawBranch", value: function _drawBranch(branch, ctx, color) { if (color === undefined) { color = "#FF0000"; @@ -34090,8 +34000,6 @@ return /******/ (function(modules) { // webpackBootstrap value: function setOptions(options) { this.options = options; } - }, { - key: "solve", /** * Calculate the forces the nodes apply on each other based on a repulsion field. @@ -34099,6 +34007,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: "solve", value: function solve() { var dx, dy, distance, fx, fy, repulsingForce, node1, node2; @@ -34185,8 +34095,6 @@ return /******/ (function(modules) { // webpackBootstrap value: function setOptions(options) { this.options = options; } - }, { - key: "solve", /** * Calculate the forces the nodes apply on each other based on a repulsion field. @@ -34194,6 +34102,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: "solve", value: function solve() { var dx, dy, distance, fx, fy, repulsingForce, node1, node2, i, j; @@ -34276,14 +34186,14 @@ return /******/ (function(modules) { // webpackBootstrap value: function setOptions(options) { this.options = options; } - }, { - key: "solve", /** * This function calculates the springforces on the nodes, accounting for the support nodes. * * @private */ + }, { + key: "solve", value: function solve() { var edgeLength = undefined, edge = undefined; @@ -34317,8 +34227,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "_calculateSpringForce", /** * This is the code actually performing the calculation for the function above. @@ -34328,6 +34236,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param edgeLength * @private */ + }, { + key: "_calculateSpringForce", value: function _calculateSpringForce(node1, node2, edgeLength) { var dx = node1.x - node2.x; var dy = node1.y - node2.y; @@ -34386,14 +34296,14 @@ return /******/ (function(modules) { // webpackBootstrap value: function setOptions(options) { this.options = options; } - }, { - key: "solve", /** * This function calculates the springforces on the nodes, accounting for the support nodes. * * @private */ + }, { + key: "solve", value: function solve() { var edgeLength, edge; var dx, dy, fx, fy, springForce, distance; @@ -34536,13 +34446,13 @@ return /******/ (function(modules) { // webpackBootstrap this._calculateForces(distance, dx, dy, forces, node); } } - }, { - key: "_calculateForces", /** * Calculate the forces based on the distance. * @private */ + }, { + key: "_calculateForces", value: function _calculateForces(distance, dx, dy, forces, node) { var gravityForce = distance === 0 ? 0 : this.options.centralGravity / distance; forces[node.id].x = dx * gravityForce; @@ -34589,19 +34499,19 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(ForceAtlas2BasedRepulsionSolver.prototype), "constructor", this).call(this, body, physicsBody, options); } + /** + * Calculate the forces based on the distance. + * + * @param distance + * @param dx + * @param dy + * @param node + * @param parentBranch + * @private + */ + _createClass(ForceAtlas2BasedRepulsionSolver, [{ key: "_calculateForces", - - /** - * Calculate the forces based on the distance. - * - * @param distance - * @param dx - * @param dy - * @param node - * @param parentBranch - * @private - */ value: function _calculateForces(distance, dx, dy, node, parentBranch) { if (distance === 0) { distance = 0.1 * Math.random(); @@ -34663,13 +34573,13 @@ return /******/ (function(modules) { // webpackBootstrap _get(Object.getPrototypeOf(ForceAtlas2BasedCentralGravitySolver.prototype), "constructor", this).call(this, body, physicsBody, options); } + /** + * Calculate the forces based on the distance. + * @private + */ + _createClass(ForceAtlas2BasedCentralGravitySolver, [{ key: "_calculateForces", - - /** - * Calculate the forces based on the distance. - * @private - */ value: function _calculateForces(distance, dx, dy, forces, node) { if (distance > 0) { var degree = node.edges.length + 1; @@ -34731,18 +34641,18 @@ return /******/ (function(modules) { // webpackBootstrap value: function setOptions(options) { if (options !== undefined) {} } - }, { - key: 'clusterByHubsize', /** * * @param hubsize * @param options */ + }, { + key: 'clusterByHubsize', value: function clusterByHubsize(hubsize, options) { if (hubsize === undefined) { hubsize = this._getHubSize(); - } else if (typeof hubsize === 'object') { + } else if (typeof hubsize === "object") { options = this._checkOptions(hubsize); hubsize = this._getHubSize(); } @@ -34760,20 +34670,20 @@ return /******/ (function(modules) { // webpackBootstrap } this.body.emitter.emit('_dataChanged'); } - }, { - key: 'cluster', /** * loop over all nodes, check if they adhere to the condition and cluster if needed. * @param options * @param refreshData */ + }, { + key: 'cluster', value: function cluster() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; var refreshData = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; if (options.joinCondition === undefined) { - throw new Error('Cannot call clusterByNodeData without a joinCondition function in the options.'); + throw new Error("Cannot call clusterByNodeData without a joinCondition function in the options."); } // check if the options object is fine, append if needed @@ -34800,14 +34710,14 @@ return /******/ (function(modules) { // webpackBootstrap this._cluster(childNodesObj, childEdgesObj, options, refreshData); } - }, { - key: 'clusterOutliers', /** * Cluster all nodes in the network that have only 1 edge * @param options * @param refreshData */ + }, { + key: 'clusterOutliers', value: function clusterOutliers(options) { var refreshData = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; @@ -34877,8 +34787,6 @@ return /******/ (function(modules) { // webpackBootstrap } return false; } - }, { - key: 'clusterByConnection', /** * suck all connected nodes of a node into the node. @@ -34886,15 +34794,17 @@ return /******/ (function(modules) { // webpackBootstrap * @param options * @param refreshData */ + }, { + key: 'clusterByConnection', value: function clusterByConnection(nodeId, options) { var refreshData = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2]; // kill conditions if (nodeId === undefined) { - throw new Error('No nodeId supplied to clusterByConnection!'); + throw new Error("No nodeId supplied to clusterByConnection!"); } if (this.body.nodes[nodeId] === undefined) { - throw new Error('The nodeId given to clusterByConnection does not exist!'); + throw new Error("The nodeId given to clusterByConnection does not exist!"); } var node = this.body.nodes[nodeId]; @@ -34941,8 +34851,6 @@ return /******/ (function(modules) { // webpackBootstrap this._cluster(childNodesObj, childEdgesObj, options, refreshData); } - }, { - key: '_cloneOptions', /** * This returns a clone of the options or options of the edge or node to be used for construction of new edges or check functions for new nodes. @@ -34951,6 +34859,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{}} * @private */ + }, { + key: '_cloneOptions', value: function _cloneOptions(item, type) { var clonedOptions = {}; if (type === undefined || type === 'node') { @@ -34963,8 +34873,6 @@ return /******/ (function(modules) { // webpackBootstrap } return clonedOptions; } - }, { - key: '_createClusterEdges', /** * This function creates the edges that will be attached to the cluster. @@ -34975,6 +34883,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param options * @private */ + }, { + key: '_createClusterEdges', value: function _createClusterEdges(childNodesObj, childEdgesObj, newEdges, clusterNodeProperties, clusterEdgeProperties) { var edge = undefined, childNodeId = undefined, @@ -35017,8 +34927,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_checkOptions', /** * This function checks the options that can be supplied to the different cluster functions @@ -35027,6 +34935,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} * @private */ + }, { + key: '_checkOptions', value: function _checkOptions() { var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; @@ -35039,8 +34949,6 @@ return /******/ (function(modules) { // webpackBootstrap return options; } - }, { - key: '_cluster', /** * @@ -35050,6 +34958,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Boolean} refreshData | when true, do not wrap up * @private */ + }, { + key: '_cluster', value: function _cluster(childNodesObj, childEdgesObj, options) { var refreshData = arguments.length <= 3 || arguments[3] === undefined ? true : arguments[3]; @@ -35073,7 +34983,7 @@ return /******/ (function(modules) { // webpackBootstrap var childEdgesOptions = []; for (var edgeId in childEdgesObj) { // these cluster edges will be removed on creation of the cluster. - if (edgeId.substr(0, 12) !== 'clusterEdge:') { + if (edgeId.substr(0, 12) !== "clusterEdge:") { var clonedOptions = this._cloneOptions(childEdgesObj[edgeId], 'edge'); childEdgesOptions.push(clonedOptions); } @@ -35081,7 +34991,7 @@ return /******/ (function(modules) { // webpackBootstrap clusterNodeProperties = options.processProperties(clusterNodeProperties, childNodesOptions, childEdgesOptions); if (!clusterNodeProperties) { - throw new Error('The processProperties function does not return properties!'); + throw new Error("The processProperties function does not return properties!"); } } @@ -35134,7 +35044,7 @@ return /******/ (function(modules) { // webpackBootstrap // if this is a cluster edge that is fully encompassed in the cluster, we want to delete it // this check verifies that both of the connected nodes are in this cluster - if (edgeId.substr(0, 12) === 'clusterEdge:' && childNodesObj[edge.fromId] !== undefined && childNodesObj[edge.toId] !== undefined) { + if (edgeId.substr(0, 12) === "clusterEdge:" && childNodesObj[edge.fromId] !== undefined && childNodesObj[edge.toId] !== undefined) { edge.cleanup(); // this removes the edge from node.edges, which is why edgeIds is formed edge.disconnect(); @@ -35170,24 +35080,22 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit('_dataChanged'); } } - }, { - key: 'isCluster', /** * Check if a node is a cluster. * @param nodeId * @returns {*} */ + }, { + key: 'isCluster', value: function isCluster(nodeId) { if (this.body.nodes[nodeId] !== undefined) { return this.body.nodes[nodeId].isCluster === true; } else { - console.log('Node does not exist.'); + console.log("Node does not exist."); return false; } } - }, { - key: '_getClusterPosition', /** * get the position of the cluster node based on what's inside @@ -35195,6 +35103,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @private */ + }, { + key: '_getClusterPosition', value: function _getClusterPosition(childNodesObj) { var childKeys = Object.keys(childNodesObj); var minX = childNodesObj[childKeys[0]].x; @@ -35212,26 +35122,26 @@ return /******/ (function(modules) { // webpackBootstrap return { x: 0.5 * (minX + maxX), y: 0.5 * (minY + maxY) }; } - }, { - key: 'openCluster', /** * Open a cluster by calling this function. * @param {String} clusterNodeId | the ID of the cluster node * @param {Boolean} refreshData | wrap up afterwards if not true */ + }, { + key: 'openCluster', value: function openCluster(clusterNodeId, options) { var refreshData = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2]; // kill conditions if (clusterNodeId === undefined) { - throw new Error('No clusterNodeId supplied to openCluster.'); + throw new Error("No clusterNodeId supplied to openCluster."); } if (this.body.nodes[clusterNodeId] === undefined) { - throw new Error('The clusterNodeId supplied to openCluster does not exist.'); + throw new Error("The clusterNodeId supplied to openCluster does not exist."); } if (this.body.nodes[clusterNodeId].containedNodes === undefined) { - console.log('The node:' + clusterNodeId + ' is not a cluster.'); + console.log("The node:" + clusterNodeId + " is not a cluster."); return; } var clusterNode = this.body.nodes[clusterNodeId]; @@ -35376,8 +35286,6 @@ return /******/ (function(modules) { // webpackBootstrap return nodesArray; } - }, { - key: 'findNode', /** * Get the stack clusterId's that a certain node resides in. cluster A -> cluster B -> cluster C -> node @@ -35385,6 +35293,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {Array} * @private */ + }, { + key: 'findNode', value: function findNode(nodeId) { var stack = []; var max = 100; @@ -35398,8 +35308,6 @@ return /******/ (function(modules) { // webpackBootstrap stack.push(this.body.nodes[nodeId]); return stack; } - }, { - key: '_getConnectedId', /** * Get the Id the node is connected to @@ -35408,6 +35316,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} * @private */ + }, { + key: '_getConnectedId', value: function _getConnectedId(edge, nodeId) { if (edge.toId != nodeId) { return edge.toId; @@ -35417,8 +35327,6 @@ return /******/ (function(modules) { // webpackBootstrap return edge.fromId; } } - }, { - key: '_getHubSize', /** * We determine how many connections denote an important hub. @@ -35426,6 +35334,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: '_getHubSize', value: function _getHubSize() { var average = 0; var averageSquared = 0; @@ -35484,12 +35394,12 @@ return /******/ (function(modules) { // webpackBootstrap var _Node2 = __webpack_require__(62); - var _Node3 = _interopRequireDefault(_Node2); - /** * */ + var _Node3 = _interopRequireDefault(_Node2); + var Cluster = (function (_Node) { _inherits(Cluster, _Node); @@ -35561,33 +35471,33 @@ return /******/ (function(modules) { // webpackBootstrap value: function bindEventListeners() { var _this = this; - this.body.emitter.on('dragStart', function () { + this.body.emitter.on("dragStart", function () { _this.dragging = true; }); - this.body.emitter.on('dragEnd', function () { + this.body.emitter.on("dragEnd", function () { return _this.dragging = false; }); - this.body.emitter.on('_resizeNodes', function () { + this.body.emitter.on("_resizeNodes", function () { return _this._resizeNodes(); }); - this.body.emitter.on('_redraw', function () { + this.body.emitter.on("_redraw", function () { if (_this.renderingActive === false) { _this._redraw(); } }); - this.body.emitter.on('_blockRedraw', function () { + this.body.emitter.on("_blockRedraw", function () { _this.allowRedraw = false; }); - this.body.emitter.on('_allowRedraw', function () { + this.body.emitter.on("_allowRedraw", function () { _this.allowRedraw = true;_this.redrawRequested = false; }); - this.body.emitter.on('_requestRedraw', this._requestRedraw.bind(this)); - this.body.emitter.on('_startRendering', function () { + this.body.emitter.on("_requestRedraw", this._requestRedraw.bind(this)); + this.body.emitter.on("_startRendering", function () { _this.renderRequests += 1; _this.renderingActive = true; _this._startRendering(); }); - this.body.emitter.on('_stopRendering', function () { + this.body.emitter.on("_stopRendering", function () { _this.renderRequests -= 1; _this.renderingActive = _this.renderRequests > 0; _this.renderTimer = undefined; @@ -35620,8 +35530,8 @@ return /******/ (function(modules) { // webpackBootstrap if (this.requiresTimeout === true) { this.renderTimer = window.setTimeout(this._renderStep.bind(this), this.simulationInterval); // wait this.renderTimeStep milliseconds and perform the animation step function } else { - this.renderTimer = window.requestAnimationFrame(this._renderStep.bind(this)); // wait this.renderTimeStep milliseconds and perform the animation step function - } + this.renderTimer = window.requestAnimationFrame(this._renderStep.bind(this)); // wait this.renderTimeStep milliseconds and perform the animation step function + } } } } @@ -35645,25 +35555,25 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'redraw', /** * Redraw the network with the current data * chart will be resized too. */ + }, { + key: 'redraw', value: function redraw() { this.body.emitter.emit('setSize'); this._redraw(); } - }, { - key: '_requestRedraw', /** * Redraw the network with the current data * @param hidden | used to get the first estimate of the node sizes. only the nodes are drawn after which they are quickly drawn over. * @private */ + }, { + key: '_requestRedraw', value: function _requestRedraw() { var _this2 = this; @@ -35686,7 +35596,7 @@ return /******/ (function(modules) { // webpackBootstrap var hidden = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; if (this.allowRedraw === true) { - this.body.emitter.emit('initRedraw'); + this.body.emitter.emit("initRedraw"); this.redrawRequested = false; var ctx = this.canvas.frame.canvas.getContext('2d'); @@ -35713,7 +35623,7 @@ return /******/ (function(modules) { // webpackBootstrap ctx.scale(this.body.view.scale, this.body.view.scale); ctx.beginPath(); - this.body.emitter.emit('beforeDrawing', ctx); + this.body.emitter.emit("beforeDrawing", ctx); ctx.closePath(); if (hidden === false) { @@ -35732,7 +35642,7 @@ return /******/ (function(modules) { // webpackBootstrap ctx.beginPath(); //this.physics.nodesSolver._debug(ctx,"#F00F0F"); - this.body.emitter.emit('afterDrawing', ctx); + this.body.emitter.emit("afterDrawing", ctx); ctx.closePath(); // restore original scaling and translation ctx.restore(); @@ -35742,8 +35652,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_resizeNodes', /** * Redraw all nodes @@ -35752,6 +35660,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Boolean} [alwaysShow] * @private */ + }, { + key: '_resizeNodes', value: function _resizeNodes() { var ctx = this.canvas.frame.canvas.getContext('2d'); if (this.pixelRatio === undefined) { @@ -35777,8 +35687,6 @@ return /******/ (function(modules) { // webpackBootstrap // restore original scaling and translation ctx.restore(); } - }, { - key: '_drawNodes', /** * Redraw all nodes @@ -35787,6 +35695,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Boolean} [alwaysShow] * @private */ + }, { + key: '_drawNodes', value: function _drawNodes(ctx) { var alwaysShow = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; @@ -35825,8 +35735,6 @@ return /******/ (function(modules) { // webpackBootstrap node.draw(ctx); } } - }, { - key: '_drawEdges', /** * Redraw all edges @@ -35834,6 +35742,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_drawEdges', value: function _drawEdges(ctx) { var edges = this.body.edges; var edgeIndices = this.body.edgeIndices; @@ -35846,8 +35756,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_drawControlNodes', /** * Redraw all edges @@ -35855,6 +35763,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {CanvasRenderingContext2D} ctx * @private */ + }, { + key: '_drawControlNodes', value: function _drawControlNodes(ctx) { var edges = this.body.edges; var edgeIndices = this.body.edgeIndices; @@ -35865,14 +35775,14 @@ return /******/ (function(modules) { // webpackBootstrap edge._drawControlNodes(ctx); } } - }, { - key: '_determineBrowserMethod', /** * Determine if the browser requires a setTimeout or a requestAnimationFrame. This was required because * some implementations (safari and IE9) did not support requestAnimationFrame * @private */ + }, { + key: '_determineBrowserMethod', value: function _determineBrowserMethod() { if (typeof window !== 'undefined') { var browserType = navigator.userAgent.toLowerCase(); @@ -35951,7 +35861,7 @@ return /******/ (function(modules) { // webpackBootstrap var _this = this; // bind the events - this.body.emitter.once('resize', function (obj) { + this.body.emitter.once("resize", function (obj) { if (obj.width !== 0) { _this.body.view.translation.x = obj.width * 0.5; } @@ -35959,8 +35869,8 @@ return /******/ (function(modules) { // webpackBootstrap _this.body.view.translation.y = obj.height * 0.5; } }); - this.body.emitter.on('setSize', this.setSize.bind(this)); - this.body.emitter.on('destroy', function () { + this.body.emitter.on("setSize", this.setSize.bind(this)); + this.body.emitter.on("destroy", function () { _this.hammerFrame.destroy(); _this.hammer.destroy(); _this._cleanUp(); @@ -35982,7 +35892,7 @@ return /******/ (function(modules) { // webpackBootstrap this.resizeTimer = setInterval(function () { var changed = _this2.setSize(); if (changed === true) { - _this2.body.emitter.emit('_requestRedraw'); + _this2.body.emitter.emit("_requestRedraw"); } }, 1000); this.resizeFunction = this._onResize.bind(this); @@ -36003,7 +35913,7 @@ return /******/ (function(modules) { // webpackBootstrap key: '_onResize', value: function _onResize() { this.setSize(); - this.body.emitter.emit('_redraw'); + this.body.emitter.emit("_redraw"); } }, { key: '_prepareValue', @@ -36019,12 +35929,12 @@ return /******/ (function(modules) { // webpackBootstrap } throw new Error('Could not use the value supplie for width or height:' + value); } - }, { - key: '_create', /** * Create the HTML */ + }, { + key: '_create', value: function _create() { // remove all elements from the container element. while (this.body.container.hasChildNodes()) { @@ -36039,7 +35949,7 @@ return /******/ (function(modules) { // webpackBootstrap ////////////////////////////////////////////////////////////////// - this.frame.canvas = document.createElement('canvas'); + this.frame.canvas = document.createElement("canvas"); this.frame.canvas.style.position = 'relative'; this.frame.appendChild(this.frame.canvas); @@ -36051,10 +35961,10 @@ return /******/ (function(modules) { // webpackBootstrap noCanvas.innerHTML = 'Error: your browser does not support HTML canvas'; this.frame.canvas.appendChild(noCanvas); } else { - var ctx = this.frame.canvas.getContext('2d'); + var ctx = this.frame.canvas.getContext("2d"); this.pixelRatio = (window.devicePixelRatio || 1) / (ctx.webkitBackingStorePixelRatio || ctx.mozBackingStorePixelRatio || ctx.msBackingStorePixelRatio || ctx.oBackingStorePixelRatio || ctx.backingStorePixelRatio || 1); - this.frame.canvas.getContext('2d').setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); + this.frame.canvas.getContext("2d").setTransform(this.pixelRatio, 0, 0, this.pixelRatio, 0, 0); } // add the frame to the container element @@ -36065,13 +35975,13 @@ return /******/ (function(modules) { // webpackBootstrap this._bindHammer(); } - }, { - key: '_bindHammer', /** * This function binds hammer, it can be repeated over and over due to the uniqueness check. * @private */ + }, { + key: '_bindHammer', value: function _bindHammer() { var _this3 = this; @@ -36132,8 +36042,6 @@ return /******/ (function(modules) { // webpackBootstrap _this3.body.eventListeners.onRelease(event); }); } - }, { - key: 'setSize', /** * Set a new size for the network @@ -36142,6 +36050,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {string} height Height in pixels or percentage (for example '400px' * or '30%') */ + }, { + key: 'setSize', value: function setSize() { var width = arguments.length <= 0 || arguments[0] === undefined ? this.options.width : arguments[0]; var height = arguments.length <= 1 || arguments[1] === undefined ? this.options.height : arguments[1]; @@ -36205,8 +36115,6 @@ return /******/ (function(modules) { // webpackBootstrap value: function _XconvertDOMtoCanvas(x) { return (x - this.body.view.translation.x) / this.body.view.scale; } - }, { - key: '_XconvertCanvasToDOM', /** * Convert the X coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to @@ -36215,11 +36123,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_XconvertCanvasToDOM', value: function _XconvertCanvasToDOM(x) { return x * this.body.view.scale + this.body.view.translation.x; } - }, { - key: '_YconvertDOMtoCanvas', /** * Convert the Y coordinate in DOM-space (coordinate point in browser relative to the container div) to @@ -36228,11 +36136,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_YconvertDOMtoCanvas', value: function _YconvertDOMtoCanvas(y) { return (y - this.body.view.translation.y) / this.body.view.scale; } - }, { - key: '_YconvertCanvasToDOM', /** * Convert the Y coordinate in canvas-space (the simulation sandbox, which the camera looks upon) to @@ -36241,11 +36149,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_YconvertCanvasToDOM', value: function _YconvertCanvasToDOM(y) { return y * this.body.view.scale + this.body.view.translation.y; } - }, { - key: 'canvasToDOM', /** * @@ -36253,11 +36161,11 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @constructor */ + }, { + key: 'canvasToDOM', value: function canvasToDOM(pos) { return { x: this._XconvertCanvasToDOM(pos.x), y: this._YconvertCanvasToDOM(pos.y) }; } - }, { - key: 'DOMtoCanvas', /** * @@ -36265,6 +36173,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{x: number, y: number}} * @constructor */ + }, { + key: 'DOMtoCanvas', value: function DOMtoCanvas(pos) { return { x: this._XconvertDOMtoCanvas(pos.x), y: this._YconvertDOMtoCanvas(pos.y) }; } @@ -36328,13 +36238,13 @@ return /******/ (function(modules) { // webpackBootstrap this.options = options; } - }, { - key: "_getRange", /** * Find the center position of the network * @private */ + }, { + key: "_getRange", value: function _getRange() { var specificNodes = arguments.length <= 0 || arguments[0] === undefined ? [] : arguments[0]; @@ -36360,48 +36270,48 @@ return /******/ (function(modules) { // webpackBootstrap } // top is negative, bottom is positive } } else { - for (var i = 0; i < this.body.nodeIndices.length; i++) { - node = this.body.nodes[this.body.nodeIndices[i]]; - if (minX > node.shape.boundingBox.left) { - minX = node.shape.boundingBox.left; - } - if (maxX < node.shape.boundingBox.right) { - maxX = node.shape.boundingBox.right; + for (var i = 0; i < this.body.nodeIndices.length; i++) { + node = this.body.nodes[this.body.nodeIndices[i]]; + if (minX > node.shape.boundingBox.left) { + minX = node.shape.boundingBox.left; + } + if (maxX < node.shape.boundingBox.right) { + maxX = node.shape.boundingBox.right; + } + if (minY > node.shape.boundingBox.top) { + minY = node.shape.boundingBox.top; + } // top is negative, bottom is positive + if (maxY < node.shape.boundingBox.bottom) { + maxY = node.shape.boundingBox.bottom; + } // top is negative, bottom is positive } - if (minY > node.shape.boundingBox.top) { - minY = node.shape.boundingBox.top; - } // top is negative, bottom is positive - if (maxY < node.shape.boundingBox.bottom) { - maxY = node.shape.boundingBox.bottom; - } // top is negative, bottom is positive } - } if (minX === 1e9 && maxX === -1e9 && minY === 1e9 && maxY === -1e9) { minY = 0, maxY = 0, minX = 0, maxX = 0; } return { minX: minX, maxX: maxX, minY: minY, maxY: maxY }; } - }, { - key: "_findCenter", /** * @param {object} range = {minX: minX, maxX: maxX, minY: minY, maxY: maxY}; * @returns {{x: number, y: number}} * @private */ + }, { + key: "_findCenter", value: function _findCenter(range) { return { x: 0.5 * (range.maxX + range.minX), y: 0.5 * (range.maxY + range.minY) }; } - }, { - key: "fit", /** * This function zooms out to fit all data on screen based on amount of nodes * @param {Object} Options * @param {Boolean} [initialZoom] | zoom based on fitted formula or range, true = fitted, default = false; */ + }, { + key: "fit", value: function fit() { var options = arguments.length <= 0 || arguments[0] === undefined ? { nodes: [] } : arguments[0]; var initialZoom = arguments.length <= 1 || arguments[1] === undefined ? false : arguments[1]; @@ -36456,8 +36366,6 @@ return /******/ (function(modules) { // webpackBootstrap var animationOptions = { position: center, scale: zoomLevel, animation: options.animation }; this.moveTo(animationOptions); } - }, { - key: "focus", // animation @@ -36467,6 +36375,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Number} nodeId * @param {Number} [options] */ + }, { + key: "focus", value: function focus(nodeId) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; @@ -36480,8 +36390,6 @@ return /******/ (function(modules) { // webpackBootstrap console.log("Node: " + nodeId + " cannot be found."); } } - }, { - key: "moveTo", /** * @@ -36490,6 +36398,8 @@ return /******/ (function(modules) { // webpackBootstrap * | options.position = {x:Number, y:Number} // position to move to * | options.animation = {duration:Number, easingFunction:String} || Boolean // position to move to */ + }, { + key: "moveTo", value: function moveTo(options) { if (options === undefined) { options = {}; @@ -36528,8 +36438,6 @@ return /******/ (function(modules) { // webpackBootstrap this.animateView(options); } - }, { - key: "animateView", /** * @@ -36542,6 +36450,8 @@ return /******/ (function(modules) { // webpackBootstrap * // easeInQuart, easeOutQuart, easeInOutQuart, * // easeInQuint, easeOutQuint, easeInOutQuint */ + }, { + key: "animateView", value: function animateView(options) { if (options === undefined) { return; @@ -36596,13 +36506,13 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit("_startRendering"); } } - }, { - key: "_lockedRedraw", /** * used to animate smoothly by hijacking the redraw function. * @private */ + }, { + key: "_lockedRedraw", value: function _lockedRedraw() { var nodePosition = { x: this.body.nodes[this.lockedOnNodeId].x, y: this.body.nodes[this.lockedOnNodeId].y }; var viewCenter = this.canvas.DOMtoCanvas({ x: 0.5 * this.canvas.frame.canvas.clientWidth, y: 0.5 * this.canvas.frame.canvas.clientHeight }); @@ -36627,14 +36537,14 @@ return /******/ (function(modules) { // webpackBootstrap this.lockedOnNodeOffset = undefined; } } - }, { - key: "_transitionRedraw", /** * * @param easingTime * @private */ + }, { + key: "_transitionRedraw", value: function _transitionRedraw() { var finished = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0]; @@ -36786,8 +36696,6 @@ return /******/ (function(modules) { // webpackBootstrap this.navigationHandler.setOptions(this.options); } - }, { - key: 'getPointer', /** * Get the pointer location from a touch location @@ -36795,20 +36703,22 @@ return /******/ (function(modules) { // webpackBootstrap * @return {{x: Number, y: Number}} pointer * @private */ + }, { + key: 'getPointer', value: function getPointer(touch) { return { x: touch.x - util.getAbsoluteLeft(this.canvas.frame.canvas), y: touch.y - util.getAbsoluteTop(this.canvas.frame.canvas) }; } - }, { - key: 'onTouch', /** * On start of a touch gesture, store the pointer * @param event * @private */ + }, { + key: 'onTouch', value: function onTouch(event) { if (new Date().valueOf() - this.touchTime > 50) { this.drag.pointer = this.getPointer(event.center); @@ -36818,13 +36728,13 @@ return /******/ (function(modules) { // webpackBootstrap this.touchTime = new Date().valueOf(); } } - }, { - key: 'onTap', /** * handle tap/click event: select/unselect a node * @private */ + }, { + key: 'onTap', value: function onTap(event) { var pointer = this.getPointer(event.center); var multiselect = this.selectionHandler.options.multiselect && (event.changedPointers[0].ctrlKey || event.changedPointers[0].metaKey); @@ -36832,24 +36742,24 @@ return /******/ (function(modules) { // webpackBootstrap this.checkSelectionChanges(pointer, event, multiselect); this.selectionHandler._generateClickEvent('click', event, pointer); } - }, { - key: 'onDoubleTap', /** * handle doubletap event * @private */ + }, { + key: 'onDoubleTap', value: function onDoubleTap(event) { var pointer = this.getPointer(event.center); this.selectionHandler._generateClickEvent('doubleClick', event, pointer); } - }, { - key: 'onHold', /** * handle long tap event: multi select nodes * @private */ + }, { + key: 'onHold', value: function onHold(event) { var pointer = this.getPointer(event.center); var multiselect = this.selectionHandler.options.multiselect; @@ -36859,14 +36769,14 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionHandler._generateClickEvent('click', event, pointer); this.selectionHandler._generateClickEvent('hold', event, pointer); } - }, { - key: 'onRelease', /** * handle the release of the screen * * @private */ + }, { + key: 'onRelease', value: function onRelease(event) { if (new Date().valueOf() - this.touchTime > 10) { var pointer = this.getPointer(event.center); @@ -36881,14 +36791,14 @@ return /******/ (function(modules) { // webpackBootstrap var pointer = this.getPointer({ x: event.clientX, y: event.clientY }); this.selectionHandler._generateClickEvent('oncontext', event, pointer); } - }, { - key: 'checkSelectionChanges', /** * * @param pointer * @param add */ + }, { + key: 'checkSelectionChanges', value: function checkSelectionChanges(pointer, event) { var add = arguments.length <= 2 || arguments[2] === undefined ? false : arguments[2]; @@ -36949,8 +36859,6 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionHandler._generateClickEvent('select', event, pointer); } } - }, { - key: '_determineIfDifferent', /** * This function checks if the nodes and edges previously selected have changed. @@ -36959,6 +36867,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{nodesChanges: boolean, edgesChanges: boolean}} * @private */ + }, { + key: '_determineIfDifferent', value: function _determineIfDifferent(previousSelection, currentSelection) { var nodesChanges = false; var edgesChanges = false; @@ -36986,8 +36896,6 @@ return /******/ (function(modules) { // webpackBootstrap return { nodesChanges: nodesChanges, edgesChanges: edgesChanges }; } - }, { - key: 'onDragStart', /** * This function is called by onDragStart. @@ -36995,6 +36903,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: 'onDragStart', value: function onDragStart(event) { //in case the touch event was triggered on an external div, do the initial touch now. if (this.drag.pointer === undefined) { @@ -37047,13 +36957,13 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionHandler._generateClickEvent('dragStart', event, this.drag.pointer, undefined, true); } } - }, { - key: 'onDrag', /** * handle drag event * @private */ + }, { + key: 'onDrag', value: function onDrag(event) { var _this2 = this; @@ -37109,13 +37019,13 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'onDragEnd', /** * handle drag start event * @private */ + }, { + key: 'onDragEnd', value: function onDragEnd(event) { this.drag.dragging = false; var selection = this.drag.selection; @@ -37132,14 +37042,14 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit('_requestRedraw'); } } - }, { - key: 'onPinch', /** * Handle pinch event * @param event * @private */ + }, { + key: 'onPinch', value: function onPinch(event) { var pointer = this.getPointer(event.center); @@ -37152,8 +37062,6 @@ return /******/ (function(modules) { // webpackBootstrap var scale = this.pinch.scale * event.scale; this.zoom(scale, pointer); } - }, { - key: 'zoom', /** * Zoom the network in or out @@ -37162,6 +37070,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Number} appliedScale scale is limited within the boundaries * @private */ + }, { + key: 'zoom', value: function zoom(scale, pointer) { if (this.options.zoomView === true) { var scaleOld = this.body.view.scale; @@ -37203,8 +37113,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'onMouseWheel', /** * Event handler for mouse wheel event, used to zoom the timeline @@ -37213,6 +37121,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {MouseEvent} event * @private */ + }, { + key: 'onMouseWheel', value: function onMouseWheel(event) { // retrieve delta var delta = 0; @@ -37249,14 +37159,14 @@ return /******/ (function(modules) { // webpackBootstrap // Prevent default actions caused by mouse wheel. event.preventDefault(); } - }, { - key: 'onMouseMove', /** * Mouse move handler for checking whether the title moves over a node with a title. * @param {Event} event * @private */ + }, { + key: 'onMouseMove', value: function onMouseMove(event) { var _this3 = this; @@ -37307,8 +37217,6 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionHandler.hoverObject(obj); } } - }, { - key: '_checkShowPopup', /** * Check if there is an element on the given position in the network @@ -37318,6 +37226,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {{x:Number, y:Number}} pointer * @private */ + }, { + key: '_checkShowPopup', value: function _checkShowPopup(pointer) { var x = this.canvas._XconvertDOMtoCanvas(pointer.x); var y = this.canvas._YconvertDOMtoCanvas(pointer.y); @@ -37402,8 +37312,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_checkHidePopup', /** * Check if the popup must be hidden, which is the case when the mouse is no @@ -37411,6 +37319,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {{x:Number, y:Number}} pointer * @private */ + }, { + key: '_checkHidePopup', value: function _checkHidePopup(pointer) { var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); @@ -37482,13 +37392,13 @@ return /******/ (function(modules) { // webpackBootstrap this.touchTime = 0; this.activated = false; - this.body.emitter.on('activate', function () { + this.body.emitter.on("activate", function () { _this.activated = true;_this.configureKeyboardBindings(); }); - this.body.emitter.on('deactivate', function () { + this.body.emitter.on("deactivate", function () { _this.activated = false;_this.configureKeyboardBindings(); }); - this.body.emitter.on('destroy', function () { + this.body.emitter.on("destroy", function () { if (_this.keycharm !== undefined) { _this.keycharm.destroy(); } @@ -37536,8 +37446,6 @@ return /******/ (function(modules) { // webpackBootstrap this.iconsCreated = false; } - }, { - key: 'loadNavigationElements', /** * Creation of the navigation controls nodes. They are drawn over the rest of the nodes and are not affected by scale and translation @@ -37547,6 +37455,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: 'loadNavigationElements', value: function loadNavigationElements() { var _this2 = this; @@ -37566,7 +37476,7 @@ return /******/ (function(modules) { // webpackBootstrap this.navigationDOM['wrapper'].appendChild(this.navigationDOM[navigationDivs[i]]); var hammer = new Hammer(this.navigationDOM[navigationDivs[i]]); - if (navigationDivActions[i] === '_fit') { + if (navigationDivActions[i] === "_fit") { hammerUtil.onTouch(hammer, this._fit.bind(this)); } else { hammerUtil.onTouch(hammer, this.bindToRedraw.bind(this, navigationDivActions[i])); @@ -37590,47 +37500,47 @@ return /******/ (function(modules) { // webpackBootstrap value: function bindToRedraw(action) { if (this.boundFunctions[action] === undefined) { this.boundFunctions[action] = this[action].bind(this); - this.body.emitter.on('initRedraw', this.boundFunctions[action]); - this.body.emitter.emit('_startRendering'); + this.body.emitter.on("initRedraw", this.boundFunctions[action]); + this.body.emitter.emit("_startRendering"); } } }, { key: 'unbindFromRedraw', value: function unbindFromRedraw(action) { if (this.boundFunctions[action] !== undefined) { - this.body.emitter.off('initRedraw', this.boundFunctions[action]); - this.body.emitter.emit('_stopRendering'); + this.body.emitter.off("initRedraw", this.boundFunctions[action]); + this.body.emitter.emit("_stopRendering"); delete this.boundFunctions[action]; } } - }, { - key: '_fit', /** * this stops all movement induced by the navigation buttons * * @private */ + }, { + key: '_fit', value: function _fit() { if (new Date().valueOf() - this.touchTime > 700) { // TODO: fix ugly hack to avoid hammer's double fireing of event (because we use release?) - this.body.emitter.emit('fit', { duration: 700 }); + this.body.emitter.emit("fit", { duration: 700 }); this.touchTime = new Date().valueOf(); } } - }, { - key: '_stopMovement', /** * this stops all movement induced by the navigation buttons * * @private */ + }, { + key: '_stopMovement', value: function _stopMovement() { for (var boundAction in this.boundFunctions) { if (this.boundFunctions.hasOwnProperty(boundAction)) { - this.body.emitter.off('initRedraw', this.boundFunctions[boundAction]); - this.body.emitter.emit('_stopRendering'); + this.body.emitter.off("initRedraw", this.boundFunctions[boundAction]); + this.body.emitter.emit("_stopRendering"); } } this.boundFunctions = {}; @@ -37667,12 +37577,12 @@ return /******/ (function(modules) { // webpackBootstrap this.body.view.scale /= 1 + this.options.keyboard.speed.zoom; this.body.emitter.emit('zoom', { direction: '-', scale: this.body.view.scale }); } - }, { - key: 'configureKeyboardBindings', /** * bind all keys using keycharm. */ + }, { + key: 'configureKeyboardBindings', value: function configureKeyboardBindings() { var _this3 = this; @@ -37690,79 +37600,79 @@ return /******/ (function(modules) { // webpackBootstrap this.keycharm.reset(); if (this.activated === true) { - this.keycharm.bind('up', function () { - _this3.bindToRedraw('_moveUp'); - }, 'keydown'); - this.keycharm.bind('down', function () { - _this3.bindToRedraw('_moveDown'); - }, 'keydown'); - this.keycharm.bind('left', function () { - _this3.bindToRedraw('_moveLeft'); - }, 'keydown'); - this.keycharm.bind('right', function () { - _this3.bindToRedraw('_moveRight'); - }, 'keydown'); - this.keycharm.bind('=', function () { - _this3.bindToRedraw('_zoomIn'); - }, 'keydown'); - this.keycharm.bind('num+', function () { - _this3.bindToRedraw('_zoomIn'); - }, 'keydown'); - this.keycharm.bind('num-', function () { - _this3.bindToRedraw('_zoomOut'); - }, 'keydown'); - this.keycharm.bind('-', function () { - _this3.bindToRedraw('_zoomOut'); - }, 'keydown'); - this.keycharm.bind('[', function () { - _this3.bindToRedraw('_zoomOut'); - }, 'keydown'); - this.keycharm.bind(']', function () { - _this3.bindToRedraw('_zoomIn'); - }, 'keydown'); - this.keycharm.bind('pageup', function () { - _this3.bindToRedraw('_zoomIn'); - }, 'keydown'); - this.keycharm.bind('pagedown', function () { - _this3.bindToRedraw('_zoomOut'); - }, 'keydown'); - - this.keycharm.bind('up', function () { - _this3.unbindFromRedraw('_moveUp'); - }, 'keyup'); - this.keycharm.bind('down', function () { - _this3.unbindFromRedraw('_moveDown'); - }, 'keyup'); - this.keycharm.bind('left', function () { - _this3.unbindFromRedraw('_moveLeft'); - }, 'keyup'); - this.keycharm.bind('right', function () { - _this3.unbindFromRedraw('_moveRight'); - }, 'keyup'); - this.keycharm.bind('=', function () { - _this3.unbindFromRedraw('_zoomIn'); - }, 'keyup'); - this.keycharm.bind('num+', function () { - _this3.unbindFromRedraw('_zoomIn'); - }, 'keyup'); - this.keycharm.bind('num-', function () { - _this3.unbindFromRedraw('_zoomOut'); - }, 'keyup'); - this.keycharm.bind('-', function () { - _this3.unbindFromRedraw('_zoomOut'); - }, 'keyup'); - this.keycharm.bind('[', function () { - _this3.unbindFromRedraw('_zoomOut'); - }, 'keyup'); - this.keycharm.bind(']', function () { - _this3.unbindFromRedraw('_zoomIn'); - }, 'keyup'); - this.keycharm.bind('pageup', function () { - _this3.unbindFromRedraw('_zoomIn'); - }, 'keyup'); - this.keycharm.bind('pagedown', function () { - _this3.unbindFromRedraw('_zoomOut'); - }, 'keyup'); + this.keycharm.bind("up", function () { + _this3.bindToRedraw("_moveUp"); + }, "keydown"); + this.keycharm.bind("down", function () { + _this3.bindToRedraw("_moveDown"); + }, "keydown"); + this.keycharm.bind("left", function () { + _this3.bindToRedraw("_moveLeft"); + }, "keydown"); + this.keycharm.bind("right", function () { + _this3.bindToRedraw("_moveRight"); + }, "keydown"); + this.keycharm.bind("=", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("num+", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("num-", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("-", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("[", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + this.keycharm.bind("]", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("pageup", function () { + _this3.bindToRedraw("_zoomIn"); + }, "keydown"); + this.keycharm.bind("pagedown", function () { + _this3.bindToRedraw("_zoomOut"); + }, "keydown"); + + this.keycharm.bind("up", function () { + _this3.unbindFromRedraw("_moveUp"); + }, "keyup"); + this.keycharm.bind("down", function () { + _this3.unbindFromRedraw("_moveDown"); + }, "keyup"); + this.keycharm.bind("left", function () { + _this3.unbindFromRedraw("_moveLeft"); + }, "keyup"); + this.keycharm.bind("right", function () { + _this3.unbindFromRedraw("_moveRight"); + }, "keyup"); + this.keycharm.bind("=", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("num+", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("num-", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("-", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("[", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); + this.keycharm.bind("]", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("pageup", function () { + _this3.unbindFromRedraw("_zoomIn"); + }, "keyup"); + this.keycharm.bind("pagedown", function () { + _this3.unbindFromRedraw("_zoomOut"); + }, "keyup"); } } } @@ -37814,24 +37724,24 @@ return /******/ (function(modules) { // webpackBootstrap this.container.appendChild(this.frame); } + /** + * @param {number} x Horizontal position of the popup window + * @param {number} y Vertical position of the popup window + */ + _createClass(Popup, [{ key: 'setPosition', - - /** - * @param {number} x Horizontal position of the popup window - * @param {number} y Vertical position of the popup window - */ value: function setPosition(x, y) { this.x = parseInt(x); this.y = parseInt(y); } - }, { - key: 'setText', /** * Set the content for the popup window. This can be HTML code or text. * @param {string | Element} content */ + }, { + key: 'setText', value: function setText(content) { if (content instanceof Element) { this.frame.innerHTML = ''; @@ -37840,13 +37750,13 @@ return /******/ (function(modules) { // webpackBootstrap this.frame.innerHTML = content; // string containing text or HTML } } - }, { - key: 'show', /** * Show the popup window * @param {boolean} [doShow] Show or hide the window */ + }, { + key: 'show', value: function show(doShow) { if (doShow === undefined) { doShow = true; @@ -37874,23 +37784,23 @@ return /******/ (function(modules) { // webpackBootstrap left = this.padding; } - this.frame.style.left = left + 'px'; - this.frame.style.top = top + 'px'; - this.frame.style.visibility = 'visible'; + this.frame.style.left = left + "px"; + this.frame.style.top = top + "px"; + this.frame.style.visibility = "visible"; this.hidden = false; } else { this.hide(); } } - }, { - key: 'hide', /** * Hide the popup window */ + }, { + key: 'hide', value: function hide() { this.hidden = true; - this.frame.style.visibility = 'hidden'; + this.frame.style.visibility = "hidden"; } }]); @@ -37947,12 +37857,10 @@ return /******/ (function(modules) { // webpackBootstrap key: "setOptions", value: function setOptions(options) { if (options !== undefined) { - var fields = ["multiselect", "hoverConnectedEdges", "selectable", "selectConnectedEdges"]; + var fields = ['multiselect', 'hoverConnectedEdges', 'selectable', 'selectConnectedEdges']; util.selectiveDeepExtend(fields, this.options, options); } } - }, { - key: "selectOnPoint", /** * handles the selection part of the tap; @@ -37960,6 +37868,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} pointer * @private */ + }, { + key: "selectOnPoint", value: function selectOnPoint(pointer) { var selected = false; if (this.options.selectable === true) { @@ -38006,14 +37916,14 @@ return /******/ (function(modules) { // webpackBootstrap } else { properties = this.getSelection(); } - properties["pointer"] = { + properties['pointer'] = { DOM: { x: pointer.x, y: pointer.y }, canvas: this.canvas.DOMtoCanvas(pointer) }; - properties["event"] = event; + properties['event'] = event; if (oldSelection !== undefined) { - properties["previousSelection"] = oldSelection; + properties['previousSelection'] = oldSelection; } this.body.emitter.emit(eventType, properties); } @@ -38042,8 +37952,6 @@ return /******/ (function(modules) { // webpackBootstrap this._removeFromSelection(obj); } } - }, { - key: "_getAllNodesOverlappingWith", /** * retrieve all nodes overlapping with given object @@ -38051,6 +37959,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Number[]} An array with id's of the overlapping nodes * @private */ + }, { + key: "_getAllNodesOverlappingWith", value: function _getAllNodesOverlappingWith(object) { var overlappingNodes = []; var nodes = this.body.nodes; @@ -38062,8 +37972,6 @@ return /******/ (function(modules) { // webpackBootstrap } return overlappingNodes; } - }, { - key: "_pointerToPositionObject", /** * Return a position object in canvasspace from a single point in screenspace @@ -38072,6 +37980,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {{left: number, top: number, right: number, bottom: number}} * @private */ + }, { + key: "_pointerToPositionObject", value: function _pointerToPositionObject(pointer) { var canvasPos = this.canvas.DOMtoCanvas(pointer); return { @@ -38081,8 +37991,6 @@ return /******/ (function(modules) { // webpackBootstrap bottom: canvasPos.y - 1 }; } - }, { - key: "getNodeAt", /** * Get the top node at the a specific point (like a click) @@ -38091,6 +37999,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Node | undefined} node * @private */ + }, { + key: "getNodeAt", value: function getNodeAt(pointer) { var returnNode = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; @@ -38109,8 +38019,6 @@ return /******/ (function(modules) { // webpackBootstrap return undefined; } } - }, { - key: "_getEdgesOverlappingWith", /** * retrieve all edges overlapping with given object, selector is around center @@ -38118,6 +38026,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Number[]} An array with id's of the overlapping nodes * @private */ + }, { + key: "_getEdgesOverlappingWith", value: function _getEdgesOverlappingWith(object, overlappingEdges) { var edges = this.body.edges; for (var i = 0; i < this.body.edgeIndices.length; i++) { @@ -38127,8 +38037,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "_getAllEdgesOverlappingWith", /** * retrieve all nodes overlapping with given object @@ -38136,13 +38044,13 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Number[]} An array with id's of the overlapping nodes * @private */ + }, { + key: "_getAllEdgesOverlappingWith", value: function _getAllEdgesOverlappingWith(object) { var overlappingEdges = []; this._getEdgesOverlappingWith(object, overlappingEdges); return overlappingEdges; } - }, { - key: "getEdgeAt", /** * Place holder. To implement change the getNodeAt to a _getObjectAt. Have the _getObjectAt call @@ -38152,6 +38060,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {undefined} * @private */ + }, { + key: "getEdgeAt", value: function getEdgeAt(pointer) { var returnEdge = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; @@ -38168,8 +38078,6 @@ return /******/ (function(modules) { // webpackBootstrap return undefined; } } - }, { - key: "_addToSelection", /** * Add object to the selection array. @@ -38177,6 +38085,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param obj * @private */ + }, { + key: "_addToSelection", value: function _addToSelection(obj) { if (obj instanceof Node) { this.selectionObj.nodes[obj.id] = obj; @@ -38184,8 +38094,6 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionObj.edges[obj.id] = obj; } } - }, { - key: "_addToHover", /** * Add object to the selection array. @@ -38193,6 +38101,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param obj * @private */ + }, { + key: "_addToHover", value: function _addToHover(obj) { if (obj instanceof Node) { this.hoverObj.nodes[obj.id] = obj; @@ -38200,8 +38110,6 @@ return /******/ (function(modules) { // webpackBootstrap this.hoverObj.edges[obj.id] = obj; } } - }, { - key: "_removeFromSelection", /** * Remove a single option from selection. @@ -38209,6 +38117,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} obj * @private */ + }, { + key: "_removeFromSelection", value: function _removeFromSelection(obj) { if (obj instanceof Node) { delete this.selectionObj.nodes[obj.id]; @@ -38216,14 +38126,14 @@ return /******/ (function(modules) { // webpackBootstrap delete this.selectionObj.edges[obj.id]; } } - }, { - key: "unselectAll", /** * Unselect all. The selectionObj is useful for this. * * @private */ + }, { + key: "unselectAll", value: function unselectAll() { for (var nodeId in this.selectionObj.nodes) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { @@ -38238,8 +38148,6 @@ return /******/ (function(modules) { // webpackBootstrap this.selectionObj = { nodes: {}, edges: {} }; } - }, { - key: "_getSelectedNodeCount", /** * return the number of selected nodes @@ -38247,6 +38155,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: "_getSelectedNodeCount", value: function _getSelectedNodeCount() { var count = 0; for (var nodeId in this.selectionObj.nodes) { @@ -38256,8 +38166,6 @@ return /******/ (function(modules) { // webpackBootstrap } return count; } - }, { - key: "_getSelectedNode", /** * return the selected node @@ -38265,6 +38173,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: "_getSelectedNode", value: function _getSelectedNode() { for (var nodeId in this.selectionObj.nodes) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { @@ -38273,8 +38183,6 @@ return /******/ (function(modules) { // webpackBootstrap } return undefined; } - }, { - key: "_getSelectedEdge", /** * return the selected edge @@ -38282,6 +38190,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: "_getSelectedEdge", value: function _getSelectedEdge() { for (var edgeId in this.selectionObj.edges) { if (this.selectionObj.edges.hasOwnProperty(edgeId)) { @@ -38290,8 +38200,6 @@ return /******/ (function(modules) { // webpackBootstrap } return undefined; } - }, { - key: "_getSelectedEdgeCount", /** * return the number of selected edges @@ -38299,6 +38207,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: "_getSelectedEdgeCount", value: function _getSelectedEdgeCount() { var count = 0; for (var edgeId in this.selectionObj.edges) { @@ -38308,8 +38218,6 @@ return /******/ (function(modules) { // webpackBootstrap } return count; } - }, { - key: "_getSelectedObjectCount", /** * return the number of selected objects. @@ -38317,6 +38225,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: "_getSelectedObjectCount", value: function _getSelectedObjectCount() { var count = 0; for (var nodeId in this.selectionObj.nodes) { @@ -38331,8 +38241,6 @@ return /******/ (function(modules) { // webpackBootstrap } return count; } - }, { - key: "_selectionIsEmpty", /** * Check if anything is selected @@ -38340,6 +38248,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {boolean} * @private */ + }, { + key: "_selectionIsEmpty", value: function _selectionIsEmpty() { for (var nodeId in this.selectionObj.nodes) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { @@ -38353,8 +38263,6 @@ return /******/ (function(modules) { // webpackBootstrap } return true; } - }, { - key: "_clusterInSelection", /** * check if one of the selected nodes is a cluster. @@ -38362,6 +38270,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {boolean} * @private */ + }, { + key: "_clusterInSelection", value: function _clusterInSelection() { for (var nodeId in this.selectionObj.nodes) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { @@ -38372,8 +38282,6 @@ return /******/ (function(modules) { // webpackBootstrap } return false; } - }, { - key: "_selectConnectedEdges", /** * select the edges connected to the node that is being selected @@ -38381,6 +38289,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Node} node * @private */ + }, { + key: "_selectConnectedEdges", value: function _selectConnectedEdges(node) { for (var i = 0; i < node.edges.length; i++) { var edge = node.edges[i]; @@ -38388,8 +38298,6 @@ return /******/ (function(modules) { // webpackBootstrap this._addToSelection(edge); } } - }, { - key: "_hoverConnectedEdges", /** * select the edges connected to the node that is being selected @@ -38397,6 +38305,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Node} node * @private */ + }, { + key: "_hoverConnectedEdges", value: function _hoverConnectedEdges(node) { for (var i = 0; i < node.edges.length; i++) { var edge = node.edges[i]; @@ -38404,8 +38314,6 @@ return /******/ (function(modules) { // webpackBootstrap this._addToHover(edge); } } - }, { - key: "_unselectConnectedEdges", /** * unselect the edges connected to the node that is being selected @@ -38413,6 +38321,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Node} node * @private */ + }, { + key: "_unselectConnectedEdges", value: function _unselectConnectedEdges(node) { for (var i = 0; i < node.edges.length; i++) { var edge = node.edges[i]; @@ -38420,8 +38330,6 @@ return /******/ (function(modules) { // webpackBootstrap this._removeFromSelection(edge); } } - }, { - key: "blurObject", /** * This is called when someone clicks on a node. either select or deselect it. @@ -38430,6 +38338,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Node || Edge} object * @private */ + }, { + key: "blurObject", value: function blurObject(object) { if (object.hover === true) { object.hover = false; @@ -38440,8 +38350,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: "hoverObject", /** * This is called when someone clicks on a node. either select or deselect it. @@ -38450,6 +38358,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Node || Edge} object * @private */ + }, { + key: "hoverObject", value: function hoverObject(object) { var hoverChanged = false; // remove all node hover highlights @@ -38474,10 +38384,10 @@ return /******/ (function(modules) { // webpackBootstrap } // if the blur remains the same and the object is undefined (mouse off), we blur the edge else if (object === undefined) { - this.blurObject(this.hoverObj.edges[edgeId]); - delete this.hoverObj.edges[edgeId]; - hoverChanged = true; - } + this.blurObject(this.hoverObj.edges[edgeId]); + delete this.hoverObj.edges[edgeId]; + hoverChanged = true; + } } } @@ -38498,24 +38408,22 @@ return /******/ (function(modules) { // webpackBootstrap } if (hoverChanged === true) { - this.body.emitter.emit("_requestRedraw"); + this.body.emitter.emit('_requestRedraw'); } } - }, { - key: "getSelection", /** * * retrieve the currently selected objects * @return {{nodes: Array., edges: Array.}} selection */ + }, { + key: "getSelection", value: function getSelection() { var nodeIds = this.getSelectedNodes(); var edgeIds = this.getSelectedEdges(); return { nodes: nodeIds, edges: edgeIds }; } - }, { - key: "getSelectedNodes", /** * @@ -38523,6 +38431,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {String[]} selection An array with the ids of the * selected nodes. */ + }, { + key: "getSelectedNodes", value: function getSelectedNodes() { var idArray = []; if (this.options.selectable === true) { @@ -38534,8 +38444,6 @@ return /******/ (function(modules) { // webpackBootstrap } return idArray; } - }, { - key: "getSelectedEdges", /** * @@ -38543,6 +38451,8 @@ return /******/ (function(modules) { // webpackBootstrap * @return {Array} selection An array with the ids of the * selected nodes. */ + }, { + key: "getSelectedEdges", value: function getSelectedEdges() { var idArray = []; if (this.options.selectable === true) { @@ -38554,8 +38464,6 @@ return /******/ (function(modules) { // webpackBootstrap } return idArray; } - }, { - key: "selectNodes", /** * select zero or more nodes with the option to highlight edges @@ -38563,13 +38471,15 @@ return /******/ (function(modules) { // webpackBootstrap * selected nodes. * @param {boolean} [highlightEdges] */ + }, { + key: "selectNodes", value: function selectNodes(selection) { var highlightEdges = arguments.length <= 1 || arguments[1] === undefined ? true : arguments[1]; var i = undefined, id = undefined; - if (!selection || selection.length === undefined) throw "Selection must be an array with ids"; + if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; // first unselect any selected node this.unselectAll(); @@ -38579,25 +38489,25 @@ return /******/ (function(modules) { // webpackBootstrap var node = this.body.nodes[id]; if (!node) { - throw new RangeError("Node with id \"" + id + "\" not found"); + throw new RangeError('Node with id "' + id + '" not found'); } this.selectObject(node, highlightEdges); } - this.body.emitter.emit("_requestRedraw"); + this.body.emitter.emit('_requestRedraw'); } - }, { - key: "selectEdges", /** * select zero or more edges * @param {Number[] | String[]} selection An array with the ids of the * selected nodes. */ + }, { + key: "selectEdges", value: function selectEdges(selection) { var i = undefined, id = undefined; - if (!selection || selection.length === undefined) throw "Selection must be an array with ids"; + if (!selection || selection.length === undefined) throw 'Selection must be an array with ids'; // first unselect any selected objects this.unselectAll(); @@ -38607,19 +38517,19 @@ return /******/ (function(modules) { // webpackBootstrap var edge = this.body.edges[id]; if (!edge) { - throw new RangeError("Edge with id \"" + id + "\" not found"); + throw new RangeError('Edge with id "' + id + '" not found'); } this.selectObject(edge); } - this.body.emitter.emit("_requestRedraw"); + this.body.emitter.emit('_requestRedraw'); } - }, { - key: "updateSelection", /** * Validate the selection: remove ids of nodes which no longer exist * @private */ + }, { + key: "updateSelection", value: function updateSelection() { for (var nodeId in this.selectionObj.nodes) { if (this.selectionObj.nodes.hasOwnProperty(nodeId)) { @@ -38831,8 +38741,6 @@ return /******/ (function(modules) { // webpackBootstrap value: function getSeed() { return this.initialRandomSeed; } - }, { - key: 'setupHierarchicalLayout', /** * This is the main function to layout the nodes in a hierarchical way. @@ -38840,6 +38748,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: 'setupHierarchicalLayout', value: function setupHierarchicalLayout() { if (this.options.hierarchical.enabled === true && this.body.nodeIndices.length > 0) { // get the size of the largest hubs and check if the user has defined a level for a node. @@ -38887,8 +38797,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_placeNodesByHierarchy', /** * This function places the nodes on the canvas based on the hierarchial distribution. @@ -38896,6 +38804,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param {Object} distribution | obtained by the function this._getDistribution() * @private */ + }, { + key: '_placeNodesByHierarchy', value: function _placeNodesByHierarchy(distribution) { var nodeId = undefined, node = undefined; @@ -38927,8 +38837,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_getDistribution', /** * This function get the distribution of levels based on hubsize @@ -38936,6 +38844,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {Object} * @private */ + }, { + key: '_getDistribution', value: function _getDistribution() { var distribution = {}; var nodeId = undefined, @@ -38963,8 +38873,6 @@ return /******/ (function(modules) { // webpackBootstrap } return distribution; } - }, { - key: '_getHubSize', /** * Get the hubsize from all remaining unlevelled nodes. @@ -38972,6 +38880,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {number} * @private */ + }, { + key: '_getHubSize', value: function _getHubSize() { var hubSize = 0; for (var nodeId in this.body.nodes) { @@ -38984,8 +38894,6 @@ return /******/ (function(modules) { // webpackBootstrap } return hubSize; } - }, { - key: '_determineLevelsByHubsize', /** * this function allocates nodes in levels based on the recursive branching from the largest hubs. @@ -38993,6 +38901,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param hubsize * @private */ + }, { + key: '_determineLevelsByHubsize', value: function _determineLevelsByHubsize() { var nodeId = undefined, node = undefined; @@ -39013,8 +38923,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_setLevelByHubsize', /** * this function is called recursively to enumerate the barnches of the largest hubs and give each node a level. @@ -39024,6 +38932,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentId * @private */ + }, { + key: '_setLevelByHubsize', value: function _setLevelByHubsize(level, node) { if (this.hierarchicalLevels[node.id] !== undefined) return; @@ -39038,8 +38948,6 @@ return /******/ (function(modules) { // webpackBootstrap this._setLevelByHubsize(level + 1, childNode); } } - }, { - key: '_determineLevelsDirected', /** * this function allocates nodes in levels based on the direction of the edges @@ -39047,6 +38955,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param hubsize * @private */ + }, { + key: '_determineLevelsDirected', value: function _determineLevelsDirected() { var nodeId = undefined, node = undefined; @@ -39074,8 +38984,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_setLevelDirected', /** * this function is called recursively to enumerate the branched of the first node and give each node a level based on edge direction @@ -39085,6 +38993,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentId * @private */ + }, { + key: '_setLevelDirected', value: function _setLevelDirected(level, node) { if (this.hierarchicalLevels[node.id] !== undefined) return; @@ -39101,8 +39011,6 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: '_placeBranchNodes', /** * This is a recursively called function to enumerate the branches from the largest hubs and place the nodes @@ -39114,6 +39022,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param parentLevel * @private */ + }, { + key: '_placeBranchNodes', value: function _placeBranchNodes(edges, parentId, distribution, parentLevel) { for (var i = 0; i < edges.length; i++) { var childNode = undefined; @@ -39235,13 +39145,13 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.on('_resetData', this._restore.bind(this)); } + /** + * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes. + * @private + */ + _createClass(ManipulationSystem, [{ key: '_restore', - - /** - * If something changes in the data during editing, switch back to the initial datamanipulation state and close all edit modes. - * @private - */ value: function _restore() { if (this.inMode !== false) { if (this.options.initiallyActive === true) { @@ -39251,13 +39161,13 @@ return /******/ (function(modules) { // webpackBootstrap } } } - }, { - key: 'setOptions', /** * Set the Options * @param options */ + }, { + key: 'setOptions', value: function setOptions(options, allOptions, globalOptions) { if (allOptions !== undefined) { if (allOptions.locale !== undefined) { @@ -39285,14 +39195,14 @@ return /******/ (function(modules) { // webpackBootstrap this._setup(); } } - }, { - key: 'toggleEditMode', /** * Enable or disable edit-mode. Draws the DOM required and cleans up after itself. * * @private */ + }, { + key: 'toggleEditMode', value: function toggleEditMode() { if (this.editMode === true) { this.disableEditMode(); @@ -39326,14 +39236,14 @@ return /******/ (function(modules) { // webpackBootstrap this._createEditButton(); } } - }, { - key: 'showManipulatorToolbar', /** * Creates the main toolbar. Removes functions bound to the select event. Binds all the buttons of the toolbar. * * @private */ + }, { + key: 'showManipulatorToolbar', value: function showManipulatorToolbar() { // restore the state of any bound functions or events, remove control nodes, restore physics this._clean(); @@ -39408,14 +39318,14 @@ return /******/ (function(modules) { // webpackBootstrap // redraw to show any possible changes this.body.emitter.emit('_redraw'); } - }, { - key: 'addNodeMode', /** * Create the toolbar for adding Nodes * * @private */ + }, { + key: 'addNodeMode', value: function addNodeMode() { // when using the gui, enable edit mode if it wasnt already. if (this.editMode !== true) { @@ -39439,14 +39349,14 @@ return /******/ (function(modules) { // webpackBootstrap this._temporaryBindEvent('click', this._performAddNode.bind(this)); } - }, { - key: 'editNode', /** * call the bound function to handle the editing of the node. The node has to be selected. * * @private */ + }, { + key: 'editNode', value: function editNode() { var _this2 = this; @@ -39487,14 +39397,14 @@ return /******/ (function(modules) { // webpackBootstrap this.showManipulatorToolbar(); } } - }, { - key: 'addEdgeMode', /** * create the toolbar to connect nodes * * @private */ + }, { + key: 'addEdgeMode', value: function addEdgeMode() { // when using the gui, enable edit mode if it wasnt already. if (this.editMode !== true) { @@ -39525,14 +39435,14 @@ return /******/ (function(modules) { // webpackBootstrap this._temporaryBindUI('onDragStart', function () {}); this._temporaryBindUI('onHold', function () {}); } - }, { - key: 'editEdgeMode', /** * create the toolbar to edit edges * * @private */ + }, { + key: 'editEdgeMode', value: function editEdgeMode() { var _this3 = this; @@ -39602,14 +39512,14 @@ return /******/ (function(modules) { // webpackBootstrap this.showManipulatorToolbar(); } } - }, { - key: 'deleteSelected', /** * delete everything in the selection * * @private */ + }, { + key: 'deleteSelected', value: function deleteSelected() { var _this4 = this; @@ -39667,8 +39577,6 @@ return /******/ (function(modules) { // webpackBootstrap this.showManipulatorToolbar(); } } - }, { - key: '_setup', //********************************************** PRIVATE ***************************************// @@ -39676,6 +39584,8 @@ return /******/ (function(modules) { // webpackBootstrap * draw or remove the DOM * @private */ + }, { + key: '_setup', value: function _setup() { if (this.options.enabled === true) { // Enable the GUI @@ -39694,13 +39604,13 @@ return /******/ (function(modules) { // webpackBootstrap this.guiEnabled = false; } } - }, { - key: '_createWrappers', /** * create the div overlays that contain the DOM * @private */ + }, { + key: '_createWrappers', value: function _createWrappers() { // load the manipulator HTML elements. All styling done in css. if (this.manipulationDiv === undefined) { @@ -39734,8 +39644,6 @@ return /******/ (function(modules) { // webpackBootstrap this.canvas.frame.appendChild(this.closeDiv); } } - }, { - key: '_getNewTargetNode', /** * generate a new target node. Used for creating new edges and editing edges @@ -39744,6 +39652,8 @@ return /******/ (function(modules) { // webpackBootstrap * @returns {*} * @private */ + }, { + key: '_getNewTargetNode', value: function _getNewTargetNode(x, y) { var controlNodeStyle = util.deepExtend({}, this.options.controlNodeStyle); @@ -39755,12 +39665,12 @@ return /******/ (function(modules) { // webpackBootstrap return this.body.functions.createNode(controlNodeStyle); } - }, { - key: '_createEditButton', /** * Create the edit button */ + }, { + key: '_createEditButton', value: function _createEditButton() { // restore everything to it's original state (if applicable) this._clean(); @@ -39779,13 +39689,13 @@ return /******/ (function(modules) { // webpackBootstrap // bind a hammer listener to the button, calling the function toggleEditMode. this._bindHammerToDiv(button, this.toggleEditMode.bind(this)); } - }, { - key: '_clean', /** * this function cleans up after everything this module does. Temporary elements, functions and events are removed, physics restored, hammers removed. * @private */ + }, { + key: '_clean', value: function _clean() { // not in mode this.inMode = false; @@ -39811,13 +39721,13 @@ return /******/ (function(modules) { // webpackBootstrap // restore the physics if required this.body.emitter.emit('restorePhysics'); } - }, { - key: '_cleanManipulatorHammers', /** * Each dom element has it's own hammer. They are stored in this.manipulationHammers. This cleans them up. * @private */ + }, { + key: '_cleanManipulatorHammers', value: function _cleanManipulatorHammers() { // _clean hammer bindings if (this.manipulationHammers.length != 0) { @@ -39827,13 +39737,13 @@ return /******/ (function(modules) { // webpackBootstrap this.manipulationHammers = []; } } - }, { - key: '_removeManipulationDOM', /** * Remove all DOM elements created by this module. * @private */ + }, { + key: '_removeManipulationDOM', value: function _removeManipulationDOM() { // removes all the bindings and overloads this._clean(); @@ -39859,14 +39769,14 @@ return /******/ (function(modules) { // webpackBootstrap this.editModeDiv = undefined; this.closeDiv = undefined; } - }, { - key: '_createSeperator', /** * create a seperator line. the index is to differentiate in the manipulation dom * @param index * @private */ + }, { + key: '_createSeperator', value: function _createSeperator() { var index = arguments.length <= 0 || arguments[0] === undefined ? 1 : arguments[0]; @@ -39874,11 +39784,11 @@ return /******/ (function(modules) { // webpackBootstrap this.manipulationDOM['seperatorLineDiv' + index].className = 'vis-separator-line'; this.manipulationDiv.appendChild(this.manipulationDOM['seperatorLineDiv' + index]); } - }, { - key: '_createAddNodeButton', // ---------------------- DOM functions for buttons --------------------------// + }, { + key: '_createAddNodeButton', value: function _createAddNodeButton(locale) { var button = this._createButton('addNode', 'vis-button vis-add', locale['addNode'] || this.options.locales['en']['addNode']); this.manipulationDiv.appendChild(button); @@ -39937,8 +39847,6 @@ return /******/ (function(modules) { // webpackBootstrap value: function _createDescription(label) { this.manipulationDiv.appendChild(this._createButton('description', 'vis-button vis-none', label)); } - }, { - key: '_temporaryBindEvent', // -------------------------- End of DOM functions for buttons ------------------------------// @@ -39948,12 +39856,12 @@ return /******/ (function(modules) { // webpackBootstrap * @param newFunction * @private */ + }, { + key: '_temporaryBindEvent', value: function _temporaryBindEvent(event, newFunction) { this.temporaryEventFunctions.push({ event: event, boundFunction: newFunction }); this.body.emitter.on(event, newFunction); } - }, { - key: '_temporaryBindUI', /** * this overrides an UI function until cleanup by the clean function @@ -39961,6 +39869,8 @@ return /******/ (function(modules) { // webpackBootstrap * @param newFunction * @private */ + }, { + key: '_temporaryBindUI', value: function _temporaryBindUI(UIfunctionName, newFunction) { if (this.body.eventListeners[UIfunctionName] !== undefined) { this.temporaryUIFunctions[UIfunctionName] = this.body.eventListeners[UIfunctionName]; @@ -39969,14 +39879,14 @@ return /******/ (function(modules) { // webpackBootstrap throw new Error('This UI function does not exist. Typo? You tried: ' + UIfunctionName + ' possible are: ' + JSON.stringify(Object.keys(this.body.eventListeners))); } } - }, { - key: '_unbindTemporaryUIs', /** * Restore the overridden UI functions to their original state. * * @private */ + }, { + key: '_unbindTemporaryUIs', value: function _unbindTemporaryUIs() { for (var functionName in this.temporaryUIFunctions) { if (this.temporaryUIFunctions.hasOwnProperty(functionName)) { @@ -39986,13 +39896,13 @@ return /******/ (function(modules) { // webpackBootstrap } this.temporaryUIFunctions = {}; } - }, { - key: '_unbindTemporaryEvents', /** * Unbind the events created by _temporaryBindEvent * @private */ + }, { + key: '_unbindTemporaryEvents', value: function _unbindTemporaryEvents() { for (var i = 0; i < this.temporaryEventFunctions.length; i++) { var eventName = this.temporaryEventFunctions[i].event; @@ -40001,26 +39911,26 @@ return /******/ (function(modules) { // webpackBootstrap } this.temporaryEventFunctions = []; } - }, { - key: '_bindHammerToDiv', /** * Bind an hammer instance to a DOM element. * @param domElement * @param funct */ + }, { + key: '_bindHammerToDiv', value: function _bindHammerToDiv(domElement, boundFunction) { var hammer = new Hammer(domElement, {}); hammerUtil.onTouch(hammer, boundFunction); this.manipulationHammers.push(hammer); } - }, { - key: '_cleanupTemporaryNodesAndEdges', /** * Neatly clean up temporary edges and nodes * @private */ + }, { + key: '_cleanupTemporaryNodesAndEdges', value: function _cleanupTemporaryNodesAndEdges() { // _clean temporary edges for (var i = 0; i < this.temporaryIds.edges.length; i++) { @@ -40043,8 +39953,6 @@ return /******/ (function(modules) { // webpackBootstrap this.temporaryIds = { nodes: [], edges: [] }; } - }, { - key: '_controlNodeTouch', // ------------------------------------------ EDIT EDGE FUNCTIONS -----------------------------------------// @@ -40053,19 +39961,21 @@ return /******/ (function(modules) { // webpackBootstrap * @param event * @private */ + }, { + key: '_controlNodeTouch', value: function _controlNodeTouch(event) { this.selectionHandler.unselectAll(); this.lastTouch = this.body.functions.getPointer(event.center); this.lastTouch.translation = util.extend({}, this.body.view.translation); // copy the object } - }, { - key: '_controlNodeDragStart', /** * the drag start is used to mark one of the control nodes as selected. * @param event * @private */ + }, { + key: '_controlNodeDragStart', value: function _controlNodeDragStart(event) { var pointer = this.lastTouch; var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); @@ -40087,14 +39997,14 @@ return /******/ (function(modules) { // webpackBootstrap this.body.emitter.emit('_redraw'); } - }, { - key: '_controlNodeDrag', /** * dragging the control nodes or the canvas * @param event * @private */ + }, { + key: '_controlNodeDrag', value: function _controlNodeDrag(event) { this.body.emitter.emit('disablePhysics'); var pointer = this.body.functions.getPointer(event.center); @@ -40111,14 +40021,14 @@ return /******/ (function(modules) { // webpackBootstrap } this.body.emitter.emit('_redraw'); } - }, { - key: '_controlNodeDragEnd', /** * connecting or restoring the control nodes. * @param event * @private */ + }, { + key: '_controlNodeDragEnd', value: function _controlNodeDragEnd(event) { var pointer = this.body.functions.getPointer(event.center); var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); @@ -40151,8 +40061,6 @@ return /******/ (function(modules) { // webpackBootstrap } this.body.emitter.emit('_redraw'); } - }, { - key: '_handleConnect', // ------------------------------------ END OF EDIT EDGE FUNCTIONS -----------------------------------------// @@ -40163,6 +40071,8 @@ return /******/ (function(modules) { // webpackBootstrap * * @private */ + }, { + key: '_handleConnect', value: function _handleConnect(event) { // check to avoid double fireing of this function. if (new Date().valueOf() - this.touchTime > 100) { @@ -40218,14 +40128,14 @@ return /******/ (function(modules) { // webpackBootstrap this.body.view.translation = { x: this.lastTouch.translation.x + diffX, y: this.lastTouch.translation.y + diffY }; } } - }, { - key: '_finishConnect', /** * Connect the new edge to the target if one exists, otherwise remove temp line * @param event * @private */ + }, { + key: '_finishConnect', value: function _finishConnect(event) { var pointer = this.body.functions.getPointer(event.center); var pointerObj = this.selectionHandler._pointerToPositionObject(pointer); @@ -40262,8 +40172,6 @@ return /******/ (function(modules) { // webpackBootstrap } this.body.emitter.emit('_redraw'); } - }, { - key: '_performAddNode', // --------------------------------------- END OF ADD EDGE FUNCTIONS -------------------------------------// @@ -40272,6 +40180,8 @@ return /******/ (function(modules) { // webpackBootstrap /** * Adds a node on the specified location */ + }, { + key: '_performAddNode', value: function _performAddNode(clickData) { var _this5 = this; @@ -40300,14 +40210,14 @@ return /******/ (function(modules) { // webpackBootstrap this.showManipulatorToolbar(); } } - }, { - key: '_performAddEdge', /** * connect two nodes with a new edge. * * @private */ + }, { + key: '_performAddEdge', value: function _performAddEdge(sourceNodeId, targetNodeId) { var _this6 = this; @@ -40331,14 +40241,14 @@ return /******/ (function(modules) { // webpackBootstrap this.showManipulatorToolbar(); } } - }, { - key: '_performEditEdge', /** * connect two nodes with a new edge. * * @private */ + }, { + key: '_performEditEdge', value: function _performEditEdge(sourceNodeId, targetNodeId) { var _this7 = this; @@ -41507,10 +41417,10 @@ return /******/ (function(modules) { // webpackBootstrap if (token === 'false') { token = false; // convert to boolean } else if (token === 'true') { - token = true; // convert to boolean - } else if (!isNaN(Number(token))) { - token = Number(token); // convert to number - } + token = true; // convert to boolean + } else if (!isNaN(Number(token))) { + token = Number(token); // convert to number + } tokenType = TOKENTYPE.IDENTIFIER; return; } @@ -41652,8 +41562,8 @@ return /******/ (function(modules) { // webpackBootstrap getToken(); // TODO: implement comma separated list with "a_list: ID=ID [','] [a_list] " } else { - parseNodeStatement(graph, id); - } + parseNodeStatement(graph, id); + } } /** @@ -42153,13 +42063,13 @@ return /******/ (function(modules) { // webpackBootstrap this.callback = callback; } + /** + * @param {string} url The Url to cache the image as + * @return {Image} imageToLoadBrokenUrlOn The image object + */ + _createClass(Images, [{ key: "_addImageToCache", - - /** - * @param {string} url The Url to cache the image as - * @return {Image} imageToLoadBrokenUrlOn The image object - */ value: function _addImageToCache(url, imageToCache) { // IE11 fix -- thanks dponch! if (imageToCache.width === 0) { @@ -42171,14 +42081,14 @@ return /******/ (function(modules) { // webpackBootstrap this.images[url] = imageToCache; } - }, { - key: "_tryloadBrokenUrl", /** * @param {string} url The original Url that failed to load, if the broken image is successfully loaded it will be added to the cache using this Url as the key so that subsequent requests for this Url will return the broken image * @param {string} brokenUrl Url the broken image to try and load * @return {Image} imageToLoadBrokenUrlOn The image object */ + }, { + key: "_tryloadBrokenUrl", value: function _tryloadBrokenUrl(url, brokenUrl, imageToLoadBrokenUrlOn) { var _this = this; @@ -42195,25 +42105,25 @@ return /******/ (function(modules) { // webpackBootstrap //Set the source of the image to the brokenUrl, this is actually what kicks off the loading of the broken image imageToLoadBrokenUrlOn.src = brokenUrl; } - }, { - key: "_redrawWithImage", /** * @return {Image} imageToRedrawWith The images that will be passed to the callback when it is invoked */ + }, { + key: "_redrawWithImage", value: function _redrawWithImage(imageToRedrawWith) { if (this.callback) { this.callback(imageToRedrawWith); } } - }, { - key: "load", /** * @param {string} url Url of the image * @param {string} brokenUrl Url of an image to use if the url image is not found * @return {Image} img The image object */ + }, { + key: "load", value: function load(url, brokenUrl, id) { var _this2 = this;