Skip to content

Commit

Permalink
add wrapping for longer annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Oct 11, 2024
1 parent 167a7c8 commit b701702
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/features/dfdElements/nodeAnnotationUi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,21 @@ export class DfdNodeAnnotationUI extends AbstractUIExtension {
// because the cursor is going a bit over the model and then the popup would re-show
// with the new position after the timeout.
const mousePosition = this.mouseListener.getMousePosition();
containerElement.style.left = `${mousePosition.x - 2}px`;
containerElement.style.top = `${mousePosition.y - 2}px`;
const annotationPosition = {
x: mousePosition.x - 2,
y: mousePosition.y - 2,
};
containerElement.style.left = `${annotationPosition.x}px`;
containerElement.style.top = `${annotationPosition.y}px`;

// Set tooltip size and scroll to prevent them from growing out of the screen
containerElement.style.overflowY = "auto";
this.annotationParagraph.style.textWrap = "wrap";

Check failure on line 174 in src/features/dfdElements/nodeAnnotationUi.ts

View workflow job for this annotation

GitHub Actions / build

Property 'textWrap' does not exist on type 'CSSStyleDeclaration'.
this.annotationParagraph.style.overflowWrap = "anywhere";
const screenWidth = window.innerWidth;
const screenHeight = window.innerHeight;
containerElement.style.maxWidth = `${Math.max(screenWidth - annotationPosition.x - 50, 100)}px`;
containerElement.style.maxHeight = `${Math.max(screenHeight - annotationPosition.y - 50, 50)}px`;

// Set content
if (!node.annotation) {
Expand Down

0 comments on commit b701702

Please sign in to comment.