opencaesar / oml-vision

A VS Code extension providing UI viewpoints for OML models
Other
4 stars 2 forks source link

Create insert panel for inserting instances and relations #48

Open aematei opened 6 months ago

aematei commented 6 months ago

Checklist before submitting a merge request

Description of contribution

[Describe your contribution, link to any existing relevant issues]

Testing performed

How to Test Expected functionality changes

[Describe expected behaviour changes in steps]

Additional context

[If needed, you may add additional context]

aematei commented 4 months ago

Hey @pogi7, I noticed that the color of diagram nodes is specified in a model's components.json file. I want to access the value node in this file so that I can color the instances in the diagram insert panel. Do you know of a way I can access this value from Diagram.tsx? I did some digging but I'm having trouble finding it.

pogi7 commented 4 months ago

Hey @pogi7, I noticed that the color of diagram nodes is specified in a model's components.json file. I want to access the value node in this file so that I can color the instances in the diagram insert panel. Do you know of a way I can access this value from Diagram.tsx? I did some digging but I'm having trouble finding it.

@aematei You may be able to access the color of the diagram nodes by accessing the background-color of the ref. You may be able to access the color of the diagram node by using React.useRef

Here's an example of using React.useRef in the code to find the font-size of the tableContainerRef ref (please refer to view/src/components/Table/Table.tsx L67 - L65):

const tableContainerRef = React.useRef<HTMLDivElement>(null);

// Set the Font Size
React.useEffect(() => {
  if (tableContainerRef.current) {
    tableContainerRef.current.style.setProperty("--font-size", `${fontSize}`);
  }
}, [fontSize]);