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 * Draggable control for setting a page margin. | 9 * Draggable control for setting a page margin. |
10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation | 10 * @param {!print_preview.ticket_items.CustomMargins.Orientation} orientation |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 /** @param {string} value New value of the margin control's textbox. */ | 259 /** @param {string} value New value of the margin control's textbox. */ |
260 setTextboxValue: function(value) { | 260 setTextboxValue: function(value) { |
261 if (this.textbox_.value != value) { | 261 if (this.textbox_.value != value) { |
262 this.textbox_.value = value; | 262 this.textbox_.value = value; |
263 } | 263 } |
264 }, | 264 }, |
265 | 265 |
266 /** | 266 /** |
267 * Converts a value in pixels to points. | 267 * Converts a value in pixels to points. |
268 * @param {number} Pixel value to convert. | 268 * @param {number} pixels Pixel value to convert. |
269 * @return {number} Given value expressed in points. | 269 * @return {number} Given value expressed in points. |
270 */ | 270 */ |
271 convertPixelsToPts: function(pixels) { | 271 convertPixelsToPts: function(pixels) { |
272 var pts; | 272 var pts; |
273 var orientationEnum = | 273 var orientationEnum = |
274 print_preview.ticket_items.CustomMargins.Orientation; | 274 print_preview.ticket_items.CustomMargins.Orientation; |
275 if (this.orientation_ == orientationEnum.TOP) { | 275 if (this.orientation_ == orientationEnum.TOP) { |
276 pts = pixels - this.translateTransform_.y + MarginControl.RADIUS_; | 276 pts = pixels - this.translateTransform_.y + MarginControl.RADIUS_; |
277 pts /= this.scaleTransform_; | 277 pts /= this.scaleTransform_; |
278 } else if (this.orientation_ == orientationEnum.RIGHT) { | 278 } else if (this.orientation_ == orientationEnum.RIGHT) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 this.setIsFocused_(false); | 432 this.setIsFocused_(false); |
433 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); | 433 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); |
434 } | 434 } |
435 }; | 435 }; |
436 | 436 |
437 // Export | 437 // Export |
438 return { | 438 return { |
439 MarginControl: MarginControl | 439 MarginControl: MarginControl |
440 }; | 440 }; |
441 }); | 441 }); |
OLD | NEW |