-<div class="pettanr-comic-panel" style="width:<%= panel.width %>px;height:<%= panel.height %>px;border-style: solid;border-width: <%= panel.border %>px;border-color:black; background-color:white;">
- <% panel.panel_elements.each do |elm| %>
- <% case elm.class.to_s %>
- <% when 'PanelPicture' %>
- <%= tag(:img, elm.opt_img_tag) %>
- <% when 'SpeechBalloon' %>
- <% balloon = elm.balloons.first %>
- <div id="vballoon<%= elm.id -%>" class="pettanr-comic-balloon" style="width:<%= balloon.width -%>px; height:<%= balloon.height -%>px; top:<%= balloon.y -%>px; left:<%= balloon.x -%>px; z-index:<%= elm.z -%>; ">
- <img src="<%= balloon.system_picture.url -%>" alt="<%= balloon.caption -%>">
- <% elm.speeches.each do |speech| %>
- <p style="top:<%= speech.y -%>px; left:<%= speech.x -%>px;width:<%= speech.width -%>px; height:<%= speech.height -%>px;">
- <span><%= h speech.content -%></span>
- </p>
- <% end %>
- </div>
- <% when 'GroundColor' %>
- <div id="ground-color<%= elm.id -%>" class="pettanr-comic-ground-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:<%= elm.color.name -%>;">
+<% panel.panel_elements.each do |elm| %>
+ <% case elm.class.to_s %>
+ <% when 'SpeechBalloon' %>
+ <%
+ speech_balloon = elm
+ speech_balloon_template = speech_balloon.speech_balloon_template
+ balloon = speech_balloon.balloon
+ speech = speech_balloon.speech
+ speech_balloon.extend speech_balloon_template.engine_speech_balloon_module
+ balloon.extend speech_balloon_template.engine_balloon_module
+ speech.extend speech_balloon_template.engine_speech_module
- </div>
- <% when 'PanelColor' %>
- <div id="panel-color<%= elm.id -%>" class="pettanr-comic-panel-color" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-color:#<%= format("%x", elm.code) -%>;">
+ balloon.new_speech_balloon = speech_balloon
+ speech.new_speech_balloon = speech_balloon
- </div>
- <% when 'GroundPicture' %>
- <div id="ground-picture<%= elm.id -%>" class="pettanr-comic-ground-picture" style="width:<%= panel.width -%>px; height:<%= panel.height -%>px; z-index:<%= elm.z -%>; background-image: url(<%= full_url elm.picture.url -%>); background-repeat: <%= MagicNumber['ground_picture_repeat_items'][elm.repeat] -%>; background-position: <%= elm.x -%>px, <%= elm.y -%>px;">
-
- </div>
- <% end %>
+ %>
<% end %>
+<% end %>
+<div id="<%= panel.tag_id -%>" panel_id="<%= panel.tag_panel_id -%>" class="pettanr-comic-panel" style="width:<%= panel.width %>px;height:<%= panel.height %>px;border-style: solid;border-width: <%= panel.border %>px;border-color:black; background-color:white;">
+ <% panel.panel_elements.each do |elm| %>
+ <%= render elm.class.to_s.tableize + '/element', :elm => elm, :spot => spot %>
+ <% end %>
</div>