Baking controls now scale to fit the pane correctly

This commit is contained in:
n1474335 2019-06-28 17:09:00 +01:00
parent a5ea7f7d58
commit 6f6786d79e
4 changed files with 29 additions and 4 deletions

View File

@ -244,7 +244,7 @@ class App {
/**
* Sets up the adjustable splitter to allow the user to resize areas of the page.
*
* @param {boolean} [minimise=false] - Set this flag if attempting to minimuse frames to 0 width
* @param {boolean} [minimise=false] - Set this flag if attempting to minimise frames to 0 width
*/
initialiseSplitter(minimise=false) {
if (this.columnSplitter) this.columnSplitter.destroy();
@ -252,9 +252,9 @@ class App {
this.columnSplitter = Split(["#operations", "#recipe", "#IO"], {
sizes: [20, 30, 50],
minSize: minimise ? [0, 0, 0] : [240, 370, 450],
minSize: minimise ? [0, 0, 0] : [240, 310, 450],
gutterSize: 4,
expandToMin: false,
expandToMin: true,
onDrag: function() {
this.manager.recipe.adjustWidth();
}.bind(this)

View File

@ -617,6 +617,23 @@ class RecipeWaiter {
ingredientRule.style.gridTemplateColumns = "auto auto auto auto";
ingredientChildRule.style.gridColumn = "1 / span 4";
}
// Hide Chef icon on Bake button if the page is compressed
const bakeIcon = document.querySelector("#bake img");
if (recList.clientWidth < 370) {
// Hide Chef icon on Bake button
bakeIcon.style.display = "none";
} else {
bakeIcon.style.display = "inline-block";
}
// Scale controls to fit pane width
const controls = document.getElementById("controls");
const controlsContent = document.getElementById("controls-content");
const scale = (controls.clientWidth - 1) / controlsContent.scrollWidth;
controlsContent.style.transform = `translate(-50%, -50%) scale(${scale})`;
}
}

View File

@ -191,7 +191,7 @@
<ul id="rec-list" class="list-area no-select"></ul>
<div id="controls" class="no-select">
<div class="d-flex align-items-center">
<div id="controls-content" class="d-flex align-items-center">
<button type="button" class="mx-2 btn btn-lg btn-secondary" id="step" data-toggle="tooltip" title="Step through the recipe">
Step
</button>

View File

@ -21,6 +21,14 @@
background-color: var(--secondary-background-colour);
}
#controls-content {
position: relative;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
transform-origin: center left;
}
#auto-bake-label {
display: inline-block;
width: 100px;