Module: Shoes::DSL::Style
- Included in:
- Shoes::DSL
- Defined in:
- shoes-core/lib/shoes/dsl/style.rb
Overview
DSL methods for styling elements in Shoes applications
Constant Summary collapse
- PATTERN_APP_STYLES =
Each value is a top-level Shoes DSL method overriding the default styling of following elements.
[:fill, :stroke].freeze
- OTHER_APP_STYLES =
Each value is a top-level Shoes DSL method overriding the default styling of following elements.
[:cap, :rotate, :strokewidth, :transform].freeze
Instance Method Summary collapse
-
#nofill ⇒ Shoes::App
Clear any default fill settings following this call.
-
#nostroke ⇒ Shoes::App
Clear any default stroke settings following this call.
-
#style(klass_or_styles = nil, styles = {}) ⇒ Object
Apply default styling at the app or element class level.
-
#translate(left, top) ⇒ Shoes::App
Shift position of all elements following this call.
Instance Method Details
#nofill ⇒ Shoes::App
Clear any default fill settings following this call.
79 80 81 82 83 |
# File 'shoes-core/lib/shoes/dsl/style.rb', line 79 def nofill @__app__.remove_styles << :fill @__app__.style[:fill] = nil @__app__.app end |
#nostroke ⇒ Shoes::App
Clear any default stroke settings following this call.
70 71 72 73 74 |
# File 'shoes-core/lib/shoes/dsl/style.rb', line 70 def nostroke @__app__.remove_styles << :stroke @__app__.style[:stroke] = nil @__app__.app end |
#style(klass, styles) ⇒ Object #style(styles) ⇒ Object #style ⇒ Hash
Apply default styling at the app or element class level.
27 28 29 30 31 32 33 34 |
# File 'shoes-core/lib/shoes/dsl/style.rb', line 27 def style(klass_or_styles = nil, styles = {}) if klass_or_styles.kind_of? Class klass = klass_or_styles @__app__.element_styles[klass] = styles else @__app__.style(klass_or_styles) end end |
#translate(left, top) ⇒ Shoes::App
Shift position of all elements following this call.
62 63 64 65 |
# File 'shoes-core/lib/shoes/dsl/style.rb', line 62 def translate(left, top) @__app__.style[:translate] = [left, top] @__app__.app end |