Skip to content

Commit

Permalink
feat: add part to only timeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Byassee committed Jan 24, 2024
1 parent 0b8c041 commit f28b383
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class Renderer extends EventEmitter<RendererEvents> {
<div class="scroll" part="scroll">
<div class="wrapper" part="wrapper">
<div class="canvases" part="canvases"></div>
<div class="canvases"></div>
<div class="progress" part="progress"></div>
<div class="cursor" part="cursor"></div>
</div>
Expand Down Expand Up @@ -442,7 +442,6 @@ class Renderer extends EventEmitter<RendererEvents> {
) {
const pixelRatio = window.devicePixelRatio || 1
const canvas = document.createElement('canvas')
canvas.setAttribute('part', 'canvas canvas-wave')
const length = channelData[0].length
canvas.width = Math.round((width * (end - start)) / length)
canvas.height = height * pixelRatio
Expand All @@ -462,7 +461,6 @@ class Renderer extends EventEmitter<RendererEvents> {
// Draw a progress canvas
if (canvas.width > 0 && canvas.height > 0) {
const progressCanvas = canvas.cloneNode() as HTMLCanvasElement
progressCanvas.setAttribute('part', 'canvas canvas-progress');
const progressCtx = progressCanvas.getContext('2d') as CanvasRenderingContext2D
progressCtx.drawImage(canvas, 0, 0)
// Set the composition method to draw only where the waveform is drawn
Expand All @@ -481,15 +479,13 @@ class Renderer extends EventEmitter<RendererEvents> {
): Promise<void> {
// A container for canvases
const canvasContainer = document.createElement('div')
canvasContainer.setAttribute('part', 'canvas-container')
const height = this.getHeight(options.height)
canvasContainer.style.height = `${height}px`
this.canvasWrapper.style.minHeight = `${height}px`
this.canvasWrapper.appendChild(canvasContainer)

// A container for progress canvases
const progressContainer = canvasContainer.cloneNode() as HTMLElement
progressContainer.setAttribute('part', 'progress-container')
this.progressWrapper.appendChild(progressContainer)

const dataLength = channelData[0].length
Expand Down

0 comments on commit f28b383

Please sign in to comment.