mirror of
https://github.com/mfontanini/presenterm.git
synced 2025-05-05 23:42:59 +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::Pdf => format!("{width}px"),
|
||||||
OutputFormat::Html => "100vw".to_string(),
|
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!(
|
let css = format!(
|
||||||
r"
|
r"
|
||||||
pre {{
|
pre {{
|
||||||
@ -192,6 +196,7 @@ impl ExportRenderer {
|
|||||||
font-size: {FONT_SIZE}px;
|
font-size: {FONT_SIZE}px;
|
||||||
line-height: {LINE_HEIGHT}px;
|
line-height: {LINE_HEIGHT}px;
|
||||||
width: {css_container_width};
|
width: {css_container_width};
|
||||||
|
height: {css_container_height};
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transform-origin: top center;
|
transform-origin: top center;
|
||||||
background-color: {background_color};
|
background-color: {background_color};
|
||||||
@ -199,6 +204,7 @@ impl ExportRenderer {
|
|||||||
|
|
||||||
.container {{
|
.container {{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
@ -228,6 +234,7 @@ impl ExportRenderer {
|
|||||||
"
|
"
|
||||||
<script>
|
<script>
|
||||||
let originalWidth = {width};
|
let originalWidth = {width};
|
||||||
|
let originalHeight = {height};
|
||||||
{script}
|
{script}
|
||||||
</script>"
|
</script>"
|
||||||
)
|
)
|
||||||
|
@ -15,7 +15,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
|
|
||||||
function scaler() {
|
function scaler() {
|
||||||
var w = document.documentElement.clientWidth;
|
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})`;
|
document.querySelector("body").style.transform = `scale(${scaledAmount})`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user