| 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.ticket_items', function() { | 5 cr.define('print_preview.ticket_items', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Custom page margins ticket item whose value is a | 9 * Custom page margins ticket item whose value is a |
| 10 * {@code print_preview.Margins}. | 10 * {@code print_preview.Margins}. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 * @return {number} Maximum value in points of the specified margin. | 95 * @return {number} Maximum value in points of the specified margin. |
| 96 */ | 96 */ |
| 97 getMarginMax: function(orientation) { | 97 getMarginMax: function(orientation) { |
| 98 var oppositeOrient = CustomMargins.OppositeOrientation_[orientation]; | 98 var oppositeOrient = CustomMargins.OppositeOrientation_[orientation]; |
| 99 var margins = /** @type {!print_preview.Margins} */ (this.getValue()); | 99 var margins = /** @type {!print_preview.Margins} */ (this.getValue()); |
| 100 return this.getMarginMax_(orientation, margins.get(oppositeOrient)); | 100 return this.getMarginMax_(orientation, margins.get(oppositeOrient)); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** @override */ | 103 /** @override */ |
| 104 updateValue: function(value) { | 104 updateValue: function(value) { |
| 105 var margins = /** @type {!InputMargins} */ (value); | 105 var margins = /** @type {!print_preview.Margins} */ (value); |
| 106 if (margins != null) { | 106 if (margins != null) { |
| 107 margins = new print_preview.Margins( | 107 margins = new print_preview.Margins( |
| 108 Math.round(margins.get(CustomMargins.Orientation.TOP)), | 108 Math.round(margins.get(CustomMargins.Orientation.TOP)), |
| 109 Math.round(margins.get(CustomMargins.Orientation.RIGHT)), | 109 Math.round(margins.get(CustomMargins.Orientation.RIGHT)), |
| 110 Math.round(margins.get(CustomMargins.Orientation.BOTTOM)), | 110 Math.round(margins.get(CustomMargins.Orientation.BOTTOM)), |
| 111 Math.round(margins.get(CustomMargins.Orientation.LEFT))); | 111 Math.round(margins.get(CustomMargins.Orientation.LEFT))); |
| 112 } | 112 } |
| 113 print_preview.ticket_items.TicketItem.prototype.updateValue.call( | 113 print_preview.ticket_items.TicketItem.prototype.updateValue.call( |
| 114 this, margins); | 114 this, margins); |
| 115 }, | 115 }, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 162 } |
| 163 return Math.round(max); | 163 return Math.round(max); |
| 164 } | 164 } |
| 165 }; | 165 }; |
| 166 | 166 |
| 167 // Export | 167 // Export |
| 168 return { | 168 return { |
| 169 CustomMargins: CustomMargins | 169 CustomMargins: CustomMargins |
| 170 }; | 170 }; |
| 171 }); | 171 }); |
| OLD | NEW |