Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/browser/resources/file_manager/js/image_editor/image_buffer.js

Issue 12254015: Revert 182242 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /** 5 /**
6 * A stack of overlays that display itself and handle mouse events. 6 * A stack of overlays that display itself and handle mouse events.
7 * TODO(kaznacheev) Consider disbanding this class and moving 7 * TODO(kaznacheev) Consider disbanding this class and moving
8 * the functionality to individual objects that display anything or handle 8 * the functionality to individual objects that display anything or handle
9 * mouse events. 9 * mouse events.
10 * @constructor 10 * @constructor
11 */ 11 */
12 function ImageBuffer() { 12 function ImageBuffer() {
13 this.overlays_ = []; 13 this.overlays_ = [];
14 } 14 }
15 15
16 /** 16 //TODO(JSDOC)
17 * TODO(JSDOC).
18 * @param {ImageBuffer.Overlay} overlay //TODO(JSDOC).
19 */
20 ImageBuffer.prototype.addOverlay = function(overlay) { 17 ImageBuffer.prototype.addOverlay = function(overlay) {
21 var zIndex = overlay.getZIndex(); 18 var zIndex = overlay.getZIndex();
22 // Store the overlays in the ascending Z-order. 19 // Store the overlays in the ascending Z-order.
23 var i; 20 var i;
24 for (i = 0; i != this.overlays_.length; i++) { 21 for (i = 0; i != this.overlays_.length; i++) {
25 if (zIndex < this.overlays_[i].getZIndex()) break; 22 if (zIndex < this.overlays_[i].getZIndex()) break;
26 } 23 }
27 this.overlays_.splice(i, 0, overlay); 24 this.overlays_.splice(i, 0, overlay);
28 }; 25 };
29 26
30 /** 27 //TODO(JSDOC)
31 * TODO(JSDOC).
32 * @param {ImageBuffer.Overlay} overlay //TODO(JSDOC).
33 */
34 ImageBuffer.prototype.removeOverlay = function(overlay) { 28 ImageBuffer.prototype.removeOverlay = function(overlay) {
35 for (var i = 0; i != this.overlays_.length; i++) { 29 for (var i = 0; i != this.overlays_.length; i++) {
36 if (this.overlays_[i] == overlay) { 30 if (this.overlays_[i] == overlay) {
37 this.overlays_.splice(i, 1); 31 this.overlays_.splice(i, 1);
38 return; 32 return;
39 } 33 }
40 } 34 }
41 throw new Error('Cannot remove overlay ' + overlay); 35 throw new Error('Cannot remove overlay ' + overlay);
42 }; 36 };
43 37
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 NOTHING: 0, 112 NOTHING: 0,
119 COMMIT: 1, 113 COMMIT: 1,
120 CANCEL: 2 114 CANCEL: 2
121 }; 115 };
122 116
123 /** 117 /**
124 * ImageBuffer.Overlay is a pluggable extension that modifies the outlook 118 * ImageBuffer.Overlay is a pluggable extension that modifies the outlook
125 * and the behavior of the ImageBuffer instance. 119 * and the behavior of the ImageBuffer instance.
126 * @class 120 * @class
127 */ 121 */
122 //TODO(JSDOC)
128 ImageBuffer.Overlay = function() {}; 123 ImageBuffer.Overlay = function() {};
129 124
130 /** 125 //TODO(JSDOC)
131 * TODO(JSDOC).
132 * @return {number} //TODO(JSDOC).
133 */
134 ImageBuffer.Overlay.prototype.getZIndex = function() { return 0 }; 126 ImageBuffer.Overlay.prototype.getZIndex = function() { return 0 };
135 127
136 /** 128 //TODO(JSDOC)
137 * TODO(JSDOC).
138 */
139 ImageBuffer.Overlay.prototype.draw = function() {}; 129 ImageBuffer.Overlay.prototype.draw = function() {};
140 130
141 /** 131 //TODO(JSDOC)
142 * TODO(JSDOC). 132 ImageBuffer.Overlay.prototype.getCursorStyle = function() { return null };
143 * @param {number} x X coordinate for cursor.
144 * @param {number} y Y coordinate for cursor.
145 * @param {boolean} mouseDown If mouse button is down.
146 * @return {?string} A value for style.cursor CSS property or null for
147 * default.
148 */
149 ImageBuffer.Overlay.prototype.getCursorStyle = function(x, y, mouseDown) {
150 return null;
151 };
152 133
153 /** 134 //TODO(JSDOC)
154 * TODO(JSDOC). 135 ImageBuffer.Overlay.prototype.onClick = function() { return false };
155 * @param {number} x //TODO(JSDOC).
156 * @param {number} y //TODO(JSDOC).
157 * @return {boolean} //TODO(JSDOC).
158 */
159 ImageBuffer.Overlay.prototype.onClick = function(x, y) {
160 return false;
161 };
162 136
163 /** 137 //TODO(JSDOC)
164 * TODO(JSDOC). 138 ImageBuffer.Overlay.prototype.getDragHandler = function() { return null };
165 * @param {number} x Event X coordinate.
166 * @param {number} y Event Y coordinate.
167 * @param {boolean} touch True if it's a touch event, false if mouse.
168 * @return {function(number,number)} A function to be called on mouse drag.
169 */
170 ImageBuffer.Overlay.prototype.getDragHandler = function(x, y, touch) {
171 return null;
172 };
173 139
174 /** 140 //TODO(JSDOC)
175 * TODO(JSDOC).
176 * @param {number} x //TODO(JSDOC).
177 * @param {number} y //TODO(JSDOC).
178 * @return {ImageBuffer.DoubleTapAction} //TODO(JSDOC).
179 */
180 ImageBuffer.Overlay.prototype.getDoubleTapAction = function(x, y) { 141 ImageBuffer.Overlay.prototype.getDoubleTapAction = function(x, y) {
181 return ImageBuffer.DoubleTapAction.NOTHING; 142 return ImageBuffer.DoubleTapAction.NOTHING;
182 }; 143 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698