From 5d7dd12dc34da63e9df4271cb65edd1505abff10 Mon Sep 17 00:00:00 2001 From: katspaugh <381895+katspaugh@users.noreply.github.com> Date: Sun, 15 Oct 2023 12:54:44 +0200 Subject: [PATCH] Feat: width option (#3259) * Feat: width option * Snapshots --- cypress/e2e/options.cy.js | 38 ++++++++++++++++++ .../options.cy.js/width-100.snap.png | Bin 0 -> 5258 bytes .../options.cy.js/width-10rem.snap.png | Bin 0 -> 4041 bytes .../options.cy.js/width-200px.snap.png | Bin 0 -> 4041 bytes .../options.cy.js/width-300.snap.png | Bin 0 -> 5258 bytes examples/all-options.js | 8 ++++ src/renderer.ts | 7 ++++ src/wavesurfer.ts | 4 +- 8 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 cypress/snapshots/options.cy.js/width-100.snap.png create mode 100644 cypress/snapshots/options.cy.js/width-10rem.snap.png create mode 100644 cypress/snapshots/options.cy.js/width-200px.snap.png create mode 100644 cypress/snapshots/options.cy.js/width-300.snap.png diff --git a/cypress/e2e/options.cy.js b/cypress/e2e/options.cy.js index 02f01a2bd..27546098a 100644 --- a/cypress/e2e/options.cy.js +++ b/cypress/e2e/options.cy.js @@ -546,4 +546,42 @@ describe('WaveSurfer options tests', () => { }) }) }) + + it('should accept a numeric width option', () => { + cy.window().then((win) => { + return new Promise((resolve, reject) => { + win.wavesurfer = win.WaveSurfer.create({ + container: id, + url: '../../examples/audio/demo.wav', + width: 100, + }) + + win.wavesurfer.once('ready', () => { + cy.get(id).matchImageSnapshot('width-100') + win.wavesurfer.setOptions({ width: 300 }) + cy.get(id).matchImageSnapshot('width-300') + resolve() + }) + }) + }) + }) + + it('should accept a CSS value for the width option', () => { + cy.window().then((win) => { + return new Promise((resolve, reject) => { + win.wavesurfer = win.WaveSurfer.create({ + container: id, + url: '../../examples/audio/demo.wav', + width: '10rem', + }) + + win.wavesurfer.once('ready', () => { + cy.get(id).matchImageSnapshot('width-10rem') + win.wavesurfer.setOptions({ width: '200px' }) + cy.get(id).matchImageSnapshot('width-200px') + resolve() + }) + }) + }) + }) }) diff --git a/cypress/snapshots/options.cy.js/width-100.snap.png b/cypress/snapshots/options.cy.js/width-100.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..a75b37f03350df255f924dbe4dfa8efebbf7c9e5 GIT binary patch literal 5258 zcmcgwYgkiP*7mMNw19%A80i3l%^*qu#{{9a6h(qc8|OoaTqNP5M6MAH6F_a{YJ>*D zwQ2l5OS}@)VuIXNAOT6kC^i|T5V`2lVK9Kz2!hPo2mAe+-;;-jljQ8P_uB7z-*>H@ z+^_fgt}wASnKy6V3cp=GjCu1G1i|~0%a*`@ooG$%ym_m?@$>oeue|xAcm6MVedj6F zfIj83D}E059E;n|GTOZ3SS263oFOeg5?Pu3&!sLw9)COOy|dr@E77IwNDCMhI{flp ze%{FQ9`&J}(sikRY8$s`i`ESwFxaWXr5DH=AsJrD)jaXxV4dR&0s-ZnvFf*=0JOJ1gkF*oOp z?|WXHZj2wIPE-(IrJf0Fv?DtVKlSwV{F*+n<&r$v<3|{ZzIP=%e7-^2X7Hou>IQk9 zaD!LPbdm>3e$w8f=EIteJDjW%J#B)$HRauYWQys+g3I!W$CV;1>y+-i_TD&exGq-q zkeOP|FoB&U+|OJ5kV&&Cn6_fj;Y}%HFp)ZDEfrmoPgsi>m*i->n>p>?u`_Fd15wiibS>y$~AqPyH;v?U@=TFmEBBwt6$PR&y>S^9UQ zSGbdM7d=;G5kSeePuIWN!V;t`Vwl1XXeDlsr9*8i3^)p&xNWPnXWv1paOyq&h zJLtKXefKwSU+Z-q>CUOT+Zajo7(G)ZOVKDy7$Y;k;fg3M&qzJwOZ_^x5L%zrETk_KIBXk z6wVSnWKI_TKf+Sc^LLU*Gc#T_5!hR?$RgY|-@Zm+O;@n>_<+j zM$iGW#1>(fYC8G%^zKp-sD%s`gFf*7y(9tyx&p;7@_4*2Kv}Z7!NsPnx5s&v+Iw{oSfXaUjA2qx*U}PW z!5$8g70+aJvsr>RY;q)g7G&VQ=Q~OkcZiyN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j84^?Th;SawI5(?LLrqN~o&xuywSSX#?dzo3bvPUGoS8e1?*>8R-BlTgCq*Mp!@Lm6KibPf&rK#%?Tv{ej0FMo7UFWirtine12CgVVB_C3HL3p?bfBF z(Rq%B(VQX;`Cgk4Y|gT(pj|!gur+uGO}M#mhwQ(6nfZ7uI$$8d>dS5L8{<5`9eaJMy$^o-Zw}`P AEC2ui literal 0 HcmV?d00001 diff --git a/cypress/snapshots/options.cy.js/width-10rem.snap.png b/cypress/snapshots/options.cy.js/width-10rem.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..db5f9b907cc37f437ce14e1592624bc1e118fd95 GIT binary patch literal 4041 zcmcgvdr(tX8b@@H@^B+6-fB=FQkz9qVtgbmXhjf-;v*_TPz0i&MC6f$27{m#gA7?{ zXi(8RI8_2#30Ttv5fC*P5HM)fq#6kgf!>|67(i{Lg6?;MZugI!+5ei!!eyfB8Brc=a~Hq`_NW>Aqp- zMGq|78LSF7*}6~MSdZD2Z)SI35KYW@T>n&2v-t2sul++uXR1$`-VYh@B2kd8k zOI)!ipZ(aB`DPW7`}VE1`JJWt-FQkcy!w{Rv0cvp=@;$N@EP9l8o4f_2d-R+zIxa4 zNYkfJmlP&3)Jwxpz^kop8EzULhCioIA5}S^OZ`O=y&p&4B>H8xF(Lo^f?tw;h3+@j zm^N(Mw5jdgitrhFSX4F>)y>~`?Yz`&_bs!TLiN!u3!jlP{Q7mG^~6X(sJUoYbLG8461 zcrxkj=u$QmBs)YXwL~aa~m)0@n6{B*A2dR}D z-;`2z{FzTS_Tyz9)26!9*4FqD8>q*5pUS>w_mUqj-NG{YCCQ~9LbpSR1)8=+XiOS; z^dv@U=q{4F)rL`NMU<{m_C+O|Wtsz3?3B%fp^yJlW8)fFxQ+Q@C#xWedYt21h*6Xg zG4vveVmzmd_uHF5+S(*Jen=pQjo|IAGi>4Qg`#xre8_;;FJ!Yi)3uEu^3pp?!yj?7 z3iqFRU#iEn{K*Qo6C{yF&ML;~R3CR{VoV7;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UWanDDZHG`eX3l zzB9Q%gFq8URU-O?FHdAgA46kyZc~>5eh6vwu&A_|_K%tG1N>Q+U*FmN?oO=x>z+$2 Rctp1g3)vW46BPT^zX6Glc(VWi literal 0 HcmV?d00001 diff --git a/cypress/snapshots/options.cy.js/width-200px.snap.png b/cypress/snapshots/options.cy.js/width-200px.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..db5f9b907cc37f437ce14e1592624bc1e118fd95 GIT binary patch literal 4041 zcmcgvdr(tX8b@@H@^B+6-fB=FQkz9qVtgbmXhjf-;v*_TPz0i&MC6f$27{m#gA7?{ zXi(8RI8_2#30Ttv5fC*P5HM)fq#6kgf!>|67(i{Lg6?;MZugI!+5ei!!eyfB8Brc=a~Hq`_NW>Aqp- zMGq|78LSF7*}6~MSdZD2Z)SI35KYW@T>n&2v-t2sul++uXR1$`-VYh@B2kd8k zOI)!ipZ(aB`DPW7`}VE1`JJWt-FQkcy!w{Rv0cvp=@;$N@EP9l8o4f_2d-R+zIxa4 zNYkfJmlP&3)Jwxpz^kop8EzULhCioIA5}S^OZ`O=y&p&4B>H8xF(Lo^f?tw;h3+@j zm^N(Mw5jdgitrhFSX4F>)y>~`?Yz`&_bs!TLiN!u3!jlP{Q7mG^~6X(sJUoYbLG8461 zcrxkj=u$QmBs)YXwL~aa~m)0@n6{B*A2dR}D z-;`2z{FzTS_Tyz9)26!9*4FqD8>q*5pUS>w_mUqj-NG{YCCQ~9LbpSR1)8=+XiOS; z^dv@U=q{4F)rL`NMU<{m_C+O|Wtsz3?3B%fp^yJlW8)fFxQ+Q@C#xWedYt21h*6Xg zG4vveVmzmd_uHF5+S(*Jen=pQjo|IAGi>4Qg`#xre8_;;FJ!Yi)3uEu^3pp?!yj?7 z3iqFRU#iEn{K*Qo6C{yF&ML;~R3CR{VoV7;Ucx@FW7!sxx>0=+0E4Z~T!(HrYnQ6=nna%g!6 zQ^6ol>x>uwEA#Wp{qgSHJ#_{N+gsMMG`vE3S_b33HwkG;oJszHF)1w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^zX6Glc(VWi literal 0 HcmV?d00001 diff --git a/cypress/snapshots/options.cy.js/width-300.snap.png b/cypress/snapshots/options.cy.js/width-300.snap.png new file mode 100644 index 0000000000000000000000000000000000000000..a75b37f03350df255f924dbe4dfa8efebbf7c9e5 GIT binary patch literal 5258 zcmcgwYgkiP*7mMNw19%A80i3l%^*qu#{{9a6h(qc8|OoaTqNP5M6MAH6F_a{YJ>*D zwQ2l5OS}@)VuIXNAOT6kC^i|T5V`2lVK9Kz2!hPo2mAe+-;;-jljQ8P_uB7z-*>H@ z+^_fgt}wASnKy6V3cp=GjCu1G1i|~0%a*`@ooG$%ym_m?@$>oeue|xAcm6MVedj6F zfIj83D}E059E;n|GTOZ3SS263oFOeg5?Pu3&!sLw9)COOy|dr@E77IwNDCMhI{flp ze%{FQ9`&J}(sikRY8$s`i`ESwFxaWXr5DH=AsJrD)jaXxV4dR&0s-ZnvFf*=0JOJ1gkF*oOp z?|WXHZj2wIPE-(IrJf0Fv?DtVKlSwV{F*+n<&r$v<3|{ZzIP=%e7-^2X7Hou>IQk9 zaD!LPbdm>3e$w8f=EIteJDjW%J#B)$HRauYWQys+g3I!W$CV;1>y+-i_TD&exGq-q zkeOP|FoB&U+|OJ5kV&&Cn6_fj;Y}%HFp)ZDEfrmoPgsi>m*i->n>p>?u`_Fd15wiibS>y$~AqPyH;v?U@=TFmEBBwt6$PR&y>S^9UQ zSGbdM7d=;G5kSeePuIWN!V;t`Vwl1XXeDlsr9*8i3^)p&xNWPnXWv1paOyq&h zJLtKXefKwSU+Z-q>CUOT+Zajo7(G)ZOVKDy7$Y;k;fg3M&qzJwOZ_^x5L%zrETk_KIBXk z6wVSnWKI_TKf+Sc^LLU*Gc#T_5!hR?$RgY|-@Zm+O;@n>_<+j zM$iGW#1>(fYC8G%^zKp-sD%s`gFf*7y(9tyx&p;7@_4*2Kv}Z7!NsPnx5s&v+Iw{oSfXaUjA2qx*U}PW z!5$8g70+aJvsr>RY;q)g7G&VQ=Q~OkcZiyN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j84^?Th;SawI5(?LLrqN~o&xuywSSX#?dzo3bvPUGoS8e1?*>8R-BlTgCq*Mp!@Lm6KibPf&rK#%?Tv{ej0FMo7UFWirtine12CgVVB_C3HL3p?bfBF z(Rq%B(VQX;`Cgk4Y|gT(pj|!gur+uGO}M#mhwQ(6nfZ7uI$$8d>dS5L8{<5`9eaJMy$^o-Zw}`P AEC2ui literal 0 HcmV?d00001 diff --git a/examples/all-options.js b/examples/all-options.js index a44bba37c..89582c4c2 100644 --- a/examples/all-options.js +++ b/examples/all-options.js @@ -7,6 +7,8 @@ const options = { container: 'body', /** The height of the waveform in pixels */ height: 128, + /** The width of the waveform in pixels or any CSS value; defaults to 100% */ + width: 300, /** Render each audio channel as a separate waveform */ splitChannels: false, /** Stretch the waveform to the full height */ @@ -69,6 +71,12 @@ const schema = { max: 512, step: 1, }, + width: { + value: 300, + min: 10, + max: 2000, + step: 1, + }, cursorWidth: { value: 1, min: 0, diff --git a/src/renderer.ts b/src/renderer.ts index e9f5cad5d..56a5b223f 100644 --- a/src/renderer.ts +++ b/src/renderer.ts @@ -138,6 +138,7 @@ class Renderer extends EventEmitter {