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

Unified Diff: ui/file_manager/gallery/js/image_editor/image_editor.js

Issue 2717653002: Compile more Gallery targets in gyp v2. (Closed)
Patch Set: . Created 3 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 side-by-side diff with in-line comments
Download patch
Index: ui/file_manager/gallery/js/image_editor/image_editor.js
diff --git a/ui/file_manager/gallery/js/image_editor/image_editor.js b/ui/file_manager/gallery/js/image_editor/image_editor.js
index 30da9fe39105bfbc77b7c7407c8661c6e84a9d71..0adb1b30552f6d5be169ce0ae76fff9cf5680508 100644
--- a/ui/file_manager/gallery/js/image_editor/image_editor.js
+++ b/ui/file_manager/gallery/js/image_editor/image_editor.js
@@ -8,7 +8,7 @@
*
* @param {!Viewport} viewport The viewport.
* @param {!ImageView} imageView The ImageView containing the images to edit.
- * @param {!ImageEditor.Prompt} prompt Prompt instance.
+ * @param {!ImageEditorPrompt} prompt Prompt instance.
* @param {!Object} DOMContainers Various DOM containers required for the
* editor.
* @param {!Array<!ImageEditor.Mode>} modes Available editor modes.
@@ -350,7 +350,7 @@ ImageEditor.prototype.getImageView = function() { return this.imageView_; };
ImageEditor.prototype.getViewport = function() { return this.viewport_; };
/**
- * @return {!ImageEditor.Prompt} Prompt instance.
+ * @return {!ImageEditorPrompt} Prompt instance.
*/
ImageEditor.prototype.getPrompt = function() { return this.prompt_; };
@@ -1463,151 +1463,3 @@ ImageEditor.Toolbar.prototype.show = function(on) {
input.focus();
}
};
-
-/** A prompt panel for the editor.
- *
- * @param {!HTMLElement} container Container element.
- * @param {function(string, ...string)} displayStringFunction A formatting
- * function.
- * @constructor
- * @struct
- */
-ImageEditor.Prompt = function(container, displayStringFunction) {
- this.container_ = container;
- this.displayStringFunction_ = displayStringFunction;
-
- /**
- * @type {HTMLDivElement}
- * @private
- */
- this.wrapper_ = null;
-
- /**
- * @type {HTMLDivElement}
- * @private
- */
- this.prompt_ = null;
-
- /**
- * @type {number}
- * @private
- */
- this.timer_ = 0;
-};
-
-/**
- * Reset the prompt.
- */
-ImageEditor.Prompt.prototype.reset = function() {
- this.cancelTimer();
- if (this.wrapper_) {
- this.container_.removeChild(this.wrapper_);
- this.wrapper_ = null;
- this.prompt_ = null;
- }
-};
-
-/**
- * Cancel the delayed action.
- */
-ImageEditor.Prompt.prototype.cancelTimer = function() {
- if (this.timer_) {
- clearTimeout(this.timer_);
- this.timer_ = 0;
- }
-};
-
-/**
- * Schedule the delayed action.
- * @param {function()} callback Callback.
- * @param {number} timeout Timeout.
- */
-ImageEditor.Prompt.prototype.setTimer = function(callback, timeout) {
- this.cancelTimer();
- var self = this;
- this.timer_ = setTimeout(function() {
- self.timer_ = 0;
- callback();
- }, timeout);
-};
-
-/**
- * Show the prompt.
- *
- * @param {string} text The prompt text.
- * @param {number=} opt_timeout Timeout in ms.
- * @param {...Object} var_args varArgs for the formatting function.
- */
-ImageEditor.Prompt.prototype.show = function(text, opt_timeout, var_args) {
- var args = [text].concat(Array.prototype.slice.call(arguments, 2));
- var message = this.displayStringFunction_.apply(null, args);
- this.showStringAt('center', message, opt_timeout);
-};
-
-/**
- * Show the position at the specific position.
- *
- * @param {string} pos The 'pos' attribute value.
- * @param {string} text The prompt text.
- * @param {number} timeout Timeout in ms.
- * @param {...Object} var_args varArgs for the formatting function.
- */
-ImageEditor.Prompt.prototype.showAt = function(
- pos, text, timeout, var_args) {
- var args = [text].concat(Array.prototype.slice.call(arguments, 3));
- var message = this.displayStringFunction_.apply(null, args);
- this.showStringAt(pos, message, timeout);
-};
-
-/**
- * Show the string in the prompt
- *
- * @param {string} pos The 'pos' attribute value.
- * @param {string} text The prompt text.
- * @param {number=} opt_timeout Timeout in ms.
- */
-ImageEditor.Prompt.prototype.showStringAt = function(pos, text, opt_timeout) {
- this.reset();
- if (!text)
- return;
-
- var document = this.container_.ownerDocument;
- this.wrapper_ = assertInstanceof(document.createElement('div'),
- HTMLDivElement);
- this.wrapper_.className = 'prompt-wrapper';
- this.wrapper_.setAttribute('pos', pos);
- this.container_.appendChild(this.wrapper_);
-
- this.prompt_ = assertInstanceof(document.createElement('div'),
- HTMLDivElement);
- this.prompt_.className = 'prompt';
-
- // Create an extra wrapper which opacity can be manipulated separately.
- var tool = document.createElement('div');
- tool.className = 'dimmable';
- this.wrapper_.appendChild(tool);
- tool.appendChild(this.prompt_);
-
- this.prompt_.textContent = text;
-
- var close = document.createElement('div');
- close.className = 'close';
- close.addEventListener('click', this.hide.bind(this));
- this.prompt_.appendChild(close);
-
- setTimeout(
- this.prompt_.setAttribute.bind(this.prompt_, 'state', 'fadein'), 0);
-
- if (opt_timeout)
- this.setTimer(this.hide.bind(this), opt_timeout);
-};
-
-/**
- * Hide the prompt.
- */
-ImageEditor.Prompt.prototype.hide = function() {
- if (!this.prompt_) return;
- this.prompt_.setAttribute('state', 'fadeout');
- // Allow some time for the animation to play out.
- this.setTimer(this.reset.bind(this), 500);
-};

Powered by Google App Engine
This is Rietveld 408576698