update
This commit is contained in:
@@ -5,12 +5,23 @@
|
||||
};
|
||||
}
|
||||
|
||||
window.getElementBoundingRect = (element) => {
|
||||
const rect = element.getBoundingClientRect();
|
||||
return {
|
||||
width: rect.width,
|
||||
height: rect.height,
|
||||
x: rect.x,
|
||||
y: rect.y,
|
||||
left: rect.left,
|
||||
top: rect.top
|
||||
};
|
||||
}
|
||||
|
||||
window.setCanvasSize = (canvas, width, height) => {
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
}
|
||||
|
||||
// Image loading and caching functionality
|
||||
window.imageCache = new Map();
|
||||
|
||||
window.preloadImage = (imagePath) => {
|
||||
@@ -47,11 +58,6 @@ window.preloadImageFromUrl = (url, cacheKey) => {
|
||||
img.onerror = (error) => {
|
||||
reject(new Error(`Failed to load image from URL: ${url}`));
|
||||
};
|
||||
|
||||
// Don't set crossOrigin for same-origin requests
|
||||
// Only set it if you're loading from a different domain
|
||||
// img.crossOrigin = 'anonymous';
|
||||
|
||||
img.src = url;
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user