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

Configure "Show more" Display in Annotations Component as CSS #762

Open
3 tasks
joncameron opened this issue Jan 22, 2025 · 1 comment
Open
3 tasks

Configure "Show more" Display in Annotations Component as CSS #762

joncameron opened this issue Jan 22, 2025 · 1 comment
Assignees

Comments

@joncameron
Copy link
Contributor

joncameron commented Jan 22, 2025

Description

The amount of text shown and the "Show more" button should change depending on how the component changes shape to fill available space on the page.

Could be useful to have it be configurable when this button displays as a prop.

Done Looks Like

  • Add prop for "Show more" display to be set up when component is initialized
  • Identify how many rows are populating in the text
  • Make CSS changes based on the height (show more/less)
@elynema elynema changed the title Configure "Show more" Display in Annotations Component Configure "Show more" Display in Annotations Component as CSS Jan 22, 2025
@Dananji Dananji self-assigned this Feb 3, 2025
@Dananji
Copy link
Collaborator

Dananji commented Feb 7, 2025

The display of 'Show more' button can be turned ON/OFF by using the value of showMoreSettings: { enableShowMore: false, textLineLimit: 6 } prop passed into MarkersDisplay component at the time of initialization.

The calculation for truncating longer annotation texts uses a temporary Canvas object to calculate average character width based on font, fontSize, and clientWidth of the annotation text HTML div element for a given annotation text.
Using this average character width, the code calculates the maximum number of characters the div can display without exceeding the textLineLimit value given in the props.

This calculation is performed every time the browser is resized, to accurately truncate the text as the component size changes.

Display of longer texts in an annotation:

longer text in annotation

Display of multiple shorter texts in a single annotation, where the count of texts in the annotation exceeds the given textLineLimit number:

multiple texts in annotation

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

No branches or pull requests

2 participants