mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
fix: Corriger l'alignement vertical des emojis dans les stories Facebook
Le problème était causé par un calcul incorrect du positionnement des emojis lorsque textBaseline est défini à 'middle'. Le code calculait la position comme si le baseline était en mode standard (alphabetic), ce qui décalait les emojis verticalement. Changement: emojiY = y - (emojiSize / 2) au lieu de y - fontSize * 0.8 Cela centre correctement l'emoji autour du point Y qui représente le centre du texte en mode 'middle'.
This commit is contained in:
1 file changed
+5
-4
@@ -110,11 +110,12 @@ export class EmojiRenderer {
|
||||
try {
|
||||
const emojiBuffer = await this.getEmojiImage(segment.url);
|
||||
const emojiImage = await loadImage(emojiBuffer);
|
||||
|
||||
// Draw emoji slightly above baseline to align with text
|
||||
|
||||
// Draw emoji centered vertically with text
|
||||
// When textBaseline is 'middle', y represents the vertical center
|
||||
const emojiSize = fontSize;
|
||||
const emojiY = y - fontSize * 0.8; // Adjust vertical position
|
||||
|
||||
const emojiY = y - (emojiSize / 2); // Center the emoji around y
|
||||
|
||||
ctx.drawImage(emojiImage, currentX, emojiY, emojiSize, emojiSize);
|
||||
currentX += emojiSize;
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user