sozi-projects / Sozi

A "zooming" presentation editor
http://sozi.baierouge.fr
Mozilla Public License 2.0
1.58k stars 164 forks source link

Preview in Sozi different from SVG and HTML-export #479

Open pwab opened 4 years ago

pwab commented 4 years ago

Summary of your problem

The preview window in Sozi differes from the content of a created SVG. A few lines or layers aren't visible. In the HTML export all lines/layers are visible (like in the SVG).

Version of Sozi and other relevant software

Steps to reproduce the problem

  1. Create a SVG with layers
  2. Open it with Sozi
  3. See that there are a few lines/layers hidden
  4. Open the HTML
  5. See that all layers/lines are shown

Expected behavior

All lines/layers are shown in the preview window like in the SVG file.

SVG 01_svg

Observed behavior

Some lines/layers aren't shown in the preview window.

Sozi preview 02_preview

HTML in Browser 03_browser

Hints and solutions

Test project (opened with Sozi 20.03): layer_after_layer_sample.zip

aumouvantsillage commented 4 years ago

Thanks for reporting the issue. I will have a look at your files.

aumouvantsillage commented 4 years ago

This is an unusual situation that happens on layers that contain only one horizontal or vertical line. They become visible when you rotate them in Sozi.

In their original position, these layers appear to have their width or height equal to zero, which could be the cause of the issue. I think that the behavior is different in the generated HTML because the "clip" feature is implemented differently:

In the editor, removing the "mask" attribute on the concerned layers make them visible again.

However, there is no obvious reason why masking would behave this way. I would say that the issue is not in Sozi itself, but in the rendering engine of Electron. I think we could try to reproduce the issue in Chrome as well with the appropriate SVG. I will check whether a more recent version of Electron fixes it.

As a workaround, you can add elements to each layer to make sure they have non-zero width and height.

pwab commented 4 years ago

Wow thanks for the long explanation and for providing a workaround.

Will check this tomorrow.