Module: CircleSpeechBalloon::BalloonModule

Defined in:
lib/circle_speech_balloon.rb

Instance Method Summary collapse

Instance Method Details

#balloon_extendObject



42
43
44
45
# File 'lib/circle_speech_balloon.rb', line 42

def balloon_extend
  self.new_balloon unless @balloon_extend
  @balloon_extend
end

#balloon_extend=(params) ⇒ Object



47
48
49
# File 'lib/circle_speech_balloon.rb', line 47

def balloon_extend= params
  @balloon_extend = CircleSpeechBalloon::Balloon.new params
end

#new_balloon(params = {}) ⇒ Object



51
52
53
54
# File 'lib/circle_speech_balloon.rb', line 51

def new_balloon params = {} 
  @balloon_extend = CircleSpeechBalloon::Balloon.new params
  @balloon_extend.supply_default
end

#parsed_settingsObject



56
57
58
# File 'lib/circle_speech_balloon.rb', line 56

def parsed_settings 
  @parsed_settings ||= self.speech_balloon_template.parsed_settings
end

#r_stepObject



69
70
71
# File 'lib/circle_speech_balloon.rb', line 69

def r_step
  @r_step ||= self.parsed_settings['speech_balloon']['r_step']
end

#select_system_pictureObject



60
61
62
63
64
65
66
67
# File 'lib/circle_speech_balloon.rb', line 60

def select_system_picture 
  tr = self.r % 360
  tr = 360 + tr if tr < 0
  offset = self.r_step / 2.0
  idx = (((tr + offset) % 360) / self.r_step).to_i
  self.system_picture_id = self.parsed_settings[idx.to_s]['balloon']['system_picture_id']
  self.system_picture_id
end

#supply_defaultObject



33
34
35
36
37
38
39
40
# File 'lib/circle_speech_balloon.rb', line 33

def supply_default
  s = self.parsed_settings['all']['balloon']
  self.x = 0
  self.y = 0
  self.width = self.parsed_settings['speech_balloon']['default_width']
  self.height = self.parsed_settings['speech_balloon']['default_height']
  self.r = self.parsed_settings['speech_balloon']['default_r']
end