1 class Pettanr.Views.GroundColor.Element extends Backbone.View
\r
3 className: 'pettanr-comic-ground-color'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
19 style: Pettanr.to_style(@style(@spot))
\r
23 add_element: (element) ->
\r
27 if @element.get('xy')
\r
33 if @element.get('wh')
\r
39 if @element.get('orientation') == 0
\r
45 if @element.get('orientation') == 0
\r
51 if @element.get('orientation') == 0
\r
57 if @element.get('orientation') == 0
\r
62 style: (spot = null, opacity = 20) ->
\r
64 position: 'absolute',
\r
65 'z-index': @element.get('z'),
\r
66 top: Pettanr.to_s(@div_y()) + '%',
\r
67 left: Pettanr.to_s(@div_x()) + '%',
\r
68 width: Pettanr.to_s(@div_width()) + '%',
\r
69 height: Pettanr.to_s(@div_height()) + '%',
\r
70 'background-color': '#' + ('000000' + @element.get('code').toString(16)).slice(-6)
\r
74 class Pettanr.Views.GroundColor.Element.Edit extends Pettanr.Views.GroundColor.Element
\r
76 initialize: (options) ->
\r
78 @listenTo(@element, 'input:code', @restyle)
\r
79 @listenTo(@element, 'input:xy', @restyle)
\r
80 @listenTo(@element, 'input:wh', @restyle)
\r
81 @listenTo(@element, 'input:orientation', @restyle)
\r
82 @listenTo(@element, 'active', @active)
\r
83 @listenTo(@element, 'inactive', @inactive)
\r
86 @root.trigger('active')
\r
89 @root.trigger('inactive')
\r