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
10 retriever = @element.picture()
\r
11 @listenTo(retriever, 'retrieve', @retrieve_picture)
\r
12 retriever.retrieve()
\r
14 retrieve_picture: (@picture) ->
\r
25 _.extend(s, @style_wh())
\r
27 style: Pettanr.to_style(s)
\r
34 style: (spot = null, opacity = 20) ->
\r
36 position: 'absolute',
\r
39 'z-index': @element.get('z'),
\r
40 'background-image': 'url(' + @picture.r_url() + ')',
\r
41 'background-repeat': @element.repeat_text(),
\r
42 'background-position': Pettanr.to_s(@element.get('x')) + 'px ' + Pettanr.to_s(@element.get('y')) + 'px'
\r
48 width: Pettanr.to_s(@root.get('width')) + 'px',
\r
49 height: Pettanr.to_s(@root.get('height')) + 'px'
\r
52 class Pettanr.Views.GroundPicture.Element.Edit extends Pettanr.Views.GroundPicture.Element
\r
54 initialize: (options) ->
\r
56 @listenTo(@root, 'resize', @restyle)
\r
57 @listenTo(@root, 'input:width', @restyle)
\r
58 @listenTo(@root, 'input:height', @restyle)
\r
59 @listenTo(@element, 'input:repeat', @restyle)
\r
60 @listenTo(@element, 'input:x', @restyle)
\r
61 @listenTo(@element, 'input:y', @restyle)
\r
62 @listenTo(@element, 'active', @active)
\r
63 @listenTo(@element, 'inactive', @inactive)
\r
65 retrieve_picture: (picture) ->
\r
66 @listenTo(@element, 'sort', @restyle)
\r
70 @root.trigger('active')
\r
73 @root.trigger('inactive')
\r