Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / source / Slider.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5   <title>The source code</title>
6   <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
7   <script type="text/javascript" src="../prettify/prettify.js"></script>
8   <style type="text/css">
9     .highlight { display: block; background-color: #ddd; }
10   </style>
11   <script type="text/javascript">
12     function highlight() {
13       document.getElementById(location.hash.replace(/#/, "")).className = "highlight";
14     }
15   </script>
16 </head>
17 <body onload="prettyPrint(); highlight();">
18   <pre class="prettyprint lang-js"><span id='Ext-layout-component-field-Slider'>/**
19 </span> * @class Ext.layout.component.field.Slider
20  * @extends Ext.layout.component.field.Field
21  * @private
22  */
23
24 Ext.define('Ext.layout.component.field.Slider', {
25
26     /* Begin Definitions */
27
28     alias: ['layout.sliderfield'],
29
30     extend: 'Ext.layout.component.field.Field',
31
32     /* End Definitions */
33
34     type: 'sliderfield',
35
36     sizeBodyContents: function(width, height) {
37         var owner = this.owner,
38             thumbs = owner.thumbs,
39             length = thumbs.length,
40             inputEl = owner.inputEl,
41             innerEl = owner.innerEl,
42             endEl = owner.endEl,
43             i = 0;
44
45         /*
46          * If we happen to be animating during a resize, the position of the thumb will likely be off
47          * when the animation stops. As such, just stop any animations before syncing the thumbs.
48          */
49         for(; i &lt; length; ++i) {
50             thumbs[i].el.stopAnimation();
51         }
52         
53         if (owner.vertical) {
54             inputEl.setHeight(height);
55             innerEl.setHeight(Ext.isNumber(height) ? height - inputEl.getPadding('t') - endEl.getPadding('b') : height);
56         }
57         else {
58             inputEl.setWidth(width);
59             innerEl.setWidth(Ext.isNumber(width) ? width - inputEl.getPadding('l') - endEl.getPadding('r') : width);
60         }
61         owner.syncThumbs();
62     }
63 });
64 </pre>
65 </body>
66 </html>