mirror of
https://github.com/mfontanini/presenterm.git
synced 2025-05-05 15:32:58 +00:00
fix: also calculate scaled amount regarding height
This commit is contained in:
parent
7b2ba0eb8c
commit
262b2af3e7
@ -176,6 +176,10 @@ impl ExportRenderer {
|
||||
OutputFormat::Pdf => format!("{width}px"),
|
||||
OutputFormat::Html => "100vw".to_string(),
|
||||
};
|
||||
let css_container_height = match self.output_format {
|
||||
OutputFormat::Pdf => format!("{height}px"),
|
||||
OutputFormat::Html => "100vh".to_string(),
|
||||
};
|
||||
let css = format!(
|
||||
r"
|
||||
pre {{
|
||||
@ -192,6 +196,7 @@ impl ExportRenderer {
|
||||
font-size: {FONT_SIZE}px;
|
||||
line-height: {LINE_HEIGHT}px;
|
||||
width: {css_container_width};
|
||||
height: {css_container_height};
|
||||
overflow: hidden;
|
||||
transform-origin: top center;
|
||||
background-color: {background_color};
|
||||
@ -199,6 +204,7 @@ impl ExportRenderer {
|
||||
|
||||
.container {{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
@ -228,6 +234,7 @@ impl ExportRenderer {
|
||||
"
|
||||
<script>
|
||||
let originalWidth = {width};
|
||||
let originalHeight = {height};
|
||||
{script}
|
||||
</script>"
|
||||
)
|
||||
|
@ -15,7 +15,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
function scaler() {
|
||||
var w = document.documentElement.clientWidth;
|
||||
let scaledAmount= w/originalWidth;
|
||||
var h = document.documentElement.clientHeight;
|
||||
let widthScaledAmount= w/originalWidth;
|
||||
let heightScaledAmount= h/originalHeight;
|
||||
let scaledAmount = Math.min(widthScaledAmount, heightScaledAmount);
|
||||
document.querySelector("body").style.transform = `scale(${scaledAmount})`;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user