|
3 | 3 | */
|
4 | 4 | import Ember from 'ember';
|
5 | 5 | import SvgMixin from 'ember-svg-shapes/mixins/svg';
|
| 6 | +import RectMixin from 'ember-svg-shapes/mixins/rect'; |
6 | 7 | import layout from '../templates/components/svg-rectangle';
|
7 | 8 |
|
8 | 9 | /**
|
9 | 10 | @class SvgRectangleComponent
|
10 |
| - @namespace SvgShapes |
11 |
| - @uses SvgShapes.SvgMixin |
| 11 | + @namespace SvgShapes.Components |
| 12 | + @uses SvgShapes.Mixins.SvgMixin |
| 13 | + @uses SvgShapes.Mixins.RectMixin |
12 | 14 | */
|
13 |
| -export default Ember.Component.extend( SvgMixin, { |
| 15 | +export default Ember.Component.extend( SvgMixin, RectMixin, { |
14 | 16 |
|
15 | 17 | layout: layout,
|
16 | 18 |
|
17 | 19 | /**
|
| 20 | + This is an array of class names to be added to the svg element. |
| 21 | +
|
18 | 22 | @property className
|
19 | 23 | @type {Array}
|
20 |
| - @default ['svg-rectangle'] |
21 |
| - @private |
22 |
| - */ |
23 |
| - classNames: ['svg-rectangle'], |
24 |
| - |
25 |
| - /** |
26 |
| - @property radiusX |
27 |
| - @type {Number} |
28 |
| - @default 0 |
29 |
| - */ |
30 |
| - radiusX: 0, |
31 |
| - |
32 |
| - /** |
33 |
| - @property radiusX |
34 |
| - @type {Number} |
35 |
| - @default 0 |
36 |
| - */ |
37 |
| - radiusY: 0, |
38 |
| - |
39 |
| - /** |
40 |
| - @property height |
41 |
| - @type {Number} |
42 |
| - @default 10 |
43 |
| - */ |
44 |
| - height: 10, |
45 |
| - |
46 |
| - /** |
47 |
| - @property width |
48 |
| - @type {Number} |
49 |
| - @default 10 |
50 |
| - */ |
51 |
| - width: 10, |
52 |
| - |
53 |
| - /** |
54 |
| - @property _height |
55 |
| - @type {Number} |
56 |
| - @readonly |
57 |
| - @private |
58 |
| - */ |
59 |
| - _height: Ember.computed('height', 'strokeWidth', function() { |
60 |
| - var height = this.get('height'), |
61 |
| - strokeWidth = this.get('strokeWidth'); |
62 |
| - return height - strokeWidth; |
63 |
| - }), |
64 |
| - |
65 |
| - /** |
66 |
| - @property _width |
67 |
| - @type {Number} |
68 |
| - @readonly |
69 |
| - @private |
70 |
| - */ |
71 |
| - _width: Ember.computed('width', 'strokeWidth', function() { |
72 |
| - var width = this.get('width'), |
73 |
| - strokeWidth = this.get('strokeWidth'); |
74 |
| - return width - strokeWidth; |
75 |
| - }), |
76 |
| - |
77 |
| - /** |
78 |
| - @property left |
79 |
| - @type {Number} |
80 |
| - @readonly |
81 |
| - @private |
82 |
| - */ |
83 |
| - left: Ember.computed('strokeWidth', function() { |
84 |
| - var strokeWidth = this.get('strokeWidth'); |
85 |
| - return strokeWidth / 2; |
86 |
| - }), |
87 |
| - |
88 |
| - /** |
89 |
| - @property top |
90 |
| - @type {Number} |
91 |
| - @readonly |
92 |
| - @private |
93 |
| - */ |
94 |
| - top: Ember.computed.alias('left'), |
95 |
| - |
96 |
| - /** |
97 |
| - This is a computed property. It sets the height and width of the svg element. |
98 |
| - @property style |
99 |
| - @type {String} |
| 24 | + @default ['ember-svg-shapes', 'svg-rectangle'] |
100 | 25 | @private
|
101 | 26 | */
|
102 |
| - style: Ember.computed('height', 'width', function() { |
103 |
| - var height = this.get('height'), |
104 |
| - width = this.get('width'); |
105 |
| - return Ember.String.htmlSafe('height:' + height + 'px; width:' + width + 'px;'); |
106 |
| - }) |
| 27 | + classNames: ['ember-svg-shapes', 'svg-rectangle'] |
107 | 28 | });
|
0 commit comments