1 class Pettanr.Views.GroundPicture.Element extends Backbone.View
\r
3 className: 'pettanr-comic-ground-picture'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
9 @picture = @element.picture()
\r
10 @picture.fetch({cache: true}).done =>
\r
21 _.extend(s, @style_wh())
\r
23 style: Pettanr.to_style(s)
\r
27 add_element: (element) ->
\r
30 style: (spot = null, opacity = 20) ->
\r
32 position: 'absolute',
\r
35 'z-index': @element.get('z'),
\r
36 'background-image': 'url(' + @picture.r_url() + ')',
\r
37 'background-repeat': @element.repeat_text(),
\r
38 'background-position': Pettanr.to_s(@element.get('x')) + 'px ' + Pettanr.to_s(@element.get('y')) + 'px'
\r
44 width: Pettanr.to_s(@root.get('width')) + 'px',
\r
45 height: Pettanr.to_s(@root.get('height')) + 'px'
\r
48 class Pettanr.Views.GroundPicture.Element.Edit extends Pettanr.Views.GroundPicture.Element
\r
50 initialize: (options) ->
\r
52 @listenTo(@root, 'resize', @restyle)
\r
53 @listenTo(@root, 'input:width', @restyle)
\r
54 @listenTo(@root, 'input:height', @restyle)
\r
55 @listenTo(@element, 'input:repeat', @restyle)
\r
56 @listenTo(@element, 'input:x', @restyle)
\r
57 @listenTo(@element, 'input:y', @restyle)
\r
58 @listenTo(@element, 'active', @active)
\r
59 @listenTo(@element, 'inactive', @inactive)
\r
62 @root.trigger('active')
\r
65 @root.trigger('inactive')
\r