PHP Classes

File: toastui/src/js/command/resizeCanvasDimension.js

Recommend this page to a friend!
  Classes of Mark de Leon   PHP Document Scanner using SANE or eSCL AirPrint   toastui/src/js/command/resizeCanvasDimension.js   Download  
File: toastui/src/js/command/resizeCanvasDimension.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Document Scanner using SANE or eSCL AirPrint
Web interface to scan printed documents
Author: By
Last change:
Date: 4 years ago
Size: 1,237 bytes
 

Contents

Class file image Download
/** * @author NHN Ent. FE Development Team <dl_javascript@nhn.com> * @fileoverview Resize a canvas */ import commandFactory from '../factory/command'; import Promise from 'core-js/library/es6/promise'; import consts from '../consts'; const {commandNames} = consts; const command = { name: commandNames.RESIZE_CANVAS_DIMENSION, /** * resize the canvas with given dimension * @param {Graphics} graphics - Graphics instance * @param {{width: number, height: number}} dimension - Max width & height * @returns {Promise} */ execute(graphics, dimension) { return new Promise(resolve => { this.undoData.size = { width: graphics.cssMaxWidth, height: graphics.cssMaxHeight }; graphics.setCssMaxDimension(dimension); graphics.adjustCanvasDimension(); resolve(); }); }, /** * @param {Graphics} graphics - Graphics instance * @returns {Promise} */ undo(graphics) { graphics.setCssMaxDimension(this.undoData.size); graphics.adjustCanvasDimension(); return Promise.resolve(); } }; commandFactory.register(command); module.exports = command;