| 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 cr.define('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * UI component used for setting custom print margins. | 9 * UI component used for setting custom print margins. |
| 10 * @param {!print_preview.DocumentInfo} documentInfo Document data model. | 10 * @param {!print_preview.DocumentInfo} documentInfo Document data model. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * passed to the function if the margin is currently being dragged and false | 56 * passed to the function if the margin is currently being dragged and false |
| 57 * otherwise. | 57 * otherwise. |
| 58 * @type {function(boolean)} | 58 * @type {function(boolean)} |
| 59 * @private | 59 * @private |
| 60 */ | 60 */ |
| 61 this.dragChangedCallback_ = dragChangedCallback; | 61 this.dragChangedCallback_ = dragChangedCallback; |
| 62 | 62 |
| 63 /** | 63 /** |
| 64 * Convenience array that contains all of the margin controls. | 64 * Convenience array that contains all of the margin controls. |
| 65 * @type {!Object< | 65 * @type {!Object< |
| 66 * !print_preview.ticket_items.CustomMargins.Orientation, | 66 * !print_preview.ticket_items.CustomMarginsOrientation, |
| 67 * !print_preview.MarginControl>} | 67 * !print_preview.MarginControl>} |
| 68 * @private | 68 * @private |
| 69 */ | 69 */ |
| 70 this.controls_ = {}; | 70 this.controls_ = {}; |
| 71 for (var key in print_preview.ticket_items.CustomMargins.Orientation) { | 71 for (var key in print_preview.ticket_items.CustomMarginsOrientation) { |
| 72 var orientation = print_preview.ticket_items.CustomMargins.Orientation[ | 72 var orientation = print_preview.ticket_items.CustomMarginsOrientation[ |
| 73 key]; | 73 key]; |
| 74 var control = new print_preview.MarginControl(orientation); | 74 var control = new print_preview.MarginControl(orientation); |
| 75 this.controls_[orientation] = control; | 75 this.controls_[orientation] = control; |
| 76 this.addChild(control); | 76 this.addChild(control); |
| 77 } | 77 } |
| 78 | 78 |
| 79 /** | 79 /** |
| 80 * Margin control currently being dragged. Null if no control is being | 80 * Margin control currently being dragged. Null if no control is being |
| 81 * dragged. | 81 * dragged. |
| 82 * @type {print_preview.MarginControl} | 82 * @type {print_preview.MarginControl} |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 * CSS classes used by the custom margins component. | 114 * CSS classes used by the custom margins component. |
| 115 * @enum {string} | 115 * @enum {string} |
| 116 * @private | 116 * @private |
| 117 */ | 117 */ |
| 118 MarginControlContainer.Classes_ = { | 118 MarginControlContainer.Classes_ = { |
| 119 DRAGGING_HORIZONTAL: 'margin-control-container-dragging-horizontal', | 119 DRAGGING_HORIZONTAL: 'margin-control-container-dragging-horizontal', |
| 120 DRAGGING_VERTICAL: 'margin-control-container-dragging-vertical' | 120 DRAGGING_VERTICAL: 'margin-control-container-dragging-vertical' |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 /** | 123 /** |
| 124 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation | 124 * @param {!print_preview.ticket_items.CustomMarginsOrientation} orientation |
| 125 * Orientation value to test. | 125 * Orientation value to test. |
| 126 * @return {boolean} Whether the given orientation is TOP or BOTTOM. | 126 * @return {boolean} Whether the given orientation is TOP or BOTTOM. |
| 127 * @private | 127 * @private |
| 128 */ | 128 */ |
| 129 MarginControlContainer.isTopOrBottom_ = function(orientation) { | 129 MarginControlContainer.isTopOrBottom_ = function(orientation) { |
| 130 return orientation == | 130 return orientation == |
| 131 print_preview.ticket_items.CustomMargins.Orientation.TOP || | 131 print_preview.ticket_items.CustomMarginsOrientation.TOP || |
| 132 orientation == | 132 orientation == |
| 133 print_preview.ticket_items.CustomMargins.Orientation.BOTTOM; | 133 print_preview.ticket_items.CustomMarginsOrientation.BOTTOM; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 MarginControlContainer.prototype = { | 136 MarginControlContainer.prototype = { |
| 137 __proto__: print_preview.Component.prototype, | 137 __proto__: print_preview.Component.prototype, |
| 138 | 138 |
| 139 /** | 139 /** |
| 140 * Updates the translation transformation that translates pixel values in | 140 * Updates the translation transformation that translates pixel values in |
| 141 * the space of the HTML DOM. | 141 * the space of the HTML DOM. |
| 142 * @param {print_preview.Coordinate2d} translateTransform Updated value of | 142 * @param {print_preview.Coordinate2d} translateTransform Updated value of |
| 143 * the translation transformation. | 143 * the translation transformation. |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 } | 473 } |
| 474 }; | 474 }; |
| 475 | 475 |
| 476 // Export | 476 // Export |
| 477 return { | 477 return { |
| 478 MarginControlContainer: MarginControlContainer | 478 MarginControlContainer: MarginControlContainer |
| 479 }; | 479 }; |
| 480 }); | 480 }); |
| OLD | NEW |