Fixing globally togglable text hints
parent
393eeae450
commit
985c925d99
|
|
@ -7,10 +7,9 @@ module Squib
|
||||||
# Setting a hint to nil or to :off will disable hints. @see samples/text.rb
|
# Setting a hint to nil or to :off will disable hints. @see samples/text.rb
|
||||||
# @example
|
# @example
|
||||||
# hint text: :cyan
|
# hint text: :cyan
|
||||||
# hint text: :cyan, progress_bar: true
|
# hint text: :cyan
|
||||||
#
|
#
|
||||||
# @param [String] text the color of the text hint. To turn off use :off. @see README.md
|
# @param [String] text the color of the text hint. To turn off use :off. @see README.md
|
||||||
# @param [Boolean] progress_bar enable progress bars on long-running operations
|
|
||||||
# @return [nil] Returns nothing
|
# @return [nil] Returns nothing
|
||||||
# @api public
|
# @api public
|
||||||
def hint(text: :off)
|
def hint(text: :off)
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ module Squib
|
||||||
@custom_colors = {}
|
@custom_colors = {}
|
||||||
@img_dir = '.'
|
@img_dir = '.'
|
||||||
@progress_bar = Squib::Progress.new(false)
|
@progress_bar = Squib::Progress.new(false)
|
||||||
|
@text_hint = :off
|
||||||
cards.times{ @cards << Squib::Card.new(self, width, height) }
|
cards.times{ @cards << Squib::Card.new(self, width, height) }
|
||||||
load_config(config)
|
load_config(config)
|
||||||
load_layout(layout)
|
load_layout(layout)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ module Squib
|
||||||
# :nodoc:
|
# :nodoc:
|
||||||
# @api private
|
# @api private
|
||||||
def draw_text_hint(x,y,layout, color)
|
def draw_text_hint(x,y,layout, color)
|
||||||
color ||= @deck.text_hint
|
color = @deck.text_hint if color.to_s.eql? 'off' and not @deck.text_hint.to_s.eql? 'off'
|
||||||
return if color.to_s.eql? 'off'
|
return if color.to_s.eql? 'off'
|
||||||
# when w,h < 0, it was never set. extents[1] are ink extents
|
# when w,h < 0, it was never set. extents[1] are ink extents
|
||||||
w = layout.width / Pango::SCALE
|
w = layout.width / Pango::SCALE
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue