1 class Pettanr.Views.Balloon.Element extends Backbone.View
\r
3 className: 'pettanr-balloon'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
9 @speech_balloon = options.parent
\r
10 @system_picture = @element.system_picture()
\r
11 @system_picture.fetch({cache: true}).done =>
\r
19 src: @system_picture.r_url(),
\r
20 alt: @element.get('caption')
\r
25 class Pettanr.Views.Balloon.Element.Edit extends Pettanr.Views.Balloon.Element
\r
27 initialize: (options) ->
\r
32 sb = @speech_balloon
\r
34 this.$el.resizable {
\r
35 stop: (event, ui) ->
\r
37 speech_balloon_div = sb.$el
\r
39 resize_div.css('top', '0px')
\r
40 resize_div.css('left', '0px')
\r
41 width = ui.size.width
\r
42 height = ui.size.height
\r
43 top = speech_balloon_div.position().top
\r
44 if ui.originalPosition.top != ui.position.top
\r
45 top += ui.position.top
\r
46 speech_balloon_div.css('top', top.toString() + 'px')
\r
47 speech_balloon_div.css('height', height + 'px')
\r
48 left = speech_balloon_div.position().left
\r
49 if ui.originalPosition.left != ui.position.left
\r
50 left += ui.position.left
\r
51 speech_balloon_div.css('left', left.toString() + 'px')
\r
52 speech_balloon_div.css('width', width + 'px')
\r
53 speech_balloon_div.css('width', width.toString() + 'px')
\r
54 speech_balloon_div.css('height', height.toString() + 'px')
\r
56 x: Math.floor(left),
\r
57 y: Math.floor(top),
\r
61 elm.trigger('resize')
\r
62 resize: (event, ui) ->
\r
64 speech_balloon_div = resize_div.parent()
\r