Improve timeline scroll, media layout, avatars, and emoji coverage.
Remember room scroll position across switches, reserve image/video heights from Matrix dimensions, cache authenticated media blobs for avatars, restore jumbo emoji-only messages, and extend emoji font unicode-range for Unicode 15 glyphs.
This commit is contained in:
@@ -87,6 +87,23 @@ export const scaleYDimension = (x: number, scaledX: number, y: number): number =
|
||||
return scaleFactor * y;
|
||||
};
|
||||
|
||||
/** Fit natural media size into a max box without upscaling. */
|
||||
export const fitMediaSize = (
|
||||
w: number,
|
||||
h: number,
|
||||
maxW: number,
|
||||
maxH: number
|
||||
): { width: number; height: number } => {
|
||||
if (w <= 0 || h <= 0) {
|
||||
return { width: maxW, height: Math.round(maxW * 0.75) };
|
||||
}
|
||||
const scale = Math.min(maxW / w, maxH / h, 1);
|
||||
return {
|
||||
width: Math.max(1, Math.round(w * scale)),
|
||||
height: Math.max(1, Math.round(h * scale)),
|
||||
};
|
||||
};
|
||||
|
||||
export const parseGeoUri = (location: string) => {
|
||||
const [, data] = location.split(':');
|
||||
const [cords] = data.split(';');
|
||||
|
||||
Reference in New Issue
Block a user