ngx-emoji-mart icon indicating copy to clipboard operation
ngx-emoji-mart copied to clipboard

Long loading time; invocation of backgroundImageFn per emoji? passes wrong parameter to backgroundImageFn

Open Aleeexx opened this issue 4 years ago • 2 comments

Hey guys! Please take a look at the gif below. I'm wondering, why the backgroundImageFn is called multiple times (idk how many emojis there are but probably one invocation per emoji?) on opening the Picker - feels pretty laggy (actually the image is being downloaded in the background). Furthermore, the backgroundImageFn gets invoked on Emoji hover and on Emoji mouseleave but on mouseleave with wrong parameters? I have set the sheetSize manually to 32 but on mouseleave the backgroundImageFn is called with a sheetSize of 64?

The project's dependencies are: Ngx Emoji Mart: 3.1.0 Angular: 9

<emoji-mart
  [backgroundImageFn]="backgroundImageFn"
  (emojiSelect)="addEmoji(...)"
  title="Wähle ein Emoji..."
  sheetSize="32"
></emoji-mart>
public backgroundImageFn: Emoji["backgroundImageFn"] = (set, sheetSize) => {
  console.log(set, sheetSize);
  return "assets/emoji_sheet_32.png";
};

emojiMart

Aleeexx avatar Aug 17 '20 11:08 Aleeexx

Exactly the same behavior and picker is unresponsive for around 7 secs.

ctrl/ngx-emoji-mart version 4.1.0 Angular 11

maxidirienzo avatar Dec 29 '20 13:12 maxidirienzo

I did some work on virtualizing the picker emojis as well as image URL Fn per emoji here #369. I am seeing much better results so far.

agiangrant avatar Mar 14 '21 19:03 agiangrant