sprotty icon indicating copy to clipboard operation
sprotty copied to clipboard

[layout] consider getting layout params from CSS

Open JanKoehnlein opened this issue 6 years ago • 0 comments

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.

JanKoehnlein avatar Feb 08 '19 12:02 JanKoehnlein