StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
StackGenVis/frontend/node_modules/element-size/index.js

34 lines
928 B

module.exports = getSize
function getSize(element) {
// Handle cases where the element is not already
// attached to the DOM by briefly appending it
// to document.body, and removing it again later.
if (element === window || element === document.body) {
return [window.innerWidth, window.innerHeight]
}
if (!element.parentNode) {
var temporary = true
document.body.appendChild(element)
}
var bounds = element.getBoundingClientRect()
var styles = getComputedStyle(element)
var height = (bounds.height|0)
+ parse(styles.getPropertyValue('margin-top'))
+ parse(styles.getPropertyValue('margin-bottom'))
var width = (bounds.width|0)
+ parse(styles.getPropertyValue('margin-left'))
+ parse(styles.getPropertyValue('margin-right'))
if (temporary) {
document.body.removeChild(element)
}
return [width, height]
}
function parse(prop) {
return parseFloat(prop) || 0
}