Can set images to not stretch.

master
Zed A. Shaw 3 days ago
parent c64c81b599
commit 53c76de2d1
  1. 14
      sample/about-bezos.md
  2. 3
      src/slides_ui.cpp

@ -65,12 +65,18 @@ One Word
* Text will go over image * Text will go over image
* Image will stretch to fill * Image will stretch to fill
--- ---
{"layout": "image_left"} {
"layout": "image_left",
"image_stretch": false
}
# Specific Positions # Specific Positions
![image](assets/sample_bg.jpg) ![image](assets/sample_bg.jpg)
* !(assets/sample_bg.jpg) * ![image] before ()
* Text will go over image * Places in image
* Image will stretch to fill cell in layout.
* Can combine with
image_stretch and layout
to place it anywhere.
--- ---
# Hot Reload # Hot Reload
* It watches the file and * It watches the file and

@ -42,7 +42,8 @@ void Slide::init(lel::Cell& cell, const std::string& layout) {
if($config.contains("image")) { if($config.contains("image")) {
std::string image_name = $config["image"]; std::string image_name = $config["image"];
auto at_cell = $config.contains("image_cell") ? $gui.entity($config["image_cell"]) : content; auto at_cell = $config.contains("image_cell") ? $gui.entity($config["image_cell"]) : content;
$gui.set<guecs::Sprite>(at_cell, {image_name}); bool stretched = $config.contains("image_stretch") ? $config["image_stretch"].get<bool>() : true;
$gui.set<guecs::Sprite>(at_cell, {image_name, guecs::THEME.PADDING, stretched});
} }
$gui.init(); $gui.init();

Loading…
Cancel
Save