-
-
Notifications
You must be signed in to change notification settings - Fork 536
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
Adds Swipe layout #3007
Adds Swipe layout #3007
Conversation
Hi @philippjfr Can you give me a hint. The before-after-not-working-with-spacers.mp4You can run |
I've added a notebook to the gallery with more examples before-after-slider3-speedup.mp4 |
I've refactored to use a draggable |
This is looking great! Will review next week. Would love to hear your thoughts on before/after as the API vs making it a ListLike limited to two items. |
Listlike is fine with me. I have a plan to contribute splitter.js based layout also. They are sort of related. So think similar api would be nice. |
I spent a lot of time trying to add a before and an after title in the top left and right corners. But as soon as I put those in the HoloViews plot no longer wanted to find its width upfront. It looked like this Try adding something like below in the <div style="width: 100%"><h3 style="position:relative;float:left;top:-35px">After</h3><h3 style="position:relative;float:right;top:-35px">Before</h3></div> I believe its a natural thing to add. But maybe its ok to leave out for now. |
Hi @philippjfr I will leave it as is for now waiting for your review. I would not know how to refactor into If you provide some suggestions I will finalize. Thanks. |
panel/layout/before_after_slider.py
Outdated
""" | ||
} | ||
|
||
if __name__.startswith("bokeh"): |
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.
The module itself should not have a test in it.
Okay I'll take a look, I'll probably leave |
I'm eager to see this appear! @MarcSkovMadsen , you probably don't know, but the Datashader logo is an abstraction of a imagined before/after comparison between a subsampled and a datashaded plot. It only exists in my head, but I've always wanted to make it an actual example, and soon I will be able to! |
@MarcSkovMadsen I've partially rewritten this but it still suffers from some issues with responsive contents. You had a partial fix for that simply by setting the width/height of the contents but that was only a partial fix because it would not work for layouts containing multiple components. I'm still looking for a general solution. |
Ok. Thanks. If you want me to search for a solution please provide a minimum reproducible example such that I can understand and work with the issue. |
Hi, Below is the code used.. Some imports:
Class (as I saw it implemented already)
Example image genereation taken from holoviews gallery:
Showing the BeforeAfterSlider instance:
Amazing that you have already worked on this feature!. Not sure of the value of my tes, but I noticed a few things that I wanted to highlight:
I am really eager to see this widget apply into geoviews too as I think would be possible given the path of implementation. For what it's worth I found one more source of inspiration that might be useful (link here: https://www.w3schools.com/howto/howto_js_image_comparison.asp) |
@GeoVizNow , I think what you're asking for is something more tailored to Bokeh plots in particular rather than this very generic Panel-level approach, so that it would respect the bokeh zoom and axes. Those issues seem out of scope for this particular feature, but would be appropriate for such a feature implemented at the Bokeh level. We've done something like that using the techniques at http://holoviews.org/user_guide/Custom_Interactivity.html, but I can't find the code for it just now; it was much more specific to a particular type of plot but did respect the Bokeh plot constraints because it was implemented at the bokeh plot level. |
As an FYI, in PR bokeh/bokeh#12083 (scheduled for bokeh 3.1) I implemented various interactive shapes, including spans, with the intention of having in-canvas UI controls, especially sliders. Interactive spans (movable, with bounds, etc.), together with improvements to clipping (e.g. customizable clip regions per renderer or a group of renderers), could be used to implement the proposed in this PR feature idiomatically and efficiently on top of bokeh 3.1. |
260d926
to
f5e8ffc
Compare
Finally found a solution here using the |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
Codecov Report
@@ Coverage Diff @@
## main #3007 +/- ##
==========================================
- Coverage 83.36% 83.29% -0.08%
==========================================
Files 247 250 +3
Lines 36309 36521 +212
==========================================
+ Hits 30270 30420 +150
- Misses 6039 6101 +62
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 15 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Amazing to see this in, really great work (though I do not know all that lays behind)!!
Couple of more things noted:
Again, really great to see this being possible!! Thanks @philippjfr, @MarcSkovMadsen, @jbednar, @mattpap and others involved!! |
One more note. I added a title to each holoviews element through hvpot. Was there any thought of title for each 'before' , 'after' object too? The way added in above example makes it align badly for the inconveniently for the 'after' image.. |
By the way, is it ok to discuss this here even though the issue is merged or do you prefer a different place? |
A new issue about any suggestions for improvement would be good. Titles are definitely a good one. |
@philippjfr, thanks will create a new issue with one or more enhancement proposals. |
Addresses #3006
Todo
Nice to Have