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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 return; | 320 return; |
321 | 321 |
322 if (this.customMargins_.isEqual(this.previousCustomMargins_)) | 322 if (this.customMargins_.isEqual(this.previousCustomMargins_)) |
323 return; | 323 return; |
324 | 324 |
325 this.previousCustomMargins_ = this.customMargins_.clone(); | 325 this.previousCustomMargins_ = this.customMargins_.clone(); |
326 setDefaultValuesAndRegeneratePreview(false); | 326 setDefaultValuesAndRegeneratePreview(false); |
327 }, | 327 }, |
328 | 328 |
329 /** | 329 /** |
330 * Listener executed when the mouse is over the sidebar. If the custom | |
331 * margin lines are displayed, then, it fades them out. | |
332 * @private | |
333 */ | |
334 onSidebarMouseOver_: function(e) { | |
Aaron Boodman
2011/12/21 08:38:20
The occurrences of 'sidebar' in print_preview shou
| |
335 $('mainview').onmouseover = this.onMainviewMouseOver_.bind(this); | |
336 $('navbar-container').onmouseover = null; | |
337 if (!this.forceDisplayingMarginLines_) | |
338 this.marginsUI.hide(false); | |
339 }, | |
340 | |
341 /** | |
342 * Listener executed when the mouse is over the main view. If the custom | 330 * Listener executed when the mouse is over the main view. If the custom |
343 * margin lines are hidden, then, it fades them in. | 331 * margin lines are hidden, then, it fades them in. |
344 * @private | 332 * @private |
345 */ | 333 */ |
346 onMainviewMouseOver_: function() { | 334 onMainviewMouseOver_: function() { |
347 $('mainview').onmouseover = null; | 335 $('mainview').onmouseover = null; |
348 $('navbar-container').onmouseover = this.onSidebarMouseOver_.bind(this); | |
349 this.forceDisplayingMarginLines_ = false; | 336 this.forceDisplayingMarginLines_ = false; |
350 this.marginsUI.show(); | 337 this.marginsUI.show(); |
351 }, | 338 }, |
352 | 339 |
353 /** | 340 /** |
354 * Adds listeners to all margin related controls. | 341 * Adds listeners to all margin related controls. |
355 * @private | 342 * @private |
356 */ | 343 */ |
357 addEventListeners_: function() { | 344 addEventListeners_: function() { |
358 this.marginList_.onchange = this.onMarginsChanged_.bind(this); | 345 this.marginList_.onchange = this.onMarginsChanged_.bind(this); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 } | 474 } |
488 return this.marginsUI_; | 475 return this.marginsUI_; |
489 }, | 476 }, |
490 | 477 |
491 /** | 478 /** |
492 * Adds listeners when the custom margins option is selected. | 479 * Adds listeners when the custom margins option is selected. |
493 * @private | 480 * @private |
494 */ | 481 */ |
495 addCustomMarginEventListeners_: function() { | 482 addCustomMarginEventListeners_: function() { |
496 $('mainview').onmouseover = this.onMainviewMouseOver_.bind(this); | 483 $('mainview').onmouseover = this.onMainviewMouseOver_.bind(this); |
497 $('navbar-container').onmouseover = this.onSidebarMouseOver_.bind(this); | |
498 this.eventTracker_.add(this.marginsUI, | 484 this.eventTracker_.add(this.marginsUI, |
499 customEvents.MARGIN_LINE_DRAG, | 485 customEvents.MARGIN_LINE_DRAG, |
500 this.onMarginsLineDrag_.bind(this), | 486 this.onMarginsLineDrag_.bind(this), |
501 false); | 487 false); |
502 this.eventTracker_.add(document, customEvents.MARGIN_TEXTBOX_FOCUSED, | 488 this.eventTracker_.add(document, customEvents.MARGIN_TEXTBOX_FOCUSED, |
503 this.onMarginTextboxFocused_.bind(this), false); | 489 this.onMarginTextboxFocused_.bind(this), false); |
504 }, | 490 }, |
505 | 491 |
506 /** | 492 /** |
507 * Removes the event listeners associated with the custom margins option. | 493 * Removes the event listeners associated with the custom margins option. |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
704 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; | 690 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; |
705 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; | 691 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; |
706 } | 692 } |
707 }; | 693 }; |
708 | 694 |
709 return { | 695 return { |
710 MarginSettings: MarginSettings, | 696 MarginSettings: MarginSettings, |
711 PageLayout: PageLayout, | 697 PageLayout: PageLayout, |
712 }; | 698 }; |
713 }); | 699 }); |
OLD | NEW |