@ -4,17 +4,25 @@ const SizeUnits = Object.freeze({
} )
class Side UnitDependentAttribute {
class Direction UnitDependentAttribute {
_ unit ;
_ fFirst ;
_ fSecond ;
_ fThird ;
_ fForth ;
constructor ( defaultValue = 0 , defaultUnit = SizeUnits . PIXEL ) {
this . _ unit = defaultUnit ;
this . _ fFirst = defaultValue ;
this . _ fSecond = defaultValue ;
this . _ fThird = defaultValue ;
this . _ fForth = defaultValue ;
}
/ * *
*
* @ param { Units } unit The unit of the amount or style
* @ returns { SideUnitDependentAttribute } this - Object
* @ returns { Direction UnitDependentAttribute} this - Object
* /
setUnit ( unit ) {
this . _ unit = unit ;
@ -32,7 +40,7 @@ class SideUnitDependentAttribute {
*
* @ param { SidingRef } sidingRef
* @ param { * } value
* @ returns { Side UnitDependentAttribute} this
* @ returns { Direction UnitDependentAttribute} this
* /
setBySidingRef ( sidingRef , value ) {
sidingRef ( this ) = value ;
@ -58,25 +66,19 @@ const SidingRefSides = Object.freeze({
} )
/ * *
* The Class holds values from each side / direction of an element .
* Used for margin / padding .
* Extended Logic is used for Dimensions , Shape , Border as well .
* /
class Siding extends SideUnitDependentAttribute {
constructor ( defaultValue = 0 , defaultUnit = SizeUnits . PIXEL ) {
super ( ) ;
this . _ unit = defaultUnit ;
this . _ fFirst = defaultValue ;
this . _ fSecond = defaultValue ;
this . _ fThird = defaultValue ;
this . _ fForth = defaultValue ;
/ * *
* Placeholder for overrides
* @ returns { Object }
* /
toModifications ( ) {
return this . getOrderedValues ( )
}
/ * *
* sets the amount - value for all side s.
* @ param { number } amount siding from all side s
* @ returns { Siding } this Siding Object
* sets the amount - value for all directions .
* @ param { number } amount value to set for all directions
* @ returns { DirectionUnitDependentAttribute } this
* /
all ( amount ) {
this . _ fFirst = amount ;
@ -86,6 +88,20 @@ class Siding extends SideUnitDependentAttribute {
return this ;
}
}
class Sides extends DirectionUnitDependentAttribute {
/ * *
*
* @ param { number | string } defaultValue
* @ param { SizeUnits } defaultUnit
* /
constructor ( defaultValue = 0 , defaultUnit = SizeUnits . PIXEL ) {
super ( defaultValue , defaultUnit ) ;
}
/ * *
* sets the amount - value for the left side .
* @ param { number } amount siding for left
@ -137,15 +153,6 @@ class Siding extends SideUnitDependentAttribute {
}
class Sides extends Siding {
/ * *
*
* @ param { number | string } defaultValue
* @ param { * } defaultUnit
* /
constructor ( defaultValue = 0 , defaultUnit = SizeUnits . PIXEL ) {
super ( defaultValue , defaultUnit ) ;
}
/ * *
* sets the amount - value for the horizontal sides ( left and right ) .
* @ param { number } amount siding for left and right .
@ -169,7 +176,8 @@ class Sides extends Siding {
}
}
class PaddingChain extends Sides {
class PaddingChain extends Sides {
_ modifier ;
constructor ( modifier ) {
super ( ) ;