ajstarks / giocanvas

Canvas API built with Gio
Other
141 stars 15 forks source link

Layout options related to resize and perf issues. #10

Closed gedw99 closed 1 year ago

gedw99 commented 1 year ago

I wrote had some code to allow resizing with all the slides of the deck shown as a continuous vertical stack, as well as horizontal resizing.

It worked, BUT, but perf was terrible. After you get to the 10th slide things got slow and blocking...

But last week i realised an elegant way to fix it which i think is worthwhile and would like to propose.

Basically there are 2 viewing modes.

  1. Make it more like how most PDF viewers work, with each slide ( of the whole deck ) as a mini thumbnail on the left pane and a single slide on the right pane. As you click the on the left pane, your loading a new slide and all is good, and the horizontal reising is fine in terms of performance. This avoids the perf problems because there is only deck at a time. The thumbnails are PNGS, so its fine to have a ton of them on the left pane.

  2. If you want the continuous vertical stacking of the slides in a deck with resizing, then we need to do the faked continuous scrolling trick.

Basically we have the terms Screen space versus Model space:

The easy way to do this is to dynamically alter the XML of each slide as the user scrolls. Any slide not in Screen Space ( ie visible ) has no XML inside it. Most importantly the respective deck's size is kept, so that we don't mess up the scrolling bar. As the user scrolls vertically we put the real XML back in for which ever slide (s) are n Screen space.

A deck with 500 pages is possible with no performance issues.


Technique 2 impacts how we do Technique 1 too. In Technique 1 the left pane with hundreds of Slides can use the same trick. SO we dont have to convert to PNG thumbnails. We can show the real vector format.

ajstarks commented 1 year ago

Now resizeable see: revision: https://github.com/ajstarks/giocanvas/commit/b22c8db862c53b58bec44fbc3cd9383994a048cc

If you do not resize, the specified (and default) pagesize is used. If you resize, the deck is resized proportionally. Thanks to andybalholm

gedw99 commented 1 year ago

Ok thanks