-
Notifications
You must be signed in to change notification settings - Fork 158
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
"Horizontal Clipping" #52
base: master
Are you sure you want to change the base?
Conversation
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 :) |
private Paint sparkFillPaint = new Paint(Paint.ANTI_ALIAS_FLAG); | ||
private Paint baseLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); | ||
private Paint scrubLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); | ||
private OnScrubListener scrubListener; | ||
private ScrubGestureDetector scrubGestureDetector; | ||
private Animator pathAnimator; | ||
private final RectF contentRect = new RectF(); | ||
private float clipAmount = 1f; | ||
private RectF clippedRect = new RectF(); | ||
public boolean clipOnScrub; |
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.
We'd likely want this to a public API instead of something that can be directly set on the view.
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. |
Similarly to #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 |
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.