Skip to content

[layout] consider getting layout params from CSS #54

@JanKoehnlein

Description

@JanKoehnlein

Sprotty is using CSS to style diagrams. This is very useful to interactively change some styling aspect in the diagram using the style editor in browser. Unfortunately, this stops at layout options, whcih are currently defined in as LayoutOptions in the SModel. The disadvantages of this are

  • tuning the node/edge layouts has very long turnarounds
  • the SModel blows up, which is problematic for client/server communication
  • to compensate we sometimes adapt the SModelFactory which adds further complexity,
  • we intoduced a cascading mechanism to collect the layout options by spreading them all values from the root to the current element, which may not scale well.

We should consider getting the layout options as CSS variables. We'd get

  • using the browser's internal and optimized capabilities for merging styles
  • interactive layout editing as with other styles
  • a better separation of concerns
  • a much smaller SModel.

The only problem may be that we have to listen for CSS changes in order to trigger a relayout. AFAIK we can only add change listeners to the direct CSS properties of the element. We'd maybe have to trigger the relayout manually, e.g. on a certain keystroke.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions