@element = options.element\r
@root = options.root\r
@spot = options.spot\r
- @add_element()\r
- retriever = @element.picture()\r
- @listenTo(retriever, 'retrieve', @retrieve_picture)\r
- retriever.retrieve()\r
\r
- retrieve_picture: (@picture) ->\r
- @restyle()\r
- \r
- clear: () ->\r
- this\r
+ init_picture: () ->\r
\r
render: () ->\r
+ @element.get_parent('picture', this, {\r
+ success: (@picture) =>\r
+ @init_picture()\r
+ @restyle()\r
+ })\r
this\r
\r
restyle: () ->\r
}\r
this.$el.attr(attr)\r
\r
- add_element: () ->\r
- null\r
- \r
style: (spot = null, opacity = 20) ->\r
r = {\r
position: 'absolute', \r
top: '0px', \r
left: '0px',\r
'z-index': @element.get('z'), \r
- 'background-image': 'url(' + @picture.r_url() + ')', \r
+ 'background-image': 'url(' + @picture.picture_file().src() + ')', \r
'background-repeat': @element.repeat_text(), \r
- 'background-position': Pettanr.to_s(@element.get('x')) + 'px ' + Pettanr.to_s(@element.get('y')) + 'px'\r
+ 'background-position': Pettanr.to_s(@element.get('x')) + '% ' + Pettanr.to_s(@element.get('y')) + '%'\r
}\r
r\r
\r
\r
initialize: (options) ->\r
super(options)\r
+ \r
+ init_picture: () ->\r
+ super()\r
@listenTo(@root, 'resize', @restyle)\r
@listenTo(@root, 'input:width', @restyle)\r
@listenTo(@root, 'input:height', @restyle)\r
@listenTo(@element, 'input:y', @restyle)\r
@listenTo(@element, 'active', @active)\r
@listenTo(@element, 'inactive', @inactive)\r
- \r
- retrieve_picture: (picture) ->\r
@listenTo(@element, 'sort', @restyle)\r
- super(picture)\r
\r
active: () ->\r
@root.trigger('active')\r