// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-'use strict';
-
/**
* Command queue is the only way to modify images.
* Supports undo/redo.
*
* @param {Document} document Document to create canvases in.
* @param {HTMLCanvasElement} canvas The canvas with the original image.
- * @param {function(callback)} saveFunction Function to save the image.
+ * @param {function(function())} saveFunction Function to save the image.
* @constructor
*/
function CommandQueue(document, canvas, saveFunction) {
/**
* Execute the action when the queue is not busy.
- * @param {function} callback Callback.
+ * @param {function()} callback Callback.
*/
CommandQueue.prototype.executeWhenReady = function(callback) {
if (this.isBusy())
*
* @param {Command} command The command to execute.
* @param {Object} uiContext The UI context.
- * @param {function} callback Completion callback.
+ * @param {function(number=)} callback Completion callback.
* @private
*/
CommandQueue.prototype.doExecute_ = function(command, uiContext, callback) {
/**
* Crop command.
*
- * @param {Rect} imageRect Crop rectangle in image coordinates.
+ * @param {ImageRect} imageRect Crop rectangle in image coordinates.
* @constructor
* @extends {Command}
*/
document, srcCanvas, callback, uiContext) {
var result = this.createCanvas_(
document, srcCanvas, this.imageRect_.width, this.imageRect_.height);
- Rect.drawImage(result.getContext('2d'), srcCanvas, null, this.imageRect_);
+ ImageRect.drawImage(
+ result.getContext('2d'), srcCanvas, null, this.imageRect_);
var delay;
if (uiContext.imageView) {
delay = uiContext.imageView.replaceAndAnimate(result, this.imageRect_, 0);
} else {
var viewport = uiContext.imageView.viewport_;
- var imageStrip = new Rect(viewport.getImageBounds());
+ var imageStrip = new ImageRect(viewport.getImageBounds());
imageStrip.top = previousRow;
imageStrip.height = updatedRow - previousRow;
- var screenStrip = new Rect(viewport.getImageBoundsOnScreen());
+ var screenStrip = new ImageRect(viewport.getImageBoundsOnScreen());
screenStrip.top = Math.round(viewport.imageToScreenY(previousRow));
screenStrip.height =
Math.round(viewport.imageToScreenY(updatedRow)) - screenStrip.top;