Skip to content
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

TopBottomShader.splitY doesn't do anything #716

Closed
ElianFabian opened this issue May 20, 2024 · 1 comment
Closed

TopBottomShader.splitY doesn't do anything #716

ElianFabian opened this issue May 20, 2024 · 1 comment
Labels

Comments

@ElianFabian
Copy link

How to reproduce

image

Change the TopBottomShader.splitY from any TopBottomShader in the Chart9 example.

Observed behavior

When changing the splitY property has no effect, the split effect stays always on the horizontal line at y = 0.

Expected behavior

image

When the value is 0 (the default), I expect it to be on the gray line, when it is 10 for example, I expect the split to be in the green line.

I might be wrong about the actual behavior since I don't really understand what the docs says about it:

/**
 * Splits the shaded area into two parts and applies two other [DynamicShader]s, [topShader] and [bottomShader].
 * [splitY] expresses the distance of the split from the top of the shaded area as a fraction of the area’s height.
 */
public class TopBottomShader(
    public var topShader: DynamicShader,
    public var bottomShader: DynamicShader,
    public var splitY: Float = 0f,
) : CacheableDynamicShader()

Vico version(s)

2.0.0-alpha.19

Android version(s)

I tried both api level 24 and 34.

Additional information

No response

@patrickmichalik
Copy link
Member

patrickmichalik commented May 29, 2024

Hello! As described in the newly added warning box here, this behavior is expected, and the ability to split a LineCartesianLayer line’s style at any y value, not just y = 0, is a planned addition. I’ll thus be closing this issue.

To paraphrase the documentation, when a TopBottomShader is applied to an area whose bottom edge is at b and whose top edge is at t, the border between the topShader and bottomShader areas is positioned at b − splitY × (bt). (This is in the Canvas coordinate system, which has an inverted y-axis.) If splitY is 0, topShader is applied to the entire area. If splitY is 1, bottomShader is applied to the entire area.

If you have any questions, let me know.

@patrickmichalik patrickmichalik closed this as not planned Won't fix, can't repro, duplicate, stale May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants