Skip to content
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

Do not reload images that have already been loaded (reuse the same Texture instance) #34

Open
levalleux-ludo opened this issue Mar 14, 2023 · 1 comment
Assignees

Comments

@levalleux-ludo
Copy link
Member

levalleux-ludo commented Mar 14, 2023

As loading of images takes some relevant time, it's possible to cache the textures for images that have already been loaded and reuse them if user is reopening the same product details (or is just looping over the image list of the product).
An exemple of such an implementation can be found in boson-dcl v1: https://github.com/bosonprotocol/boson-dcl/blob/main/src/ImageServer.ts

export class ImageServer {
  imageMap: { [key: string]: Image } = {};

  constructor() {}

  getImage(imageUrl : IImageDefinition): Image {
    const imageUrl = imageDefinition.imageUrl;
    if (this.imageMap[imageUrl]) {
      return this.imageMap[imageUrl];
    }
    const image = new Image({
      texture: new Texture(imageUrl),
      width: imageDefinition.width,
      height: imageDefinition.height,
    });
    this.imageMap[imageUrl] = image;
    return image;
  }
}
@frankie13 frankie13 self-assigned this Mar 14, 2023
@frankie13 frankie13 mentioned this issue Mar 15, 2023
@econsacro
Copy link
Collaborator

Images load only once per kiosk, no matter how many times the user interacts.

bobbyhiom added a commit that referenced this issue Mar 21, 2023
#43 Add cancel button to main product screen
#42 Font / lettering changes for Product Screen // USD font change, Products remaining font change, Extra space for variant text, View full description, Left align “By proceeding to commit”
#41 Increase visibility for links //added blue font as suggested in round 1 of changes
#40 Integrate animation for transaction in process screen
#34 Do not reload images that have already been loaded (reuse the same Texture instance) //images only load once
#32 Revisit the Copy on the more info panel
#26 Add a loading message to display when images are not loaded on kiosk
#22 Non Token Gating Rendering // Kiosk Popup complete, still need to do product screen
@bobbyhiom bobbyhiom mentioned this issue Mar 21, 2023
albertfolch-redeemeum pushed a commit that referenced this issue Mar 30, 2023
#43 Add cancel button to main product screen
#42 Font / lettering changes for Product Screen // USD font change, Products remaining font change, Extra space for variant text, View full description, Left align “By proceeding to commit”
#41 Increase visibility for links //added blue font as suggested in round 1 of changes
#40 Integrate animation for transaction in process screen
#34 Do not reload images that have already been loaded (reuse the same Texture instance) //images only load once
#32 Revisit the Copy on the more info panel
#26 Add a loading message to display when images are not loaded on kiosk
#22 Non Token Gating Rendering // Kiosk Popup complete, still need to do product screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants