neft
Version:
Universal Platform
75 lines (57 loc) • 2.19 kB
text/coffeescript
# Item.Alignment
'use strict'
assert = require 'src/assert'
utils = require 'src/utils'
# **Class** Alignment
module.exports = (Renderer, Impl, itemUtils) -> (ctor) -> class Alignment extends itemUtils.DeepObject
= 'Alignment'
itemUtils.defineProperty
constructor: ctor
name: 'alignment'
defaultValue: null
valueConstructor: Alignment
setter: (_super) -> (val) ->
{alignment} = @
if utils.isObject val
alignment.horizontal = val.horizontal if val.horizontal?
alignment.vertical = val.vertical if val.vertical?
else
alignment.horizontal = alignment.vertical = val
_super.call @, val
return
constructor: (ref) ->
super ref
= 'left'
= 'top'
Object.preventExtensions @
## *String* Alignment::horizontal = 'left'
## *Signal* Alignment::onHorizontalChange(*String* oldValue)
itemUtils.defineProperty
constructor: @
name: 'horizontal'
defaultValue: 'left'
namespace: 'alignment'
parentConstructor: ctor
implementation: Impl["set#{ctor.__name__}AlignmentHorizontal"]
developmentSetter: (val) ->
assert.isString val
setter: (_super) -> (val='left') ->
_super.call @, val
## *String* Alignment::vertical = 'top'
## *Signal* Alignment::onVerticalChange(*String* oldValue)
itemUtils.defineProperty
constructor: @
name: 'vertical'
defaultValue: 'top'
namespace: 'alignment'
parentConstructor: ctor
implementation: Impl["set#{ctor.__name__}AlignmentVertical"]
developmentSetter: (val) ->
assert.isString val
setter: (_super) -> (val='top') ->
_super.call @, val
toJSON: ->
horizontal:
vertical:
# Glossary
- [Item.Alignment](#class-alignment)