Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_clean() {
// not in mode
this.inMode = false;
// _clean the divs
if (this.guiEnabled === true) {
util.recursiveDOMDelete(this.editModeDiv);
util.recursiveDOMDelete(this.manipulationDiv);
// removes all the bindings and overloads
this._cleanManipulatorHammers();
}
// remove temporary nodes and edges
this._cleanupTemporaryNodesAndEdges();
// restore overloaded UI functions
this._unbindTemporaryUIs();
// remove the temporaryEventFunctions
this._unbindTemporaryEvents();
// restore the physics if required
this.body.emitter.emit('restorePhysics');
_createEditButton() {
// restore everything to it's original state (if applicable)
this._clean();
// reset the manipulationDOM
this.manipulationDOM = {};
// empty the editModeDiv
util.recursiveDOMDelete(this.editModeDiv);
// create the contents for the editMode button
let locale = this.options.locales[this.options.locale];
let button = this._createButton('editMode', 'vis-button vis-edit vis-edit-mode', locale['edit'] || this.options.locales['en']['edit']);
this.editModeDiv.appendChild(button);
// bind a hammer listener to the button, calling the function toggleEditMode.
this._bindHammerToDiv(button, this.toggleEditMode.bind(this));
}
_removeManipulationDOM() {
// removes all the bindings and overloads
this._clean();
// empty the manipulation divs
util.recursiveDOMDelete(this.manipulationDiv);
util.recursiveDOMDelete(this.editModeDiv);
util.recursiveDOMDelete(this.closeDiv);
// remove the manipulation divs
if (this.manipulationDiv) {this.canvas.frame.removeChild(this.manipulationDiv);}
if (this.editModeDiv) {this.canvas.frame.removeChild(this.editModeDiv);}
if (this.closeDiv) {this.canvas.frame.removeChild(this.closeDiv);}
// set the references to undefined
this.manipulationDiv = undefined;
this.editModeDiv = undefined;
this.closeDiv = undefined;
}
_removeManipulationDOM() {
// removes all the bindings and overloads
this._clean();
// empty the manipulation divs
util.recursiveDOMDelete(this.manipulationDiv);
util.recursiveDOMDelete(this.editModeDiv);
util.recursiveDOMDelete(this.closeDiv);
// remove the manipulation divs
if (this.manipulationDiv) {this.canvas.frame.removeChild(this.manipulationDiv);}
if (this.editModeDiv) {this.canvas.frame.removeChild(this.editModeDiv);}
if (this.closeDiv) {this.canvas.frame.removeChild(this.closeDiv);}
// set the references to undefined
this.manipulationDiv = undefined;
this.editModeDiv = undefined;
this.closeDiv = undefined;
}
_removeManipulationDOM() {
// removes all the bindings and overloads
this._clean();
// empty the manipulation divs
util.recursiveDOMDelete(this.manipulationDiv);
util.recursiveDOMDelete(this.editModeDiv);
util.recursiveDOMDelete(this.closeDiv);
// remove the manipulation divs
if (this.manipulationDiv) {this.canvas.frame.removeChild(this.manipulationDiv);}
if (this.editModeDiv) {this.canvas.frame.removeChild(this.editModeDiv);}
if (this.closeDiv) {this.canvas.frame.removeChild(this.closeDiv);}
// set the references to undefined
this.manipulationDiv = undefined;
this.editModeDiv = undefined;
this.closeDiv = undefined;
}
_clean() {
// not in mode
this.inMode = false;
// _clean the divs
if (this.guiEnabled === true) {
util.recursiveDOMDelete(this.editModeDiv);
util.recursiveDOMDelete(this.manipulationDiv);
// removes all the bindings and overloads
this._cleanManipulatorHammers();
}
// remove temporary nodes and edges
this._cleanupTemporaryNodesAndEdges();
// restore overloaded UI functions
this._unbindTemporaryUIs();
// remove the temporaryEventFunctions
this._unbindTemporaryEvents();
// restore the physics if required
delete this.edgesHandler;
delete this.configurator;
delete this.images;
for (var nodeId in this.body.nodes) {
if (!this.body.nodes.hasOwnProperty(nodeId)) continue;
delete this.body.nodes[nodeId];
}
for (var edgeId in this.body.edges) {
if (!this.body.edges.hasOwnProperty(edgeId)) continue;
delete this.body.edges[edgeId];
}
// remove the container and everything inside it recursively
util.recursiveDOMDelete(this.body.container);
};