f33f1d402b81c83cc9427350366a35dc.json 5.28 KB
{"ast":null,"code":"/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Set object properties\r\n */\nimport snippet from 'tui-code-snippet';\nimport commandFactory from '../factory/command';\nimport { Promise } from '../util';\nimport { commandNames, rejectMessages } from '../consts';\nconst command = {\n  name: commandNames.SET_OBJECT_PROPERTIES,\n\n  /**\r\n   * Set object properties\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {number} id - object id\r\n   * @param {Object} props - properties\r\n   *     @param {string} [props.fill] Color\r\n   *     @param {string} [props.fontFamily] Font type for text\r\n   *     @param {number} [props.fontSize] Size\r\n   *     @param {string} [props.fontStyle] Type of inclination (normal / italic)\r\n   *     @param {string} [props.fontWeight] Type of thicker or thinner looking (normal / bold)\r\n   *     @param {string} [props.textAlign] Type of text align (left / center / right)\r\n   *     @param {string} [props.textDecoration] Type of line (underline / line-through / overline)\r\n   * @returns {Promise}\r\n   */\n  execute(graphics, id, props) {\n    const targetObj = graphics.getObject(id);\n\n    if (!targetObj) {\n      return Promise.reject(rejectMessages.noObject);\n    }\n\n    this.undoData.props = {};\n    snippet.forEachOwnProperties(props, (value, key) => {\n      this.undoData.props[key] = targetObj[key];\n    });\n    graphics.setObjectProperties(id, props);\n    return Promise.resolve();\n  },\n\n  /**\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {number} id - object id\r\n   * @returns {Promise}\r\n   */\n  undo(graphics, id) {\n    const {\n      props\n    } = this.undoData;\n    graphics.setObjectProperties(id, props);\n    return Promise.resolve();\n  }\n\n};\ncommandFactory.register(command);\nexport default command;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/src/js/command/setObjectProperties.js"],"names":["snippet","commandFactory","Promise","commandNames","rejectMessages","command","name","SET_OBJECT_PROPERTIES","execute","graphics","id","props","targetObj","getObject","reject","noObject","undoData","forEachOwnProperties","value","key","setObjectProperties","resolve","undo","register"],"mappings":"AA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E Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Set object properties\r\n */\r\nimport snippet from 'tui-code-snippet';\r\nimport commandFactory from '../factory/command';\r\nimport { Promise } from '../util';\r\nimport { commandNames, rejectMessages } from '../consts';\r\n\r\nconst command = {\r\n  name: commandNames.SET_OBJECT_PROPERTIES,\r\n\r\n  /**\r\n   * Set object properties\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {number} id - object id\r\n   * @param {Object} props - properties\r\n   *     @param {string} [props.fill] Color\r\n   *     @param {string} [props.fontFamily] Font type for text\r\n   *     @param {number} [props.fontSize] Size\r\n   *     @param {string} [props.fontStyle] Type of inclination (normal / italic)\r\n   *     @param {string} [props.fontWeight] Type of thicker or thinner looking (normal / bold)\r\n   *     @param {string} [props.textAlign] Type of text align (left / center / right)\r\n   *     @param {string} [props.textDecoration] Type of line (underline / line-through / overline)\r\n   * @returns {Promise}\r\n   */\r\n  execute(graphics, id, props) {\r\n    const targetObj = graphics.getObject(id);\r\n\r\n    if (!targetObj) {\r\n      return Promise.reject(rejectMessages.noObject);\r\n    }\r\n\r\n    this.undoData.props = {};\r\n    snippet.forEachOwnProperties(props, (value, key) => {\r\n      this.undoData.props[key] = targetObj[key];\r\n    });\r\n\r\n    graphics.setObjectProperties(id, props);\r\n\r\n    return Promise.resolve();\r\n  },\r\n  /**\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {number} id - object id\r\n   * @returns {Promise}\r\n   */\r\n  undo(graphics, id) {\r\n    const { props } = this.undoData;\r\n\r\n    graphics.setObjectProperties(id, props);\r\n\r\n    return Promise.resolve();\r\n  },\r\n};\r\n\r\ncommandFactory.register(command);\r\n\r\nexport default command;\r\n"]},"metadata":{},"sourceType":"module"}