4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5 <title>The source code</title>
6 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
7 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
8 <style type="text/css">
9 .highlight { display: block; background-color: #ddd; }
11 <script type="text/javascript">
12 function highlight() {
13 document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
17 <body onload="prettyPrint(); highlight();">
18 <pre class="prettyprint lang-js"><span id='Ext-fx-target-Component'>/**
19 </span> * @class Ext.fx.target.Component
20 * @extends Ext.fx.target.Target
22 * This class represents a animation target for a {@link Ext.Component}. In general this class will not be
23 * created directly, the {@link Ext.Component} will be passed to the animation and
24 * and the appropriate target will be created.
26 Ext.define('Ext.fx.target.Component', {
28 /* Begin Definitions */
30 extend: 'Ext.fx.target.Target',
36 // Methods to call to retrieve unspecified "from" values from a target Component
39 return this.getPosition(true)[1];
42 return this.getPosition(true)[0];
45 return this.getPosition()[0];
48 return this.getPosition()[1];
51 return this.getHeight();
54 return this.getWidth();
57 return this.el.getStyle('opacity');
71 // Read the named attribute from the target Component. Use the defined getter for the attribute
72 getAttr: function(attr, val) {
73 return [[this.target, val !== undefined ? val : this.getPropMethod[attr].call(this.target)]];
76 setAttr: function(targetData, isFirstFrame, isLastFrame) {
79 ln = targetData.length,
80 attrs, attr, o, i, j, meth, targets, left, top, w, h;
81 for (i = 0; i < ln; i++) {
82 attrs = targetData[i].attrs;
84 targets = attrs[attr].length;
91 for (j = 0; j < targets; j++) {
93 // We REALLY want a single function call, so push these down to merge them: eg
94 // meth.setPagePosition.target = <targetComponent>
95 // meth.setPagePosition['x'] = 100
96 // meth.setPagePosition['y'] = 100
97 meth[me.compMethod[attr]].target = o[0];
98 meth[me.compMethod[attr]][attr] = o[1];
100 if (meth.setPosition.target) {
101 o = meth.setPosition;
102 left = (o.left === undefined) ? undefined : parseInt(o.left, 10);
103 top = (o.top === undefined) ? undefined : parseInt(o.top, 10);
104 o.target.setPosition(left, top);
106 if (meth.setPagePosition.target) {
107 o = meth.setPagePosition;
108 o.target.setPagePosition(o.x, o.y);
110 if (meth.setSize.target && meth.setSize.target.el) {
112 // Dimensions not being animated MUST NOT be autosized. They must remain at current value.
113 w = (o.width === undefined) ? o.target.getWidth() : parseInt(o.width, 10);
114 h = (o.height === undefined) ? o.target.getHeight() : parseInt(o.height, 10);
116 // Only set the size of the Component on the last frame, or if the animation was
117 // configured with dynamic: true.
118 // In other cases, we just set the target element size.
119 // This will result in either clipping if animating a reduction in size, or the revealing of
120 // the inner elements of the Component if animating an increase in size.
121 // Component's animate function initially resizes to the larger size before resizing the
122 // outer element to clip the contents.
123 if (isLastFrame || me.dynamic) {
124 o.target.componentLayout.childrenChanged = true;
126 // Flag if we are being called by an animating layout: use setCalculatedSize
127 if (me.layoutAnimation) {
128 o.target.setCalculatedSize(w, h);
130 o.target.setSize(w, h);
134 o.target.el.setSize(w, h);
137 if (meth.setOpacity.target) {
139 o.target.el.setStyle('opacity', o.opacity);