OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 * Creates a Margins object that holds four margin values. The units in which | 9 * Creates a Margins object that holds four margin values. The units in which |
10 * the values are expressed can be any numeric value. | 10 * the values are expressed can be any numeric value. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 this.marginsUI.show(); | 284 this.marginsUI.show(); |
285 }, | 285 }, |
286 | 286 |
287 /** | 287 /** |
288 * Adds listeners to all margin related controls. | 288 * Adds listeners to all margin related controls. |
289 * @private | 289 * @private |
290 */ | 290 */ |
291 addEventListeners_: function() { | 291 addEventListeners_: function() { |
292 this.marginList_.onchange = this.onMarginsChanged_.bind(this); | 292 this.marginList_.onchange = this.onMarginsChanged_.bind(this); |
293 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); | 293 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); |
294 document.addEventListener('errorOccurred', | |
295 this.onErrorOccurred.bind(this)); | |
294 }, | 296 }, |
295 | 297 |
296 /** | 298 /** |
299 * Executes when an 'errorOccurred' event occurs. | |
300 */ | |
301 onErrorOccurred: function() { | |
Evan Stade
2011/10/19 22:34:11
private
dpapad
2011/10/19 22:56:21
Done.
| |
302 if (this.isCustomMarginsSelected()) { | |
303 this.removeCustomMarginEventListeners_(); | |
304 this.marginsUI.hide(); | |
305 } | |
306 }, | |
307 | |
308 /** | |
297 * Executes whenever a "DragEvent" occurs. | 309 * Executes whenever a "DragEvent" occurs. |
298 * @param {cr.Event} e The event that triggered this listener. | 310 * @param {cr.Event} e The event that triggered this listener. |
299 */ | 311 */ |
300 onDragEvent_: function(e) { | 312 onDragEvent_: function(e) { |
301 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta); | 313 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta); |
302 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging( | 314 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging( |
303 dragDeltaInPoints, e.destinationPoint); | 315 dragDeltaInPoints, e.destinationPoint); |
304 }, | 316 }, |
305 | 317 |
306 /** | 318 /** |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
591 if (!previewModifiable) | 603 if (!previewModifiable) |
592 fadeOutElement(this.marginsOption_); | 604 fadeOutElement(this.marginsOption_); |
593 } | 605 } |
594 }; | 606 }; |
595 | 607 |
596 return { | 608 return { |
597 MarginSettings: MarginSettings, | 609 MarginSettings: MarginSettings, |
598 PageLayout: PageLayout, | 610 PageLayout: PageLayout, |
599 }; | 611 }; |
600 }); | 612 }); |
OLD | NEW |