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

Allow ability to define style cycles for Draw tools #3612

Merged
merged 5 commits into from
Apr 28, 2019

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Apr 9, 2019

This PR allows adding style cycles to the PolyDraw stream (but this could be expanded to the other draw streams). As an example here we cycle over the fill_color and line_width of the drawn polygons:

poly = hv.Polygons([[(2, 2), (5, 8), (8, 2)]])

poly_stream = streams.PolyDraw(source=poly, drag=True, show_vertices=True,
                               style_cycles={'fill_color': ['red', 'green', 'blue'],
                                             'line_width': [3, 5, 10]})

poly

style_cycles

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Apr 9, 2019
@jbednar
Copy link
Member

jbednar commented Apr 9, 2019

Looks great! Does it need to be style_cycles, or could it just be styles, which are cycled if they are cycles and otherwise just applied? Just brainstorming; not sure which approach is better.

@philippjfr
Copy link
Member Author

Looks great! Does it need to be style_cycles, or could it just be styles, which are cycled if they are cycles and otherwise just applied? Just brainstorming; not sure which approach is better.

It could just be styles I suppose, that is somewhat redundant since you can just set the style in the usual way but may be cleaner regardless.

@philippjfr
Copy link
Member Author

@jbednar @jlstevens Let me know which you prefer, I'd be happy with accepting both lists (as cycles) and scalar values, and then call it simply styles.

@philippjfr philippjfr added this to the v1.12.1 milestone Apr 10, 2019
@jbednar
Copy link
Member

jbednar commented Apr 10, 2019

I'd vote for styles. Actually I vote for just respecting the usual style options set in the usual way and cycling if those are cycles, but I assume that's not feasible?

@jlstevens
Copy link
Contributor

I also vote for keeping the API as consistent as possible. Why can't PolyDraw support the common style options for polygons which can then be set with styles or constants?

@philippjfr
Copy link
Member Author

Actually I vote for just respecting the usual style options set in the usual way and cycling if those are cycles, but I assume that's not feasible?

That's not consistent with the way cycles behave in HoloViews, styles cycle in an overlay but not within a single Polygons/Paths element.

Why can't PolyDraw support the common style options for polygons which can then be set with styles or constants?

I'm not following what your suggesting here, that's what the styles suggestion is no?

@jbednar
Copy link
Member

jbednar commented Apr 10, 2019

styles cycle in an overlay but not within a single Polygons/Paths element.

Ah, that's the key issue here. Worth brainstorming if there is a way more general than this approach to achieve within-Element cycling.

@philippjfr
Copy link
Member Author

if there is a way more general than this approach to achieve within-Element cycling.

That can now be done via dim style mappings but I don't see any way those could feasibly be implemented client-side.

@philippjfr philippjfr modified the milestones: v1.12.1, v1.12.2 Apr 22, 2019
@philippjfr
Copy link
Member Author

I'm going to go ahead and rename it to styles and support scalar values. Respecting cycles within an element would be highly inconsistent so I vote against that.

@philippjfr philippjfr merged commit 9bf1270 into master Apr 28, 2019
@philippjfr philippjfr deleted the style_cycling_draw_tools branch April 29, 2019 11:24
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants