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
20 style: Pettanr.to_style(@style(@spot))
\r
28 if @element.get('xy')
\r
34 if @element.get('wh')
\r
40 if @element.get('orientation') == 0
\r
46 if @element.get('orientation') == 0
\r
52 if @element.get('orientation') == 0
\r
58 if @element.get('orientation') == 0
\r
63 style: (spot = null, opacity = 20) ->
\r
65 position: 'absolute',
\r
66 'z-index': @element.get('z'),
\r
67 top: Pettanr.to_s(@div_y()) + '%',
\r
68 left: Pettanr.to_s(@div_x()) + '%',
\r
69 width: Pettanr.to_s(@div_width()) + '%',
\r
70 height: Pettanr.to_s(@div_height()) + '%',
\r
71 'background-color': '#' + ('000000' + @element.get('code').toString(16)).slice(-6)
\r
75 class Pettanr.Views.GroundColor.Element.Edit extends Pettanr.Views.GroundColor.Element
\r
77 initialize: (options) ->
\r
79 @listenTo(@element, 'input:code', @restyle)
\r
80 @listenTo(@element, 'input:xy', @restyle)
\r
81 @listenTo(@element, 'input:wh', @restyle)
\r
82 @listenTo(@element, 'input:orientation', @restyle)
\r
83 @listenTo(@element, 'sort', @restyle)
\r
84 @listenTo(@element, 'active', @active)
\r
85 @listenTo(@element, 'inactive', @inactive)
\r
88 @root.trigger('active')
\r
91 @root.trigger('inactive')
\r