Module: Conquer::Dzen::Positioning

Included in:
Graphics::Graphic, Interaction::TooltipListener, Helpers
Defined in:
lib/conquer/dzen/positioning.rb

Instance Method Summary collapse

Instance Method Details

#ignore_bg(state = :on) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/conquer/dzen/positioning.rb', line 4

def ignore_bg(state = :on)
  if block_given?
    "^ib(1)#{yield}^ib(0)"
  else
    "^ib(#{state == :on ? 0 : 1})"
  end
end

#lock_x(options = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/conquer/dzen/positioning.rb', line 12

def lock_x(options = {})
  if block_given?
    "#{'^ib(1)' if options[:ignore_bg]}" \
    "#{lock_x}#{yield}#{unlock_x}" \
    "#{'^ib(0)' if options[:ignore_bg]}"
  else
    "#{'^ib(1)' if options[:ignore_bg]}^p(_LOCK_X)"
  end
end

#shift(x, y = 0) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/conquer/dzen/positioning.rb', line 26

def shift(x, y = 0)
  return "#{shift(x, y)}#{yield}#{shift(-x)}^p()" if block_given?
  x = x.round
  y = y.round
  x = nil if x == 0
  y = nil if y == 0
  return unless x || y
  "^p(#{x};#{y})"
end

#unlock_xObject



22
23
24
# File 'lib/conquer/dzen/positioning.rb', line 22

def unlock_x
  '^p(_UNLOCK_X)'
end