| 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.CustomMarginsOrientation} orientation | 10 * @param {!print_preview.ticket_items.CustomMarginsOrientation} orientation |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 * @private | 92 * @private |
| 93 */ | 93 */ |
| 94 this.isFocused_ = false; | 94 this.isFocused_ = false; |
| 95 | 95 |
| 96 /** | 96 /** |
| 97 * Whether the margin control is in an error state. | 97 * Whether the margin control is in an error state. |
| 98 * @type {boolean} | 98 * @type {boolean} |
| 99 * @private | 99 * @private |
| 100 */ | 100 */ |
| 101 this.isInError_ = false; | 101 this.isInError_ = false; |
| 102 }; | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * Event types dispatched by the margin control. | 105 * Event types dispatched by the margin control. |
| 106 * @enum {string} | 106 * @enum {string} |
| 107 */ | 107 */ |
| 108 MarginControl.EventType = { | 108 MarginControl.EventType = { |
| 109 // Dispatched when the margin control starts dragging. | 109 // Dispatched when the margin control starts dragging. |
| 110 DRAG_START: 'print_preview.MarginControl.DRAG_START', | 110 DRAG_START: 'print_preview.MarginControl.DRAG_START', |
| 111 | 111 |
| 112 // Dispatched when the text in the margin control's textbox changes. | 112 // Dispatched when the text in the margin control's textbox changes. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 320 |
| 321 /** @override */ | 321 /** @override */ |
| 322 enterDocument: function() { | 322 enterDocument: function() { |
| 323 print_preview.Component.prototype.enterDocument.call(this); | 323 print_preview.Component.prototype.enterDocument.call(this); |
| 324 this.tracker.add( | 324 this.tracker.add( |
| 325 this.getElement(), 'mousedown', this.onMouseDown_.bind(this)); | 325 this.getElement(), 'mousedown', this.onMouseDown_.bind(this)); |
| 326 this.tracker.add( | 326 this.tracker.add( |
| 327 this.getElement(), | 327 this.getElement(), |
| 328 'transitionend', | 328 'transitionend', |
| 329 this.onTransitionEnd_.bind(this)); | 329 this.onTransitionEnd_.bind(this)); |
| 330 assert(this.textbox_); |
| 330 this.tracker.add( | 331 this.tracker.add( |
| 331 this.textbox_, 'input', this.onTextboxInput_.bind(this)); | 332 this.textbox_, 'input', this.onTextboxInput_.bind(this)); |
| 332 this.tracker.add( | 333 this.tracker.add( |
| 333 this.textbox_, 'keydown', this.onTextboxKeyDown_.bind(this)); | 334 this.textbox_, 'keydown', this.onTextboxKeyDown_.bind(this)); |
| 334 this.tracker.add( | 335 this.tracker.add( |
| 335 this.textbox_, 'focus', this.setIsFocused_.bind(this, true)); | 336 this.textbox_, 'focus', this.setIsFocused_.bind(this, true)); |
| 336 this.tracker.add(this.textbox_, 'blur', this.onTexboxBlur_.bind(this)); | 337 this.tracker.add(this.textbox_, 'blur', this.onTexboxBlur_.bind(this)); |
| 337 }, | 338 }, |
| 338 | 339 |
| 339 /** @override */ | 340 /** @override */ |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 this.setIsFocused_(false); | 446 this.setIsFocused_(false); |
| 446 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); | 447 cr.dispatchSimpleEvent(this, MarginControl.EventType.TEXT_CHANGE); |
| 447 } | 448 } |
| 448 }; | 449 }; |
| 449 | 450 |
| 450 // Export | 451 // Export |
| 451 return { | 452 return { |
| 452 MarginControl: MarginControl | 453 MarginControl: MarginControl |
| 453 }; | 454 }; |
| 454 }); | 455 }); |
| OLD | NEW |