From f7d1b46753c184795aa8decb10795fc90c72f420 Mon Sep 17 00:00:00 2001 From: Alex de Mulder Date: Thu, 16 Jul 2015 18:37:58 +0200 Subject: [PATCH] added configChange event --- HISTORY.md | 1 + dist/vis.js | 5 +++++ docs/network/index.html | 11 +++++++++++ lib/shared/Configurator.js | 5 +++++ 4 files changed, 22 insertions(+) diff --git a/HISTORY.md b/HISTORY.md index d5dea88e..71d32b62 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -14,6 +14,7 @@ http://visjs.org - Added shapeProperties, thanks @zukomgwili! - Fixed missing edges during clustering. - Fixed missing refresh of node data when changing hierarchical layout on the fly. +- Added configChange event. ### Graph3d diff --git a/dist/vis.js b/dist/vis.js index 24423558..227d3258 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -21696,6 +21696,11 @@ return /******/ (function(modules) { // webpackBootstrap */ 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.setOptions(options); } }, { diff --git a/docs/network/index.html b/docs/network/index.html index 7bd6be34..5be32950 100644 --- a/docs/network/index.html +++ b/docs/network/index.html @@ -1398,6 +1398,17 @@ var options = { animationFinished none Fired when an animation is finished. + + + Event triggered by the configuration module. + + configChange + Object + Fired when a user changes any option in the configurator. The options object can be used with the setOptions method or stringified using JSON.stringify(). + You do not have to manually put the options into the network: this is done automatically. You can use the event + to store user options in the database. + + diff --git a/lib/shared/Configurator.js b/lib/shared/Configurator.js index 79676f9f..e1d7f2bb 100644 --- a/lib/shared/Configurator.js +++ b/lib/shared/Configurator.js @@ -572,6 +572,11 @@ class Configurator { */ _update(value, path) { let 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.setOptions(options); }