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

[Question] Apply property changes directly in the JSON file. #1075

Closed
mauroalexandre opened this issue Feb 3, 2024 · 6 comments
Closed

[Question] Apply property changes directly in the JSON file. #1075

mauroalexandre opened this issue Feb 3, 2024 · 6 comments
Labels
discussion discussion

Comments

@mauroalexandre
Copy link
Contributor

I developed a tool to apply style (color, borders, etc.) to all elements of the project at once.

I do this through a regular expression applied to the project's JSON file.

However, something strange happens. When I apply it and reload the project, the style doesn't change. I need to go into each element and save the properties, then they apply.

I noticed that there is a field in the JSON called svgData.

Would I need to change it there too? Is there a simple way to 'recompile the whole project' and generate the jsonData again?

@unocelli
Copy link
Member

unocelli commented Feb 4, 2024

Hi,
I am not sure if I understand what you mean.

@mauroalexandre
Copy link
Contributor Author

@unocelli I'm sorry, I'll try to be clearer in my question.

Steps to Reproduce:

  1. Create a blank project.
  2. Add 1 pipe to the project.
  3. Save the project as JSON.
  4. Open the JSON file in a text editor.
  5. Modify a property of an SVG element (for example, change the pipe's color).
  6. Save the file.
  7. Load the project again.
  8. The color change is not visible; open the pipe's property through the editor.
  9. Do nothing, just click OK.
  10. The color change should now be applied.

Please refer to the attached video for visual demonstration.

Peek.2024-02-04.16-39.mp4

@unocelli
Copy link
Member

unocelli commented Feb 8, 2024

Hi,
you have to search in svgcontent, a pipe is a svg element composed from more 'path', so from where you changed the color you take the id and search (it should be "id": "PIE_...") when you find the svg element which should be a 'g' you can change the fill and stroke attributes of the 'path' element inside the 'g' element.

@mauroalexandre
Copy link
Contributor Author

Understood, but I would like to change several other things. Is this svgcontent tag generated by reading other properties from the JSON, right? At what point is the svgdata generated?"

@unocelli
Copy link
Member

unocelli commented Feb 8, 2024

Every View have a list of items (controls, shapes) with attributes for the logic and a svgcontent that is svg image where to apply items logic (you could practically edit it with inkscape)

@unocelli unocelli added the discussion discussion label Feb 13, 2024
@unocelli
Copy link
Member

I assume the issue has been resolved in the meanwhile. I'm therefore going to close this issue.

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

No branches or pull requests

2 participants