-
-
Notifications
You must be signed in to change notification settings - Fork 363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement equipable (composable) viewer. #5530
Comments
@vikiival how do we get the equipable item list? |
to get the inventory
To find out which are equipped I will do it today: |
Found the React code by RMRK CTO We may need similar package |
this is my snippet code, to merge the images. not tested // List of image URLs
const imageURLs = [
'path/to/image1.jpg',
'path/to/image2.jpg',
// ...
];
// Load all images
const loadImages = (imageURLs) => {
const images = imageURLs.map((url) => {
const img = new Image();
img.src = url;
return new Promise((resolve, reject) => {
img.onload = () => resolve(img);
img.onerror = () => reject(new Error(`Failed to load image: ${url}`));
});
});
return Promise.all(images);
};
// Combine images into one
const combineImages = async (imageURLs) => {
const images = await loadImages(imageURLs);
// Calculate the combined width and maximum height of the images
const combinedWidth = images.reduce((width, img) => width + img.width, 0);
const maxHeight = Math.max(...images.map(img => img.height));
// Create an offscreen canvas
const offscreenCanvas = new OffscreenCanvas(combinedWidth, maxHeight);
const ctx = offscreenCanvas.getContext('2d');
// Draw images on the canvas side by side
let currentX = 0;
images.forEach((img) => {
ctx.drawImage(img, currentX, 0);
currentX += img.width;
});
// Get the combined image as a data URL
const dataURL = offscreenCanvas.toDataURL('image/png');
return dataURL;
};
// Check for OffscreenCanvas support
if (typeof OffscreenCanvas !== 'undefined') {
// Example usage
combineImages(imageURLs).then((dataURL) => {
// Do something with the combined image data URL
console.log(dataURL);
});
} else {
// OffscreenCanvas is not supported, handle the fallback or show an error message
console.error('Your browser does not support OffscreenCanvas.');
} |
cc @preschian I also made a resolver for this case URL: query MyQuery {
childListByNftId(id: "12126283-7472058104f9f93924-SKC-soldier_1-00000001") {
id
name
image
media
pending
resourceMetadata
resourceSrc
resourceThumb
}
} |
👋 |
ASSIGNED - @Matehoo 🔒 LOCKED -> Friday, April 21st 2023, 09:58:13 UTC -> 24 hours |
ASSIGNMENT EXPIRED - @Matehoo has been unassigned. |
I don't see items equipped on the subtraknights in https://rmrk2.kodadot.xyz/rmrk2/collection/7472058104f9f93924-SKC?page=11
See comparaison with Singular:
https://rmrk2.kodadot.xyz/rmrk2/gallery/12126283-7472058104f9f93924-SKC-soldier_1-00000001
and
https://singular.app/collectibles/kusama/7472058104f9f93924-SKC/12126283-7472058104f9f93924-SKC-soldier_1-00000001
Originally posted by @joelamouche in #3725 (comment)
The text was updated successfully, but these errors were encountered: