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

[FEATURE]: Automatically wrap labels to fit node bounding box #201

Closed
mnamici opened this issue Jun 8, 2022 · 1 comment · Fixed by #233
Closed

[FEATURE]: Automatically wrap labels to fit node bounding box #201

mnamici opened this issue Jun 8, 2022 · 1 comment · Fixed by #233
Labels
enhancement New feature or request
Milestone

Comments

@mnamici
Copy link
Collaborator

mnamici commented Jun 8, 2022

Description

We should implement a mechanism for automatically wrapping labels for graphol nodes whose label falls within their bounding box by default (class and object property comes to mind).

Motivation

Currently label placement il entirely managed by the user (label position, text wrapping, etc...). This has always been a source of problems when dealing with projects that use very long IRIs for predicates (e.g. for a long time we ignored the newlines that where included in them), and in general leads to bad practices since it mixes content with formatting. Another issue is that the existing behavior could degrade the quality of generated diagrams from the upcoming owl import feature.

From a quick brainstorming session we identified the following possible behavior wrt class nodes:

  1. Make their label bounding box match the class node bounding box
  2. Set the number of label lines equal to what fits said bounding box (using font metrics)
  3. Set label to automatically wrap (preferring patterns like spaces and _)
  4. Use an ellipsis when the label does not fit (probably wise to use the tooltip to display the full label)

IRIs should never allow literal newlines unless escaped (should be already the case), while newlines in annotations should always be preserved.

Example Use Cases

An example of said wrapping:
image

@mnamici mnamici added the enhancement New feature or request label Jun 8, 2022
@valeriosantarelli valeriosantarelli added this to the Eddy 3.4 milestone Jun 15, 2022
@mnamici
Copy link
Collaborator Author

mnamici commented Jun 15, 2022

Regarding label positioning, we should preserve what's currently in place (label movement by holding shift), and make them behave like the following:

  1. When the label falls within the parent-item's bounding box, apply the above rules to compute the appropriate wrapping.
  2. When outside of the parent-item's bounding box, use a default bounding box (1 or 2 lines) and truncate the rest.

Tooltips can be used to display the full value of the label.

@MariaRosariaFraraccio MariaRosariaFraraccio linked a pull request Nov 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants