Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,17 @@ new rrwebPlayer({

##### Options

| key | default | description |
| -------------- | ------------ | ------------------------------------------------------ |
| events | [] | the events for replaying |
| width | 1024 | the width of the replayer |
| height | 576 | the height of the replayer |
| autoPlay | true | whether to autoplay |
| speedOption | [1, 2, 4, 8] | speed options in UI |
| showController | true | whether to show the controller UI |
| tags | {} | customize the custom events style with a key-value map |
| ... | - | all the rrweb Replayer options will be bypassed |
| key | default | description |
| -------------- | ------------ | -------------------------------------------------------------------- |
| events | [] | the events for replaying |
| width | 1024 | the width of the replayer |
| height | 576 | the height of the replayer |
| maxScale | 1 | the maximum scale of the replayer (1 = 100%), set to 0 for unlimited |
| autoPlay | true | whether to autoplay |
| speedOption | [1, 2, 4, 8] | speed options in UI |
| showController | true | whether to show the controller UI |
| tags | {} | customize the custom events style with a key-value map |
| ... | - | all the rrweb Replayer options will be bypassed |

#### Events

Expand Down
5 changes: 4 additions & 1 deletion packages/rrweb-player/src/Player.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

export let width = 1024;
export let height = 576;
export let maxScale = 1;
export let events: eventWithTime[] = [];
export let skipInactive = true;
export let autoPlay = true;
Expand Down Expand Up @@ -55,8 +56,10 @@
) => {
const widthScale = width / frameDimension.width;
const heightScale = height / frameDimension.height;
const scale = [widthScale, heightScale];
if (maxScale) scale.push(maxScale);
el.style.transform =
`scale(${Math.min(widthScale, heightScale, 1)})` +
`scale(${Math.min(...scale)})` +
'translate(-50%, -50%)';
};

Expand Down