regebro / hovercraft

Make dynamic impressive presentations from text files!
https://hovercraft.readthedocs.org
MIT License
1.48k stars 209 forks source link

fix relative positioning not being relative to scale #205

Closed PostPollux closed 4 years ago

PostPollux commented 4 years ago

The problem was the following: I worked in scale 1 and set all the positions relatively so that everything looked nice. Then I started to change the :data-scale: on some steps to give it more depth. All the translations stayed the same in terms of numbers, but visually the distances looked VERY differently. So as soon as you change something in scale you have to adjust EVERY step manually again.

This PR fixes that by multiplying the relative value with the scale. So now now matter in which scale we are right now, it always looks the same!

regebro commented 4 years ago

Could you make an example of when this is not working, because I don't quite understand what it's supposed to fix...

PostPollux commented 4 years ago

Here is a demo presentation. Please compile it and I hope you get what I mean.

scale_demo.zip

I think the reason behind relative positioning is that you don't have to make everything again if you add something in between. Everythins is ment to behave the same, just with a step in between. Currently this works, if you just change positions. But as soon as I change the scale it does not look the same anymore. This is very problematic if you want to rearrange stuff later on because all your transitions can suddenly look very different.

If you compile my scale_demo with my with hovercraft that has that pull request applied, then you will notice, that thetransitions between the images will look exactly the same, no matter in which scale we are...

Hope that helps!

regebro commented 4 years ago

Ah, I see, yes, the coordinate system is independent of scale, so this is expected. Changing that would be incredibly confusing, as 1 wouldn't mean 1 anymore, it could mean any number of things, and it would be almost impossible to have full control of where you want to go.

We could have a "left", "right", "up" and "down" statements that would move things one "screen" left and right, the problem there is that how much a screen is would depend on the screen proportions, and we don't know them at generation time. But that could possibly be a solution?

PostPollux commented 4 years ago

Hm. Actually I'm not so sure if it is that confusing. At least while I'm using only relative positions. Because if I type "data-x: 2000" I expect it to move 2000 pixels to the right, no matter in which scale I am. It's easy to guess the numbers then, because I know what a 2000 pixels transition look like. Now if it is dependent on the scale I have to calculate it in my brain each time after the scale changed or I have to guess + it visually changes if I change the scale later on.

Ok, but if I start to mix relative positions with absolute one, yes, then it will get confusing. You are right. I didn't think about that as I never had the need for something to be absolute. In this case 2000 in absolute would be something different then 2000 in relative when we are not in the scale of 1.

For me personally a good relative workflow is much more important than a possible confusion with the absolute one. But that's just me. Doesn't mean that that applies to everyone.

btw. I also implemented relative scale (not in this pull request) so that i can use stuff like "data-scale: r1.5" which I find pretty useful aswell as it is essential if I want to reorder my steps later on without having to change everything again

regebro commented 4 years ago

It gets confusing even when using only relative positions, since you will have to recalculate how much to move depending on your scaling if you want to move to a particular position relative to other slides. If you for example want to move back to another slide, but in a zoomed out position, this gets very confusing.

Relative scaling would make sense.

regebro commented 4 years ago

In addition, the relative scaling now has the same scale as the absolute scaling, with this, how would the absolute scaling work, would it also scale? That would be super confusing. We'll try to solve this some other way.

regebro commented 4 years ago

I think the proposal here is essentially the same as what I mentioned above with moving left, right, up etc: #141