OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview This implements a splitter element which can be used to resize | 6 * @fileoverview This implements a splitter element which can be used to resize |
7 * elements in split panes. | 7 * elements in split panes. |
8 * | 8 * |
9 * The parent of the splitter should be an hbox (display: -webkit-box) with at | 9 * The parent of the splitter should be an hbox (display: -webkit-box) with at |
10 * least one previous element sibling. The splitter controls the width of the | 10 * least one previous element sibling. The splitter controls the width of the |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 242 |
243 /** | 243 /** |
244 * Handles splitter moves. Updates width of the element being resized. | 244 * Handles splitter moves. Updates width of the element being resized. |
245 * @param {number} deltaX The change of splitter horizontal position. | 245 * @param {number} deltaX The change of splitter horizontal position. |
246 * @protected | 246 * @protected |
247 */ | 247 */ |
248 handleSplitterDragMove: function(deltaX) { | 248 handleSplitterDragMove: function(deltaX) { |
249 var targetElement = this.getResizeTarget_(); | 249 var targetElement = this.getResizeTarget_(); |
250 var newWidth = this.startWidth_ + this.calcDeltaX_(deltaX); | 250 var newWidth = this.startWidth_ + this.calcDeltaX_(deltaX); |
251 targetElement.style.width = newWidth + 'px'; | 251 targetElement.style.width = newWidth + 'px'; |
| 252 cr.dispatchSimpleEvent(this, 'dragmove'); |
252 }, | 253 }, |
253 | 254 |
254 /** | 255 /** |
255 * Handles end of the splitter dragging. This fires a 'resize' event if the | 256 * Handles end of the splitter dragging. This fires a 'resize' event if the |
256 * size changed. | 257 * size changed. |
257 * @protected | 258 * @protected |
258 */ | 259 */ |
259 handleSplitterDragEnd: function() { | 260 handleSplitterDragEnd: function() { |
260 // Check if the size changed. | 261 // Check if the size changed. |
261 var targetElement = this.getResizeTarget_(); | 262 var targetElement = this.getResizeTarget_(); |
262 var doc = targetElement.ownerDocument; | 263 var doc = targetElement.ownerDocument; |
263 var computedWidth = | 264 var computedWidth = |
264 parseFloat(doc.defaultView.getComputedStyle(targetElement).width); | 265 parseFloat(doc.defaultView.getComputedStyle(targetElement).width); |
265 if (this.startWidth_ != computedWidth) | 266 if (this.startWidth_ != computedWidth) |
266 cr.dispatchSimpleEvent(this, 'resize'); | 267 cr.dispatchSimpleEvent(this, 'resize'); |
267 }, | 268 }, |
268 }; | 269 }; |
269 | 270 |
270 return {Splitter: Splitter}; | 271 return {Splitter: Splitter}; |
271 }); | 272 }); |
OLD | NEW |