| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * ImageEditor is the top level object that holds together and connects | 8 * ImageEditor is the top level object that holds together and connects |
| 9 * everything needed for image editing. | 9 * everything needed for image editing. |
| 10 * | 10 * |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 viewport, imageView, prompt, DOMContainers, modes, displayStringFunction, | 22 viewport, imageView, prompt, DOMContainers, modes, displayStringFunction, |
| 23 onToolsVisibilityChanged) { | 23 onToolsVisibilityChanged) { |
| 24 this.rootContainer_ = DOMContainers.root; | 24 this.rootContainer_ = DOMContainers.root; |
| 25 this.container_ = DOMContainers.image; | 25 this.container_ = DOMContainers.image; |
| 26 this.modes_ = modes; | 26 this.modes_ = modes; |
| 27 this.displayStringFunction_ = displayStringFunction; | 27 this.displayStringFunction_ = displayStringFunction; |
| 28 this.onToolsVisibilityChanged_ = onToolsVisibilityChanged; | 28 this.onToolsVisibilityChanged_ = onToolsVisibilityChanged; |
| 29 | 29 |
| 30 ImageUtil.removeChildren(this.container_); | 30 ImageUtil.removeChildren(this.container_); |
| 31 | 31 |
| 32 var document = this.container_.ownerDocument; | |
| 33 | |
| 34 this.viewport_ = viewport; | 32 this.viewport_ = viewport; |
| 35 this.viewport_.sizeByFrame(this.container_); | 33 this.viewport_.sizeByFrame(this.container_); |
| 36 | 34 |
| 37 this.buffer_ = new ImageBuffer(); | |
| 38 this.viewport_.addRepaintCallback(this.buffer_.draw.bind(this.buffer_)); | |
| 39 | |
| 40 this.imageView_ = imageView; | 35 this.imageView_ = imageView; |
| 41 this.imageView_.addContentCallback(this.onContentUpdate_.bind(this)); | 36 this.imageView_.addContentCallback(this.onContentUpdate_.bind(this)); |
| 37 |
| 38 this.buffer_ = new ImageBuffer(); |
| 42 this.buffer_.addOverlay(this.imageView_); | 39 this.buffer_.addOverlay(this.imageView_); |
| 43 | 40 |
| 44 this.panControl_ = new ImageEditor.MouseControl( | 41 this.panControl_ = new ImageEditor.MouseControl( |
| 45 this.rootContainer_, this.container_, this.getBuffer()); | 42 this.rootContainer_, this.container_, this.getBuffer()); |
| 46 | |
| 47 this.panControl_.setDoubleTapCallback(this.onDoubleTap_.bind(this)); | 43 this.panControl_.setDoubleTapCallback(this.onDoubleTap_.bind(this)); |
| 48 | 44 |
| 49 this.mainToolbar_ = new ImageEditor.Toolbar( | 45 this.mainToolbar_ = new ImageEditor.Toolbar( |
| 50 DOMContainers.toolbar, displayStringFunction); | 46 DOMContainers.toolbar, displayStringFunction); |
| 51 | 47 |
| 52 this.modeToolbar_ = new ImageEditor.Toolbar( | 48 this.modeToolbar_ = new ImageEditor.Toolbar( |
| 53 DOMContainers.mode, displayStringFunction, | 49 DOMContainers.mode, displayStringFunction, |
| 54 this.onOptionsChange.bind(this)); | 50 this.onOptionsChange.bind(this)); |
| 55 | 51 |
| 56 this.prompt_ = prompt; | 52 this.prompt_ = prompt; |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1197 | 1193 |
| 1198 /** | 1194 /** |
| 1199 * Hide the prompt. | 1195 * Hide the prompt. |
| 1200 */ | 1196 */ |
| 1201 ImageEditor.Prompt.prototype.hide = function() { | 1197 ImageEditor.Prompt.prototype.hide = function() { |
| 1202 if (!this.prompt_) return; | 1198 if (!this.prompt_) return; |
| 1203 this.prompt_.setAttribute('state', 'fadeout'); | 1199 this.prompt_.setAttribute('state', 'fadeout'); |
| 1204 // Allow some time for the animation to play out. | 1200 // Allow some time for the animation to play out. |
| 1205 this.setTimer(this.reset.bind(this), 500); | 1201 this.setTimer(this.reset.bind(this), 500); |
| 1206 }; | 1202 }; |
| OLD | NEW |