Finish initial conversion to clusterize using data loader. Need to fix bugs.

This commit is contained in:
Sj-Si 2024-04-12 12:40:20 -04:00
parent fc7a8a41e5
commit 5e4dfee153
9 changed files with 643 additions and 566 deletions

View file

@ -154,10 +154,17 @@ function querySelectorThrowError(selector) {
}
/** Functions for getting dimensions of elements. */
function getStyle(elem) {
return window.getComputedStyle ? window.getComputedStyle(elem) : elem.currentStyle;
}
function getComputedProperty(elem, prop) {
return getStyle(elem)[prop];
}
function getComputedPropertyDims(elem, prop) {
/** Returns the top/left/bottom/right float dimensions of an element for the specified property. */
const style = window.getComputedStyle(elem, null);
const style = getStyle(elem);
return {
top: parseFloat(style.getPropertyValue(`${prop}-top`)),
left: parseFloat(style.getPropertyValue(`${prop}-left`)),
@ -209,19 +216,6 @@ function getComputedDims(elem) {
};
}
function calcColsPerRow(parent, child) {
/** Calculates the number of columns of children that can fit in a parent's visible width. */
const parent_inner_width = parent.offsetWidth - getComputedPaddingDims(parent).width;
return parseInt(parent_inner_width / getComputedDims(child).width, 10);
}
function calcRowsPerCol(parent, child) {
/** Calculates the number of rows of children that can fit in a parent's visible height. */
const parent_inner_height = parent.offsetHeight - getComputedPaddingDims(parent).height;
return parseInt(parent_inner_height / getComputedDims(child).height, 10);
}
/** Functions for asynchronous operations. */
function debounce(handler, timeout_ms) {
@ -394,10 +388,6 @@ function clamp(x, min, max) {
return Math.max(min, Math.min(x, max));
}
function getStyle(prop, elem) {
return window.getComputedStyle ? window.getComputedStyle(elem)[prop] : elem.currentStyle[prop];
}
function htmlStringToElement(s) {
/** Converts an HTML string into an Element type. */
let parser = new DOMParser();