1 class Pettanr.Views.Balloon.Element extends Pettanr.View
\r
3 className: 'pettanr-balloon'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
9 @speech_balloon = options.parent
\r
16 @element.get_parent('system_picture', this, {
\r
17 success: (@system_picture) =>
\r
26 src: @system_picture.picture_file().src(),
\r
27 alt: @element.get('caption'),
\r
28 style: Pettanr.to_style(@style())
\r
36 'z-index': 1 # play case
\r
39 add_element: (element) ->
\r
42 class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
\r
44 initialize: (options) ->
\r
48 @listenTo(@element, 'input:system_picture_id', @input_r)
\r
49 @listenTo(@element, 'input:width', @resize)
\r
50 @listenTo(@element, 'input:height', @resize)
\r
51 sb = @speech_balloon
\r
53 this.$el.resizable {
\r
54 stop: (event, ui) ->
\r
56 speech_balloon_div = sb.$el
\r
58 resize_div.css('top', '0px')
\r
59 resize_div.css('left', '0px')
\r
60 # resize_div.css('z-index', 1)
\r
61 width = ui.size.width
\r
62 height = ui.size.height
\r
63 top = speech_balloon_div.position().top
\r
64 if ui.originalPosition.top != ui.position.top
\r
65 top += ui.position.top
\r
66 speech_balloon_div.css('top', top.toString() + 'px')
\r
67 speech_balloon_div.css('height', height + 'px')
\r
68 left = speech_balloon_div.position().left
\r
69 if ui.originalPosition.left != ui.position.left
\r
70 left += ui.position.left
\r
71 speech_balloon_div.css('left', left.toString() + 'px')
\r
72 speech_balloon_div.css('width', width + 'px')
\r
73 speech_balloon_div.css('width', width.toString() + 'px')
\r
74 speech_balloon_div.css('height', height.toString() + 'px')
\r
76 x: Math.floor(left),
\r
77 y: Math.floor(top),
\r
81 elm.trigger('resize')
\r
91 width: Pettanr.to_s(@element.get('width')) + 'px',
\r
92 height: Pettanr.to_s(@element.get('height')) + 'px',
\r
93 'z-index': 1 # play case
\r
98 resize_div = this.$el.parent()
\r
99 resize_div.css('z-index', 1)
\r
102 resize_div = this.$el.parent()
\r
103 resize_div.css('width', '100%')
\r
104 resize_div.css('height', '100%')
\r
105 this.$el.css('width', '100%')
\r
106 this.$el.css('height', '100%')
\r