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
13 @element.get_parent('system_picture', this, {
\r
14 success: (@system_picture) =>
\r
24 src: @system_picture.picture_file().src(),
\r
25 alt: @element.get('caption'),
\r
26 style: Pettanr.to_style(@style())
\r
34 'z-index': 1 # play case
\r
37 class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
\r
39 initialize: (options) ->
\r
43 @listenTo(@element, 'input:system_picture_id', @input_r)
\r
44 @listenTo(@element, 'input:width', @resize)
\r
45 @listenTo(@element, 'input:height', @resize)
\r
46 sb = @speech_balloon
\r
48 this.$el.resizable {
\r
49 stop: (event, ui) ->
\r
51 speech_balloon_div = sb.$el
\r
53 resize_div.css('top', '0px')
\r
54 resize_div.css('left', '0px')
\r
55 # resize_div.css('z-index', 1)
\r
56 width = ui.size.width
\r
57 height = ui.size.height
\r
58 top = speech_balloon_div.position().top
\r
59 if ui.originalPosition.top != ui.position.top
\r
60 top += ui.position.top
\r
61 speech_balloon_div.css('top', top.toString() + 'px')
\r
62 speech_balloon_div.css('height', height + 'px')
\r
63 left = speech_balloon_div.position().left
\r
64 if ui.originalPosition.left != ui.position.left
\r
65 left += ui.position.left
\r
66 speech_balloon_div.css('left', left.toString() + 'px')
\r
67 speech_balloon_div.css('width', width + 'px')
\r
68 speech_balloon_div.css('width', width.toString() + 'px')
\r
69 speech_balloon_div.css('height', height.toString() + 'px')
\r
71 x: Math.floor(left),
\r
72 y: Math.floor(top),
\r
76 elm.trigger('resize')
\r
86 width: Pettanr.to_s(@element.get('width')) + 'px',
\r
87 height: Pettanr.to_s(@element.get('height')) + 'px',
\r
88 'z-index': 1 # play case
\r
92 @element.get_parent('system_picture', this, {
\r
93 success: (@system_picture) =>
\r
95 #resize_div = this.$el.parent()
\r
96 #resize_div.css('z-index', 1)
\r
100 resize_div = this.$el.parent()
\r
101 resize_div.css('width', '100%')
\r
102 resize_div.css('height', '100%')
\r
103 this.$el.css('width', '100%')
\r
104 this.$el.css('height', '100%')
\r