This commit is contained in:
Đăng Nguyễn
2025-12-30 17:38:43 +07:00
parent b3f765d261
commit 15a61fd986
8 changed files with 169 additions and 16 deletions

View File

@@ -55,6 +55,23 @@ window.robotMonitor = {
}
return `M ${startX} ${startY} L ${endX} ${endY}`;
},
// Load image and get dimensions
loadImageAndGetDimensions: function (imageUrl) {
return new Promise((resolve, reject) => {
const img = new Image();
img.onload = () => {
resolve({
Width: img.naturalWidth || img.width,
Height: img.naturalHeight || img.height
});
};
img.onerror = () => {
reject(new Error(`Failed to load image: ${imageUrl}`));
};
img.src = imageUrl;
});
}
};
@@ -65,3 +82,4 @@ window.robotMonitor = {