limit max scale to 1

This commit is contained in:
Yanzhen Yu
2026-04-01 12:00:00 +08:00
parent 09f694c90a
commit b25033e872
2 changed files with 17 additions and 14 deletions

View File

@@ -55,7 +55,8 @@
const widthScale = width / frameDimension.width;
const heightScale = height / frameDimension.height;
el.style.transform =
`scale(${Math.min(widthScale, heightScale)})` + 'translate(-50%, -50%)';
`scale(${Math.min(widthScale, heightScale, 1)})` +
'translate(-50%, -50%)';
};
export const triggerResize = () => {

28
typings/index.d.ts vendored
View File

@@ -2,20 +2,22 @@ import { eventWithTime, playerConfig } from 'rrweb/typings/types';
import { Replayer, mirror } from 'rrweb';
import { SvelteComponent } from 'svelte';
export type RRwebPlayerOptions = {
target: HTMLElement;
props: {
events: eventWithTime[];
width?: number;
height?: number;
autoPlay?: boolean;
speed?: number;
speedOption?: number[];
showController?: boolean;
tags?: Record<string, string>;
} & Partial<playerConfig>;
};
export default class rrwebPlayer extends SvelteComponent {
constructor(options: {
target: HTMLElement;
props: {
events: eventWithTime[];
width?: number;
height?: number;
autoPlay?: boolean;
speed?: number;
speedOption?: number[];
showController?: boolean;
tags?: Record<string, string>;
} & Partial<playerConfig>;
});
constructor(options: RRwebPlayerOptions);
addEventListener(event: string, handler: (params: any) => unknown): void;