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}. |
11 * @param {!print_preview.AppState} appState App state used to persist custom | 11 * @param {!print_preview.AppState} appState App state used to persist custom |
12 * margins. | 12 * margins. |
13 * @param {!print_preview.DocumentInfo} documentInfo Information about the | 13 * @param {!print_preview.DocumentInfo} documentInfo Information about the |
14 * document to print. | 14 * document to print. |
15 * @constructor | 15 * @constructor |
16 * @extends {print_preview.ticket_items.TicketItem} | 16 * @extends {print_preview.ticket_items.TicketItem} |
17 */ | 17 */ |
18 function CustomMargins(appState, documentInfo) { | 18 function CustomMargins(appState, documentInfo) { |
19 print_preview.ticket_items.TicketItem.call( | 19 print_preview.ticket_items.TicketItem.call( |
20 this, | 20 this, |
21 appState, | 21 appState, |
22 print_preview.AppState.Field.CUSTOM_MARGINS, | 22 print_preview.AppState.Field.CUSTOM_MARGINS, |
23 null /*destinationStore*/, | 23 null /*destinationStore*/, |
24 documentInfo); | 24 documentInfo); |
25 }; | 25 }; |
26 | 26 |
27 /** | 27 /** |
28 * Enumeration of the orientations of margins. | |
29 * @enum {string} | |
30 */ | |
31 CustomMargins.Orientation = { | |
32 TOP: 'top', | |
33 RIGHT: 'right', | |
34 BOTTOM: 'bottom', | |
35 LEFT: 'left' | |
36 }; | |
37 | |
38 /** | |
39 * Mapping of a margin orientation to its opposite. | 28 * Mapping of a margin orientation to its opposite. |
40 * @type {!Object.<!CustomMargins.Orientation, !CustomMargins.Orientation>} | 29 * @type {!Object.<!print_preview.ticket_items.CustomMargins.Orientation, |
| 30 * !print_preview.ticket_items.CustomMargins.Orientation>} |
41 * @private | 31 * @private |
42 */ | 32 */ |
43 CustomMargins.OppositeOrientation_ = {}; | 33 CustomMargins.OppositeOrientation_ = {}; |
44 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.TOP] = | 34 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.TOP] = |
45 CustomMargins.Orientation.BOTTOM; | 35 CustomMargins.Orientation.BOTTOM; |
46 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.RIGHT] = | 36 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.RIGHT] = |
47 CustomMargins.Orientation.LEFT; | 37 CustomMargins.Orientation.LEFT; |
48 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.BOTTOM] = | 38 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.BOTTOM] = |
49 CustomMargins.Orientation.TOP; | 39 CustomMargins.Orientation.TOP; |
50 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.LEFT] = | 40 CustomMargins.OppositeOrientation_[CustomMargins.Orientation.LEFT] = |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 } | 148 } |
159 return Math.round(max); | 149 return Math.round(max); |
160 } | 150 } |
161 }; | 151 }; |
162 | 152 |
163 // Export | 153 // Export |
164 return { | 154 return { |
165 CustomMargins: CustomMargins | 155 CustomMargins: CustomMargins |
166 }; | 156 }; |
167 }); | 157 }); |
| 158 |
| 159 /** |
| 160 * Enumeration of the orientations of margins. |
| 161 * @enum {string} |
| 162 */ |
| 163 print_preview.ticket_items.CustomMargins.Orientation = { |
| 164 TOP: 'top', |
| 165 RIGHT: 'right', |
| 166 BOTTOM: 'bottom', |
| 167 LEFT: 'left' |
| 168 }; |
OLD | NEW |