naturalcrit / homebrewery

Create authentic looking D&D homebrews using only markdown
https://homebrewery.naturalcrit.com
MIT License
1.07k stars 326 forks source link

[FEATURE]: Multiple pages preview / popout preview #1379

Open Gazook89 opened 3 years ago

Gazook89 commented 3 years ago

Would be nice to quickly toggle a Fit to Screen option for easy screen shots of whole single pages. As is, typically it requires using the browser zoom.

To an extreme, it could be possible to fit multiple pages to a screen using either float, css flex box, or css grid. Zoom buttons within the preview pane would set to "full size", fit page to screen, 2 pages per screen, 4 pages to screen, or 9 pages to screen (which could be used to display "trading cards") and this would be responsive sizing, not necessarily strict dimensions.

G-Ambatte commented 1 year ago

Further to this, there is a request today in the sub-Reddit to add a BrewRenderer zoom level (https://redd.it/yu6fig). As mentioned there, functionally, this can be achieved by setting an inline style on the <div class='pages'> BrewRenderer element of transform: scale(X%); and the appropriate UI elements to adjust the value of X.

I would envisage Fit to Screen using the same functionality, but calculating a value of X determined by comparing page height to viewport height.

Gazook89 commented 1 year ago

I'm not 100% sure this would be the best method. Here is what `.pages { transform: scale(.5); } looks like with a red background also applied to .pages for illustration:

image

I think ideally the container for each .page (which is currently .pages) should continue to span the preview window, rather than be transformed itself. If ever we wanted to shrink the pages so that pages could be shown in a different layout (e.g. side-by-side) it would be....difficult/weird.

Here is an old brew from Legacy that is probably the best I can get it just using the Styling within the brewRenderer:

https://homebrewery.naturalcrit.com/share/sye35rCW30Kq

image
Gazook89 commented 1 year ago

How far-fetched is allowing the preview frame to be popped-out into it's own window and continuing to edit it? Is that thing?

G-Ambatte commented 1 year ago

How far-fetched is allowing the preview frame to be popped-out into it's own window and continuing to edit it? Is that thing?

Pretty difficult, I think - I suspect it's basically a separate tab/window and then needs to subscribe to events from the editing page... I suspect CM6 might make this a lot easier, but right now, it would be a pretty huge undertaking.

I think ideally the container for each .page (which is currently .pages) should continue to span the preview window, rather than be transformed itself.

I don't disagree, it was the first place that I went looking to apply scaling controls. Unfortunately scaling page doesn't scale margins, so the gaps between pages become (relatively) enormous, whereas scaling pages scales the margins and keeps everything a constant spacing.

5e-Cleric commented 3 weeks ago

Fit to screen is here, both in width and height(actually whatever is longest).

Multiple pages can still be tracked through this issue, as well as popping out the preview.