|
33 | 33 | * "bottom-resizer", "left-resizer" and "right-resizer" classes control the |
34 | 34 | * position of the resizer on the element. |
35 | 35 | * |
36 | | - * An element can be made resizable at any time using the `makeResizable` API |
| 36 | + * An element can be made resizable at any time using the `makeResizable()` API. |
| 37 | + * Panel sizes are saved via preferences and restored when the DOM node becomes resizable |
| 38 | + * again in a subsequent launch. |
37 | 39 | * |
38 | 40 | * The resizable elements trigger a panelResizeStart, panelResizeUpdate and panelResizeEnd |
39 | 41 | * event that can be used to create performance optimizations (such as hiding/showing elements |
40 | | - * while resizing), custom or internal resizes and save the final resized value into local |
41 | | - * storage for example. |
| 42 | + * while resizing), custom layout logic, etc. See makeResizable() for details on the events. |
42 | 43 | * |
43 | | - * A resizable element can be collapsed/expanded using the `show`, `hide` and `toggle` APIs |
44 | | - * |
45 | | - * The resizable elements trigger a panelCollapsed and panelExpanded event when the panel toggles |
46 | | - * between visible and invisible |
| 44 | + * A resizable element can be collapsed/expanded using the `show`, `hide` and `toggle` APIs or |
| 45 | + * via user action. This triggers panelCollapsed/panelExpanded events - see makeResizable(). |
47 | 46 | */ |
48 | 47 | define(function (require, exports, module) { |
49 | 48 | "use strict"; |
@@ -122,20 +121,25 @@ define(function (require, exports, module) { |
122 | 121 | * - Left ("left") or right ("right") for horizontal resizing |
123 | 122 | * |
124 | 123 | * A resizable element triggers the following events while resizing: |
125 | | - * - panelResizeStart: When the resize starts |
126 | | - * - panelResizeUpdate: When the resize gets updated |
127 | | - * - panelResizeEnds: When the resize ends |
128 | | - * - panelCollapsed: When the panel gets collapsed (or hidden) |
129 | | - * - panelExpanded: When the panel gets expanded (or shown) |
| 124 | + * - panelResizeStart: When the resize starts. Passed the new size. |
| 125 | + * - panelResizeUpdate: When the resize gets updated. Passed the new size. |
| 126 | + * - panelResizeEnd: When the resize ends. Passed the final size. |
| 127 | + * - panelCollapsed: When the panel gets collapsed (or hidden). Passed the last size |
| 128 | + * before collapse. May occur without any resize events. |
| 129 | + * - panelExpanded: When the panel gets expanded (or shown). Passed the initial size. |
| 130 | + * May occur without any resize events. |
| 131 | + * TODO (#2079): Spurious resize events may occur after collapse or before expand, reporting |
| 132 | + * the wrong size. If a panel is currently hidden (display:none), ignore these events. |
130 | 133 | * |
131 | | - * @param {DOMNode} element Html element which should be made resizable. |
132 | | - * @param {string} direction The direction of the resize action. Must be "horz" or "vert". |
133 | | - * @param {string} position The position of the resizer on the element. Can be "top" or "bottom" |
134 | | - * for vertical resizing and "left" or "right" for horizontal resizing. |
135 | | - * @param {int} minSize Minimum size (width or height) of the element. |
136 | | - * @param {boolean} collapsible True indicates the panel is collapsible on double click |
137 | | - * on the resizer. |
138 | | - * @param {string} forcemargin Classes which margins need to be pushed when the element resizes |
| 134 | + * @param {!DOMNode} element DOM element which should be made resizable. |
| 135 | + * @param {!string} direction Direction of the resize action: one of the DIRECTION_* constants. |
| 136 | + * @param {!string} position Which side of the element can be dragged: one of the POSITION_* constants |
| 137 | + * (TOP/BOTTOM for vertical resizing or LEFT/RIGHT for horizontal). |
| 138 | + * @param {?number} minSize Minimum size (width or height) of the element. Defaults to 0. |
| 139 | + * @param {?boolean} collapsible Indicates the panel is collapsible on double click on the |
| 140 | + * resizer. Defaults to false. |
| 141 | + * @param {?string} forcemargin CSS selector indicating element whose margin-left should be locked to |
| 142 | + * the resizable elemnt's size. |
139 | 143 | */ |
140 | 144 | function makeResizable(element, direction, position, minSize, collapsible, forcemargin) { |
141 | 145 |
|
|
0 commit comments