Newer
Older
export { getWidth, getHeight, getCanvasDivNode, createDiv };
/**
* Returns the maximum width that should be used if displaying elements inside of wordpress.
* @returns {number}
*/
return document.getElementById("3d-graph").offsetWidth;
/**
* Returns the maximum height that should be used if displaying elements inside of wordpress.
* @returns {number}
*/
return window.innerHeight - 200;
/**
* Returns the div node which encapsulates the canvas the 3d-force-graph is drawn on.
* @returns {ChildNode}
*/
const domNode = document.getElementById("3d-graph");
}
/**
* Creates a new div element.
* @param {string} className Class name of the new div element.
* @param {HTMLDivElement} parent Optional parent element of the new div.
* @returns {HTMLDivElement} The new div element.
*/
function createDiv(className, parent) {
const node = document.createElement("div");
node.className = className;
if (typeof parent !== "undefined") {
parent.appendChild(node);
}
return node;
}