1 class Pettanr.Views.GroundColor.Element extends Pettanr.View
\r
3 className: 'pettanr-comic-ground-color'
\r
5 initialize: (options) ->
\r
6 @element = options.element
\r
16 style: Pettanr.to_style(@style(@spot))
\r
21 if @element.get('xy')
\r
27 if @element.get('wh')
\r
33 if @element.get('orientation') == 0
\r
39 if @element.get('orientation') == 0
\r
45 if @element.get('orientation') == 0
\r
51 if @element.get('orientation') == 0
\r
56 style: (spot = null, opacity = 20) ->
\r
58 position: 'absolute',
\r
59 'z-index': @element.get('z'),
\r
60 top: Pettanr.to_s(@div_y()) + '%',
\r
61 left: Pettanr.to_s(@div_x()) + '%',
\r
62 width: Pettanr.to_s(@div_width()) + '%',
\r
63 height: Pettanr.to_s(@div_height()) + '%',
\r
64 'background-color': '#' + ('000000' + @element.get('code').toString(16)).slice(-6)
\r
68 class Pettanr.Views.GroundColor.Element.Edit extends Pettanr.Views.GroundColor.Element
\r
70 initialize: (options) ->
\r
72 @listenTo(@element, 'input:code', @restyle)
\r
73 @listenTo(@element, 'input:xy', @restyle)
\r
74 @listenTo(@element, 'input:wh', @restyle)
\r
75 @listenTo(@element, 'input:orientation', @restyle)
\r
76 @listenTo(@element, 'sort', @restyle)
\r
77 @listenTo(@element, 'active', @active)
\r
78 @listenTo(@element, 'inactive', @inactive)
\r
81 @root.trigger('active')
\r
84 @root.trigger('inactive')
\r