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 * table columns. | 7 * table columns. |
8 * | 8 * |
9 * Each splitter is associated with certain column and resizes it when dragged. | 9 * Each splitter is associated with certain column and resizes it when dragged. |
10 * It is column model responsibility to resize other columns accordingly. | 10 * It is column model responsibility to resize other columns accordingly. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 | 48 |
49 this.columnWidth_ = cm.getWidth(this.columnIndex); | 49 this.columnWidth_ = cm.getWidth(this.columnIndex); |
50 this.nextColumnWidth_ = cm.getWidth(this.columnIndex + 1); | 50 this.nextColumnWidth_ = cm.getWidth(this.columnIndex + 1); |
51 }, | 51 }, |
52 | 52 |
53 /** | 53 /** |
54 * Handles spliter moves. Sets new width of the column. | 54 * Handles spliter moves. Sets new width of the column. |
55 * @override | 55 * @override |
56 */ | 56 */ |
57 handleSplitterDragMove: function(deltaX) { | 57 handleSplitterDragMove: function(deltaX) { |
58 this.table_.columnModel.setWidth(this.columnIndex, | 58 this.table_.columnModel.setWidth( |
59 this.columnWidth_ + deltaX); | 59 this.columnIndex, this.columnWidth_ + deltaX); |
60 }, | 60 }, |
61 | 61 |
62 /** | 62 /** |
63 * Handles end of the splitter dragging. Restores cursor. | 63 * Handles end of the splitter dragging. Restores cursor. |
64 * @override | 64 * @override |
65 */ | 65 */ |
66 handleSplitterDragEnd: function() { | 66 handleSplitterDragEnd: function() { |
67 this.ownerDocument.documentElement.classList.remove('col-resize'); | 67 this.ownerDocument.documentElement.classList.remove('col-resize'); |
68 cr.dispatchSimpleEvent(this, 'column-resize-end', true); | 68 cr.dispatchSimpleEvent(this, 'column-resize-end', true); |
69 }, | 69 }, |
70 }; | 70 }; |
71 | 71 |
72 /** | 72 /** |
73 * The column index. | 73 * The column index. |
74 * @type {number} | 74 * @type {number} |
75 */ | 75 */ |
76 cr.defineProperty(TableSplitter, 'columnIndex'); | 76 cr.defineProperty(TableSplitter, 'columnIndex'); |
77 | 77 |
78 /** | 78 /** |
79 * The table associated with the splitter. | 79 * The table associated with the splitter. |
80 * @type {cr.ui.Table} | 80 * @type {cr.ui.Table} |
81 */ | 81 */ |
82 cr.defineProperty(TableSplitter, 'table'); | 82 cr.defineProperty(TableSplitter, 'table'); |
83 | 83 |
84 return { | 84 return {TableSplitter: TableSplitter}; |
85 TableSplitter: TableSplitter | |
86 }; | |
87 }); | 85 }); |
OLD | NEW |