PHP Classes

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

Recommend this page to a friend!
  Classes of Mark de Leon  >  PHP Document Scanner using SANE or eSCL AirPrint  >  toastui/src/js/command/setObjectPosition.js  >  Download  
File: toastui/src/js/command/setObjectPosition.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: 1 year ago
Size: 1,594 bytes


Class file image Download
 * @author NHN Ent. FE Development Team <>
 * @fileoverview Set object properties
import commandFactory from '../factory/command';
import Promise from 'core-js/library/es6/promise';
import consts from '../consts';

const {commandNames, rejectMessages} = consts;

const command = {
    name: commandNames.SET_OBJECT_POSITION,

     * Set object properties
     * @param {Graphics} graphics - Graphics instance
     * @param {number} id - object id
     * @param {Object} posInfo - position object
     *  @param {number} posInfo.x - x position
     *  @param {number} posInfo.y - y position
     *  @param {string} posInfo.originX - can be 'left', 'center', 'right'
     *  @param {string} posInfo.originY - can be 'top', 'center', 'bottom'
     * @returns {Promise}
    execute(graphics, id, posInfo) {
        const targetObj = graphics.getObject(id);

        if (!targetObj) {
            return Promise.reject(rejectMessages.noObject);

        this.undoData.objectId = id;
        this.undoData.props = graphics.getObjectProperties(id, ['left', 'top']);

        graphics.setObjectPosition(id, posInfo);

        return Promise.resolve();
     * @param {Graphics} graphics - Graphics instance
     * @returns {Promise}
    undo(graphics) {
        const {objectId, props} = this.undoData;

        graphics.setObjectProperties(objectId, props);

        return Promise.resolve();


module.exports = command;
For more information send a message to info at phpclasses dot org.