| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * ImageEditor is the top level object that holds together and connects | 6 * ImageEditor is the top level object that holds together and connects |
| 7 * everything needed for image editing. | 7 * everything needed for image editing. |
| 8 * | 8 * |
| 9 * @param {!Viewport} viewport The viewport. | 9 * @param {!Viewport} viewport The viewport. |
| 10 * @param {!ImageView} imageView The ImageView containing the images to edit. | 10 * @param {!ImageView} imageView The ImageView containing the images to edit. |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 if (this.getMode()) { | 699 if (this.getMode()) { |
| 700 var action = this.buffer_.getDoubleTapAction(x, y); | 700 var action = this.buffer_.getDoubleTapAction(x, y); |
| 701 if (action == ImageBuffer.DoubleTapAction.COMMIT) | 701 if (action == ImageBuffer.DoubleTapAction.COMMIT) |
| 702 this.leaveMode(true); | 702 this.leaveMode(true); |
| 703 else if (action == ImageBuffer.DoubleTapAction.CANCEL) | 703 else if (action == ImageBuffer.DoubleTapAction.CANCEL) |
| 704 this.leaveMode(false); | 704 this.leaveMode(false); |
| 705 } | 705 } |
| 706 }; | 706 }; |
| 707 | 707 |
| 708 /** | 708 /** |
| 709 * Hide the tools that overlap the given rectangular frame. | |
| 710 * | |
| 711 * @param {ImageRect=} opt_frame Hide the tool that overlaps this rect. | |
| 712 * @param {ImageRect=} opt_transparent But do not hide the tool that is | |
| 713 * completely inside this rect. | |
| 714 */ | |
| 715 ImageEditor.prototype.hideOverlappingTools = function( | |
| 716 opt_frame, opt_transparent) { | |
| 717 var frame = opt_frame || null; | |
| 718 var transparent = opt_transparent || null; | |
| 719 | |
| 720 var tools = this.rootContainer_.ownerDocument.querySelectorAll('.dimmable'); | |
| 721 var changed = false; | |
| 722 for (var i = 0; i != tools.length; i++) { | |
| 723 var tool = tools[i]; | |
| 724 var toolRect = tool.getBoundingClientRect(); | |
| 725 var overlapping = | |
| 726 (!!frame && frame.intersects(toolRect)) && | |
| 727 !(!!transparent && transparent.contains(toolRect)); | |
| 728 if (overlapping && !tool.hasAttribute('dimmed') || | |
| 729 !overlapping && tool.hasAttribute('dimmed')) { | |
| 730 ImageUtil.setAttribute(tool, 'dimmed', overlapping); | |
| 731 changed = true; | |
| 732 } | |
| 733 } | |
| 734 }; | |
| 735 | |
| 736 /** | |
| 737 * A helper object for panning the ImageBuffer. | 709 * A helper object for panning the ImageBuffer. |
| 738 * | 710 * |
| 739 * @param {!HTMLElement} rootContainer The top-level container. | 711 * @param {!HTMLElement} rootContainer The top-level container. |
| 740 * @param {!HTMLElement} container The container for mouse events. | 712 * @param {!HTMLElement} container The container for mouse events. |
| 741 * @param {!ImageBuffer} buffer Image buffer. | 713 * @param {!ImageBuffer} buffer Image buffer. |
| 742 * @constructor | 714 * @constructor |
| 743 * @struct | 715 * @struct |
| 744 */ | 716 */ |
| 745 ImageEditor.MouseControl = function(rootContainer, container, buffer) { | 717 ImageEditor.MouseControl = function(rootContainer, container, buffer) { |
| 746 this.rootContainer_ = rootContainer; | 718 this.rootContainer_ = rootContainer; |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1411 | 1383 |
| 1412 /** | 1384 /** |
| 1413 * Hide the prompt. | 1385 * Hide the prompt. |
| 1414 */ | 1386 */ |
| 1415 ImageEditor.Prompt.prototype.hide = function() { | 1387 ImageEditor.Prompt.prototype.hide = function() { |
| 1416 if (!this.prompt_) return; | 1388 if (!this.prompt_) return; |
| 1417 this.prompt_.setAttribute('state', 'fadeout'); | 1389 this.prompt_.setAttribute('state', 'fadeout'); |
| 1418 // Allow some time for the animation to play out. | 1390 // Allow some time for the animation to play out. |
| 1419 this.setTimer(this.reset.bind(this), 500); | 1391 this.setTimer(this.reset.bind(this), 500); |
| 1420 }; | 1392 }; |
| OLD | NEW |