- Updated __init__.py to use simplified loading approach - Fixed import paths to use direct imports instead of relative imports - Added debug logging for better troubleshooting - Simplified node registration process - Fixed utils.js export issue 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
47 lines
991 B
JavaScript
47 lines
991 B
JavaScript
/* modules/utils.js - Utility functions and classes */
|
|
|
|
// DOM manipulation utilities
|
|
export class DOMUtils {
|
|
static styleElement(element, styles) {
|
|
Object.assign(element.style, styles);
|
|
}
|
|
|
|
static createElement(tag, styles = {}, attributes = {}) {
|
|
const element = document.createElement(tag);
|
|
this.styleElement(element, styles);
|
|
Object.entries(attributes).forEach(([key, value]) => {
|
|
element[key] = value;
|
|
});
|
|
return element;
|
|
}
|
|
}
|
|
|
|
// Logging utilities
|
|
export class LogUtils {
|
|
static logDebug(...args) {
|
|
console.log("[PoseAlign Widget]", ...args);
|
|
}
|
|
|
|
static logError(...args) {
|
|
console.error("[PoseAlign Widget]", ...args);
|
|
}
|
|
|
|
static logWarn(...args) {
|
|
console.warn("[PoseAlign Widget]", ...args);
|
|
}
|
|
}
|
|
|
|
// Math utilities
|
|
export class MathUtils {
|
|
static clamp(value, min, max) {
|
|
return Math.max(min, Math.min(max, value));
|
|
}
|
|
|
|
static degToRad(degrees) {
|
|
return degrees * Math.PI / 180;
|
|
}
|
|
|
|
static radToDeg(radians) {
|
|
return radians * 180 / Math.PI;
|
|
}
|
|
} |