1 class Pettanr.Views.GroundPicture.Element extends Pettanr.View
\r
3 className: 'pettanr-comic-ground-picture'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
13 @element.get_parent('picture', this, {
\r
14 success: (@picture) =>
\r
22 _.extend(s, @style_wh())
\r
24 style: Pettanr.to_style(s)
\r
28 style: (spot = null, opacity = 20) ->
\r
30 position: 'absolute',
\r
33 'z-index': @element.get('z'),
\r
34 'background-image': 'url(' + @picture.picture_file().src() + ')',
\r
35 'background-repeat': @element.repeat_text(),
\r
36 'background-position': Pettanr.to_s(@element.get('x')) + '% ' + Pettanr.to_s(@element.get('y')) + '%'
\r
42 width: Pettanr.to_s(@root.get('width')) + 'px',
\r
43 height: Pettanr.to_s(@root.get('height')) + 'px'
\r
46 class Pettanr.Views.GroundPicture.Element.Edit extends Pettanr.Views.GroundPicture.Element
\r
48 initialize: (options) ->
\r
53 @listenTo(@root, 'resize', @restyle)
\r
54 @listenTo(@root, 'input:width', @restyle)
\r
55 @listenTo(@root, 'input:height', @restyle)
\r
56 @listenTo(@element, 'input:repeat', @restyle)
\r
57 @listenTo(@element, 'input:x', @restyle)
\r
58 @listenTo(@element, 'input:y', @restyle)
\r
59 @listenTo(@element, 'active', @active)
\r
60 @listenTo(@element, 'inactive', @inactive)
\r
61 @listenTo(@element, 'sort', @restyle)
\r
64 @root.trigger('active')
\r
67 @root.trigger('inactive')
\r