-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add getters and setters for height and color options #1145
Conversation
|
@agamemnus what does that mean? |
That's in your code...
|
I know. What do you want me to change? |
I don't see it working unless I'm missing something. Seems like you're
using a library or something.
|
Still not quite sure we are talking about the same thing, but there is a test suite that already covers things like toggling mute, so I also added some tests for the getters and setters that I added.
The tests run on Travis. The new ones are also passing. |
Oh, ok (I was on my phone). |
I'll also add getters/setters for |
I've updated the PR to also allow updating the cursor color. @agamemnus From my point of view, the methods added by this PR fit in quite nicely with the existing API and completely cover my use case. So I'll leave this PR like this, as one option. If things are supposed to move in a different direction, though, I'm happy to port my application to a different API once a future release of Wavesurfer provides the features added here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Can you document these new methods in src/wavesurfer.js
?
Sure. Just I'll update the PR this week. |
@thijstriemstra Added the inline docs. Tried to follow the conventions found on the |
@thijstriemstra All of a sudden I am seeing a whole bunch of unrelated commits in this and my two other PRs. Shall I recreate the PRs? What happened? |
@tf the next (v2) branch was set to be the master branch, and the old master is now es5 (version 1) – you need to rebase your commits onto the new master branch. |
@tf you can also change the base branch from this PR page directly. |
e92bd64
to
813439d
Compare
Allow updating the `waveColor`, `progressColor`, `cursorColor` and `height` options that were passed as part of the options for create. For the wave color options, simply ensure that the wave is redrawn. For the height option, delegate to `drawer.setHeight` to handle the update. Note that - while drawer applies the `pixelRatio` itself when initializing from `params` - `setHeight` expects a height that already has been multiplied by `pixelRatio`. The cursor is a border on one of the wave elements. Add an `updateCursor` method to the drawer interface to allow updating the cursor related styles.
813439d
to
05d5fa8
Compare
@katspaugh @thijstriemstra rebased and updated. |
Allow updating the
waveColor
,progressColor
,cursorColor
andheight
options that were passed as part of the options for create.For the wave color options, simply ensure that the wave is redrawn. For the height option, delegate to
drawer.setHeight
to handle the update. Note that - while drawer applies thepixelRatio
itself when initializing fromparams
-setHeight
expects a height that already has been multiplied bypixelRatio
.The cursor is a border on one of the wave elements. Add an
updateCursor
method to the drawer interface to allow updating the cursor related styles.Redrawing the wave via
drawBuffer
only works correctly after #1144 has been merged.