Added support for "extends" in layouts
This commit is contained in:
+20
-13
@@ -3,25 +3,32 @@ frame:
|
||||
y: 38
|
||||
width: 750
|
||||
height: 1050
|
||||
radius: 25
|
||||
title:
|
||||
x: 125
|
||||
y: 50
|
||||
width: 625
|
||||
height: 150
|
||||
align: !ruby/symbol center
|
||||
hint: !ruby/symbol cyan
|
||||
height: 100
|
||||
align: !ruby/symbol center #see http://www.yaml.org/YAML_for_ruby.html#symbols
|
||||
valign: !ruby/symbol middle
|
||||
subtitle:
|
||||
x: 125
|
||||
x: 150
|
||||
y: 150
|
||||
width: 625
|
||||
height: 150
|
||||
icon_left:
|
||||
x: 200
|
||||
y: 250
|
||||
width: 575
|
||||
height: 60
|
||||
align: !ruby/symbol center
|
||||
valign: !ruby/symbol middle
|
||||
icon:
|
||||
width: 125
|
||||
height: 125
|
||||
icon_right:
|
||||
x: 400
|
||||
y: 250
|
||||
width: 125
|
||||
height: 125
|
||||
icon_left:
|
||||
extends: icon
|
||||
x: 150
|
||||
icon_middle:
|
||||
extends: icon
|
||||
x: 350
|
||||
y: 400 #overrides the y inherited from icon
|
||||
icon_right:
|
||||
extends: icon
|
||||
x: 550
|
||||
|
||||
+12
-4
@@ -2,20 +2,28 @@ require 'squib'
|
||||
|
||||
Squib::Deck.new(layout: 'custom-layout.yml') do
|
||||
background color: :white
|
||||
hint text: :cyan
|
||||
|
||||
# Layouts are YAML files that specify x, y, width, and height coordinates
|
||||
# Layouts are YAML files that specify any option as a default
|
||||
rect layout: :frame
|
||||
|
||||
# You can also override a given layout entry in the command
|
||||
rect layout: :frame, width: 50, height: 50
|
||||
circle layout: :frame, x: 50, y: 50, radius: 25
|
||||
|
||||
# Any command with x-y-width-height options, we can use a custom layout
|
||||
text str: 'The Title', layout: :title
|
||||
png file: 'shiny-purse.png', layout: :icon_left
|
||||
|
||||
# Layouts also support an "extends" attribute to reuse settings
|
||||
svg file: 'spanner.svg', layout: :icon_left
|
||||
png file: 'shiny-purse.png', layout: :icon_middle
|
||||
svg file: 'spanner.svg', layout: :icon_right
|
||||
|
||||
# Strings can also be used in layouts
|
||||
# Strings can also be used to specify a layout (e.g. from a data file)
|
||||
text str: 'subtitle', layout: 'subtitle'
|
||||
|
||||
# For debugging purposes, you can always print out the loaded layout
|
||||
# require 'pp'
|
||||
# pp @layout
|
||||
|
||||
save_png prefix: 'layout_'
|
||||
end
|
||||
Reference in New Issue
Block a user