Skip to content

Add support for editable Label annotation#12825

Merged
mattpap merged 18 commits intobranch-3.4from
mattpap/editable_label
Nov 8, 2023
Merged

Add support for editable Label annotation#12825
mattpap merged 18 commits intobranch-3.4from
mattpap/editable_label

Conversation

@mattpap
Copy link
Contributor

@mattpap mattpap commented Feb 20, 2023

This continues the work done in PR #12468. This PR adds support for editing (moving and especially rotating) Label annotations. It also adds feature parity with Text glyph, i.e. adds support for padding and rounded corners (this includes Title annotation).

Title with padding=10, border_radius=8 and line styling:

image

Rotation of Label with editable=True:

Screencast_00005.mp4

@codecov
Copy link

codecov bot commented Feb 20, 2023

Codecov Report

Merging #12825 (b42b884) into branch-3.4 (99d19b1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           branch-3.4   #12825   +/-   ##
===========================================
  Coverage       92.64%   92.65%           
===========================================
  Files             321      321           
  Lines           20415    20428   +13     
===========================================
+ Hits            18914    18927   +13     
  Misses           1501     1501           

@mattpap mattpap force-pushed the mattpap/editable_label branch from 1bf1454 to 8fafa06 Compare February 20, 2023 15:40
@mattpap mattpap changed the base branch from branch-3.1 to branch-3.2 March 4, 2023 15:47
@mattpap mattpap force-pushed the mattpap/editable_label branch from 8fafa06 to 1a28567 Compare May 21, 2023 17:58
@mattpap mattpap modified the milestones: 3.2, 3.3 May 23, 2023
@mattpap mattpap changed the base branch from branch-3.2 to branch-3.3 June 15, 2023 07:50
@mattpap mattpap force-pushed the mattpap/editable_label branch from 1a28567 to 7e6f20a Compare September 15, 2023 19:13
@mattpap mattpap modified the milestones: 3.3, 3.4 Oct 4, 2023
@mattpap mattpap changed the base branch from branch-3.3 to branch-3.4 October 10, 2023 12:49
@mattpap mattpap force-pushed the mattpap/editable_label branch from 7e6f20a to 7e4cbc4 Compare October 11, 2023 10:16
@mattpap
Copy link
Contributor Author

mattpap commented Oct 12, 2023

Note that this PR only implements rotation under editable=True. Movement is already implemented in BoxAnnotation, thus this needs to be generalized and implemented once for all box-like annotations, which I will do in another PR.

@bryevdv
Copy link
Member

bryevdv commented Nov 7, 2023

@mattpap looks like some SVG issues, are these related to any known open SVG issues or if not should there be new ones opened?

Screenshot 2023-11-07 at 11 06 08 Screenshot 2023-11-07 at 11 06 22

This property is experimental and may change at any point.
""")

editable = Bool(default=False, help="""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would rotatable be better / more specific? When I opened this PR and saw "editable" I first thought this was a about editing the text of the labels

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indeed may be confusing for labels, but is consistent with other APIs. All APIs broadly related to editability are experimental, so we can iterate over the design. Perhaps a better choice would have been interactive, but if we decide so, then this will have to be applied consistently. I will leave this for now. There will be more changes like this one in near future, specifically text editability of Text glyph and Label, so will have a better picture then.

@mattpap
Copy link
Contributor Author

mattpap commented Nov 7, 2023

looks like some SVG issues, are these related to any known open SVG issues or if not should there be new ones opened?

It's a "known issue" related drawing arcs on SVG canvas, but I don't see any open issue for that. I will open one.

Copy link
Member

@bryevdv bryevdv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments, LGTM

@mattpap mattpap force-pushed the mattpap/editable_label branch from 409c8cd to b42b884 Compare November 8, 2023 12:18
@mattpap
Copy link
Contributor Author

mattpap commented Nov 8, 2023

Actually there is an issue for broken ctx.arcTo() in SVG canvas (#12699).

@mattpap mattpap merged commit 5108e25 into branch-3.4 Nov 8, 2023
@mattpap mattpap deleted the mattpap/editable_label branch November 8, 2023 14:06
Chiemezuo pushed a commit to Chiemezuo/bokeh that referenced this pull request Aug 27, 2024
* Clean up the implementation of Label annotation

* Add support for anchor/padding to Label

* Add support for editable Label rotation

* Add support for border radius

* Connect compute_geometry()

* Support node resolution in Label

* Update examples/basic/annotations/label.py

* Update defaults' baseline

* Resolve issues with positioning math text labels

* Generalize the implementation for Title

* Unify layout and get_size() handling

* Include padding in get_size() computation

* Robustify unit tests

* Add visual tests for Title

* Add visual tests for Label

* Partially update HTML* variants

* Add release notes

* Update visual baselines
@github-actions
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 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support Title/Label bounding box padding

2 participants