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
20 src: @system_picture.picture_file().src(),
\r
21 alt: @element.get('caption'),
\r
22 style: Pettanr.to_style(@style())
\r
30 'z-index': 1 # play case
\r
33 class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
\r
35 initialize: (options) ->
\r
39 @listenTo(@element, 'input:system_picture_id', @input_r)
\r
40 @listenTo(@element, 'input:width', @resize)
\r
41 @listenTo(@element, 'input:height', @resize)
\r
42 sb = @speech_balloon
\r
44 this.$el.resizable {
\r
45 stop: (event, ui) ->
\r
47 speech_balloon_div = sb.$el
\r
49 resize_div.css('top', '0px')
\r
50 resize_div.css('left', '0px')
\r
51 # resize_div.css('z-index', 1)
\r
52 width = ui.size.width
\r
53 height = ui.size.height
\r
54 top = speech_balloon_div.position().top
\r
55 if ui.originalPosition.top != ui.position.top
\r
56 top += ui.position.top
\r
57 speech_balloon_div.css('top', top.toString() + 'px')
\r
58 speech_balloon_div.css('height', height + 'px')
\r
59 left = speech_balloon_div.position().left
\r
60 if ui.originalPosition.left != ui.position.left
\r
61 left += ui.position.left
\r
62 speech_balloon_div.css('left', left.toString() + 'px')
\r
63 speech_balloon_div.css('width', width + 'px')
\r
64 speech_balloon_div.css('width', width.toString() + 'px')
\r
65 speech_balloon_div.css('height', height.toString() + 'px')
\r
67 x: Math.floor(left),
\r
68 y: Math.floor(top),
\r
72 elm.trigger('resize')
\r
82 width: Pettanr.to_s(@element.get('width')) + 'px',
\r
83 height: Pettanr.to_s(@element.get('height')) + 'px',
\r
84 'z-index': 1 # play case
\r
88 @element.get_parent('system_picture', this, {
\r
89 success: (@system_picture) =>
\r
91 #resize_div = this.$el.parent()
\r
92 #resize_div.css('z-index', 1)
\r
96 resize_div = this.$el.parent()
\r
97 resize_div.css('width', '100%')
\r
98 resize_div.css('height', '100%')
\r
99 this.$el.css('width', '100%')
\r
100 this.$el.css('height', '100%')
\r