@@ -21,23 +21,25 @@ export default class Shape {
2121 * @param {Number } [options.height] Shape height
2222 * @param {Number } [options.x] Absolute coordinate X
2323 * @param {Number } [options.y] Absolute coordinate Y
24- * @param {String } [options.align] Set if shape is need to be aligned
24+ * @param {String } [options.alignX] Set if shape is need to be aligned by X coordinates
25+ * @param {String } [options.alignY] Set if shape is need to be aligned by Y coordinates
2526 * @param {String } [options.background] Background color from {@link COLORS}
2627 * @param {String } [options.foreground] Foreground color from {@link COLORS}
2728 * @param {Object } [options.animation] Animation options for this shape
2829 */
2930 constructor ( options = { } ) {
3031 this . _options = options ;
3132
32- this . setText ( options . text ) ;
33- this . setWidth ( options . width ) ;
34- this . setHeight ( options . height ) ;
35- this . setPosition ( options . x , options . y ) ;
36- this . setAlignX ( options . alignX ) ;
37- this . setAlignY ( options . alignY ) ;
38- this . setBackground ( options . background ) ;
39- this . setForeground ( options . foreground ) ;
40- this . setAnimation ( options . animation ) ;
33+ this . setText ( this . _options . text ) ;
34+ this . setWidth ( this . _options . width ) ;
35+ this . setHeight ( this . _options . height ) ;
36+ this . setX ( this . _options . x ) ;
37+ this . setY ( this . _options . y ) ;
38+ this . setAlignX ( this . _options . alignX ) ;
39+ this . setAlignY ( this . _options . alignY ) ;
40+ this . setBackground ( this . _options . background ) ;
41+ this . setForeground ( this . _options . foreground ) ;
42+ this . setAnimation ( this . _options . animation ) ;
4143 }
4244
4345 /**
@@ -130,23 +132,41 @@ export default class Shape {
130132 }
131133
132134 /**
133- * Get current position of shape .
135+ * Get X coordinate .
134136 *
135- * @returns {{x: Number, y: Number} }
137+ * @returns {Number }
138+ */
139+ getX ( ) {
140+ return this . get ( 'x' ) ;
141+ }
142+
143+ /**
144+ * Set X coordinate.
145+ *
146+ * @param {Number } [x=10]
147+ * @returns {Shape }
148+ */
149+ setX ( x = 10 ) {
150+ return this . set ( 'x' , x ) ;
151+ }
152+
153+ /**
154+ * Get Y coordinate.
155+ *
156+ * @returns {Number }
136157 */
137- getPosition ( ) {
138- return { x : this . get ( 'x' ) , y : this . get ( 'y' ) } ;
158+ getY ( ) {
159+ return this . get ( 'y' ) ;
139160 }
140161
141162 /**
142- * Set new shape position .
163+ * Set Y coordinate .
143164 *
144- * @param {Number } [x=10] Absolute coordinate X
145- * @param {Number } [y=10] Absolute coordinate Y
165+ * @param {Number } [y=10]
146166 * @returns {Shape }
147167 */
148- setPosition ( x = 10 , y = 10 ) {
149- return this . set ( 'x' , x ) . set ( 'y' , y ) ;
168+ setY ( y = 10 ) {
169+ return this . set ( 'y' ) ;
150170 }
151171
152172 /**
0 commit comments