Adding "label_buff" config parameter for Brace #1704
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
-When adding a Brace Label, I can adjust the label scale and the buff between the brace and the mobject adding to. However, I can not adjust the buff between the label and the brace, which would make the distance disproportional.
-Directly using
brace.scale()
does not work either, as this will change the length of the brace as well.-Meanwhile, directly passing in the argument
buff=value
as keyword argument will set the buff between the target mobject and the brace only. And since both methods (Brace.CONFIG
andBrace.put_at_tip
) use thebuff
keyword argument, therefore, to allow different values can be passed in for "mobject-brace buff" and "brace-label buff", this parameter is clarified aslabel_buff
.For example, the code above will result in
![image](https://user-images.githubusercontent.com/86190295/147906016-e18d56ea-20b3-4221-befc-cf2c686bdbe5.png)
Which in this case the small 'r' is clearly too far away from the brace.
Proposed changes
label_buff
in the CONFIGbuff=self.label_buff
for put_at_top methodTest
Code:
Result:
![image](https://user-images.githubusercontent.com/86190295/147906094-bccc3362-7548-41a1-aaeb-46620a1303a7.png)
In addition, the previous version was missing an importation
![f6cffa48c2608c43789a0e864f0db5d](https://user-images.githubusercontent.com/86190295/147912845-84160e52-f9d7-4113-b388-fa87cffb7edc.png)
![image](https://user-images.githubusercontent.com/86190295/147912827-4b2bc43b-f132-4e54-ab76-8c123affdb51.png)
before
after