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 * Measurement system of the print preview. Used to parse and serialize point | 9 * Measurement system of the print preview. Used to parse and serialize point |
10 * measurements into the system's local units (e.g. millimeters, inches). | 10 * measurements into the system's local units (e.g. millimeters, inches). |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 */ | 133 */ |
134 convertFromPoints: function(pts) { | 134 convertFromPoints: function(pts) { |
135 if (this.unitType_ == MeasurementSystem.UnitType.METRIC) { | 135 if (this.unitType_ == MeasurementSystem.UnitType.METRIC) { |
136 return pts / MeasurementSystem.PTS_PER_MM_; | 136 return pts / MeasurementSystem.PTS_PER_MM_; |
137 } else { | 137 } else { |
138 return pts / MeasurementSystem.PTS_PER_INCH_; | 138 return pts / MeasurementSystem.PTS_PER_INCH_; |
139 } | 139 } |
140 }, | 140 }, |
141 | 141 |
142 /** | 142 /** |
143 * @param {number} Value in local units to convert to points. | 143 * @param {number} localUnits Value in local units to convert to points. |
144 * @return {number} Value in points. | 144 * @return {number} Value in points. |
145 */ | 145 */ |
146 convertToPoints: function(localUnits) { | 146 convertToPoints: function(localUnits) { |
147 if (this.unitType_ == MeasurementSystem.UnitType.METRIC) { | 147 if (this.unitType_ == MeasurementSystem.UnitType.METRIC) { |
148 return localUnits * MeasurementSystem.PTS_PER_MM_; | 148 return localUnits * MeasurementSystem.PTS_PER_MM_; |
149 } else { | 149 } else { |
150 return localUnits * MeasurementSystem.PTS_PER_INCH_; | 150 return localUnits * MeasurementSystem.PTS_PER_INCH_; |
151 } | 151 } |
152 } | 152 } |
153 }; | 153 }; |
154 | 154 |
155 // Export | 155 // Export |
156 return { | 156 return { |
157 MeasurementSystem: MeasurementSystem | 157 MeasurementSystem: MeasurementSystem |
158 }; | 158 }; |
159 }); | 159 }); |
OLD | NEW |