spark
spark copied to clipboard
"Horizontal Clipping"
This is something we needed for our project, if you want to add it to the original codebase here it is!
The change allows to clip the spark-line horizontally and draws a grey line under it.
The gif sums it up pretty well.
public void setClipAmount(float amount)
to set a value between 0 and 1. If value is 1 clipping gets automatically disabled. (Passed value get clipped between 0 and 1)
There's also a public boolean clipOnScrub
to automatically use it when scrubbing.
This looks neat! Thanks for sharing!
If this is going to get added it might make sense to have this as a stylable attribute as well as a programatic API. Also, perhaps we would want to make the color configurable instead of always using grey?
Lets see what @danh32 thinks :)
I'd love to better understand the use case here; it feels a little awkward to leave the graph in the last scrubbed state (part green, part grey) after the scrub bar is gone. Where did you find yourself wanting this behavior?
Yeah I also wan't sure what to do when finishing scrubbing. I though to use a `keepClipAfterScrub but it was getting too convoluted and too many parameters for a relatively small feature. We use it synced with a video, while the video plays the graph progresses. It gets set by code, we're not using the scrubbing. That's why that part is not so polished
Similarly to https://github.com/robinhood/spark/pull/54, I think this is a bit too specific for Spark 1.0. I also agree with @naturalwarren on the public boolean needing a bit of polish.
Yeah I agree, this is kinda specific. It would also need a better name