5c1d17b6377c89d2205818c382a39fe5.json 3.87 KB
{"ast":null,"code":"/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Add an icon\r\n */\nimport commandFactory from '../factory/command';\nimport { Promise } from '../util';\nimport { componentNames, commandNames } from '../consts';\nconst {\n  ICON\n} = componentNames;\nconst command = {\n  name: commandNames.ADD_ICON,\n\n  /**\r\n   * Add an icon\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {string} type - Icon type ('arrow', 'cancel', custom icon name)\r\n   * @param {Object} options - Icon options\r\n   *      @param {string} [options.fill] - Icon foreground color\r\n   *      @param {string} [options.left] - Icon x position\r\n   *      @param {string} [options.top] - Icon y position\r\n   * @returns {Promise}\r\n   */\n  execute(graphics, type, options) {\n    const iconComp = graphics.getComponent(ICON);\n    return iconComp.add(type, options).then(objectProps => {\n      this.undoData.object = graphics.getObject(objectProps.id);\n      return objectProps;\n    });\n  },\n\n  /**\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @returns {Promise}\r\n   */\n  undo(graphics) {\n    graphics.remove(this.undoData.object);\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/addIcon.js"],"names":["commandFactory","Promise","componentNames","commandNames","ICON","command","name","ADD_ICON","execute","graphics","type","options","iconComp","getComponent","add","then","objectProps","undoData","object","getObject","id","undo","remove","resolve","register"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,oBAA3B;AACA,SAASC,OAAT,QAAwB,SAAxB;AACA,SAASC,cAAT,EAAyBC,YAAzB,QAA6C,WAA7C;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAWF,cAAjB;AAEA,MAAMG,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAEH,YAAY,CAACI,QADL;;AAGd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,CAACC,QAAD,EAAWC,IAAX,EAAiBC,OAAjB,EAA0B;AAC/B,UAAMC,QAAQ,GAAGH,QAAQ,CAACI,YAAT,CAAsBT,IAAtB,CAAjB;AAEA,WAAOQ,QAAQ,CAACE,GAAT,CAAaJ,IAAb,EAAmBC,OAAnB,EAA4BI,IAA5B,CAAkCC,WAAD,IAAiB;AACvD,WAAKC,QAAL,CAAcC,MAAd,GAAuBT,QAAQ,CAACU,SAAT,CAAmBH,WAAW,CAACI,EAA/B,CAAvB;AAEA,aAAOJ,WAAP;AACD,KAJM,CAAP;AAKD,GArBa;;AAsBd;AACF;AACA;AACA;AACEK,EAAAA,IAAI,CAACZ,QAAD,EAAW;AACbA,IAAAA,QAAQ,CAACa,MAAT,CAAgB,KAAKL,QAAL,CAAcC,MAA9B;AAEA,WAAOjB,OAAO,CAACsB,OAAR,EAAP;AACD;;AA9Ba,CAAhB;AAiCAvB,cAAc,CAACwB,QAAf,CAAwBnB,OAAxB;AAEA,eAAeA,OAAf","sourcesContent":["/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Add an icon\r\n */\r\nimport commandFactory from '../factory/command';\r\nimport { Promise } from '../util';\r\nimport { componentNames, commandNames } from '../consts';\r\n\r\nconst { ICON } = componentNames;\r\n\r\nconst command = {\r\n  name: commandNames.ADD_ICON,\r\n\r\n  /**\r\n   * Add an icon\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {string} type - Icon type ('arrow', 'cancel', custom icon name)\r\n   * @param {Object} options - Icon options\r\n   *      @param {string} [options.fill] - Icon foreground color\r\n   *      @param {string} [options.left] - Icon x position\r\n   *      @param {string} [options.top] - Icon y position\r\n   * @returns {Promise}\r\n   */\r\n  execute(graphics, type, options) {\r\n    const iconComp = graphics.getComponent(ICON);\r\n\r\n    return iconComp.add(type, options).then((objectProps) => {\r\n      this.undoData.object = graphics.getObject(objectProps.id);\r\n\r\n      return objectProps;\r\n    });\r\n  },\r\n  /**\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @returns {Promise}\r\n   */\r\n  undo(graphics) {\r\n    graphics.remove(this.undoData.object);\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"}