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

Code Review: tik/proxy-view #54

Closed
wants to merge 26 commits into from
Closed

Code Review: tik/proxy-view #54

wants to merge 26 commits into from

Conversation

fight4day
Copy link
Contributor

@fight4day fight4day commented Jul 4, 2022

Dependency on kieler/KLighD#129

@fight4day fight4day requested a review from Eddykasp July 4, 2022 12:01
@fight4day fight4day requested a review from NiklasRentzCAU July 5, 2022 11:43
Copy link
Contributor

@Eddykasp Eddykasp left a comment

Choose a reason for hiding this comment

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

I think extracting some of the stuff from the different syntheses into synthesis hooks would be sensible.

// Set size to be square and at least 34 (same as minimal node size)
val proxyBounds = PlacementUtil.estimateSize(proxy)
val minSize = 34
val bigEnough = proxyBounds.width > 10 && proxyBounds.height > 10
Copy link
Contributor

Choose a reason for hiding this comment

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

where do these values come from, how are they chosen and what do they control?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I chose those values myself and tested out when the original proxy bounds would be appropriately large enough. It's needed in case there's no text or the text doesn't exceed the chosen threshold size - as the proxy might be barely visible in these cases. Doing this allows for non-square proxies
Do you have a suggestion on how to improve this or where to add what documentation?

Copy link
Contributor

Choose a reason for hiding this comment

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

at least extract it into a variable with a little documentation explaining the choice that way changing the square size later is also trivial

*/
public class SCChartsSemanticFilterRules {
// Naming conventions:
// The names should start with NO_ or ONLY_, indicating
Copy link
Contributor

Choose a reason for hiding this comment

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

also as discussed, use a naming convention that utilizes the checkbox as the "verb"

Copy link
Member

@NiklasRentzCAU NiklasRentzCAU left a comment

Choose a reason for hiding this comment

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

Adding to some of Max' comments. In general, be careful with your magic numbers here and take care of re-organizing the imports if you add some. ctrl+shift+O is your friend :)

)
node.setProperty(KlighdProperties.SEMANTIC_FILTER_TAGS, semanticTags)
val proxy = createNode().associateWith(region)
val maxProxyLabelLength = 5
Copy link
Member

Choose a reason for hiding this comment

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

avoid magic numbers. Why 5?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

5 is a good compromise of cutting as the proxies aren't too wide and usually 5 characters suffice for uniquely identifying the corresponding node
Also fun fact: in English, the average word length is about 5 or less https://www.researchgate.net/figure/Average-word-length-in-the-English-language-Different-colours-indicate-the-results-for_fig1_230764201

if (grid instanceof KGridPlacement) {
grid.numColumns = grid.numColumns + 1
addRectangle => [
setGridPlacementData(5,5)
Copy link
Member

Choose a reason for hiding this comment

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

more magic numbers. Do we have a 5x5 grid here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as in the above method. In general, the code is mostly copied "as is done in synthesis-world"

@NiklasRentzCAU
Copy link
Member

This PR had some nasty revert commit, the linked new PR has the same changes with commits after the revert cherry-picked to avoid this issue. Closing, but keeping this PR in mind for the comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants