c033b165b6f69d7ff52f16c927d89500.json
3.23 KB
{"ast":null,"code":"/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Remove an object\r\n */\nimport commandFactory from '../factory/command';\nimport { Promise } from '../util';\nimport { commandNames, rejectMessages } from '../consts';\nconst command = {\n name: commandNames.REMOVE_OBJECT,\n\n /**\r\n * Remove an object\r\n * @param {Graphics} graphics - Graphics instance\r\n * @param {number} id - object id\r\n * @returns {Promise}\r\n */\n execute(graphics, id) {\n return new Promise((resolve, reject) => {\n this.undoData.objects = graphics.removeObjectById(id);\n\n if (this.undoData.objects.length) {\n resolve();\n } else {\n reject(rejectMessages.noObject);\n }\n });\n },\n\n /**\r\n * @param {Graphics} graphics - Graphics instance\r\n * @returns {Promise}\r\n */\n undo(graphics) {\n graphics.add(this.undoData.objects);\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/removeObject.js"],"names":["commandFactory","Promise","commandNames","rejectMessages","command","name","REMOVE_OBJECT","execute","graphics","id","resolve","reject","undoData","objects","removeObjectById","length","noObject","undo","add","register"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,oBAA3B;AACA,SAASC,OAAT,QAAwB,SAAxB;AACA,SAASC,YAAT,EAAuBC,cAAvB,QAA6C,WAA7C;AAEA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAEH,YAAY,CAACI,aADL;;AAGd;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,CAACC,QAAD,EAAWC,EAAX,EAAe;AACpB,WAAO,IAAIR,OAAJ,CAAY,CAACS,OAAD,EAAUC,MAAV,KAAqB;AACtC,WAAKC,QAAL,CAAcC,OAAd,GAAwBL,QAAQ,CAACM,gBAAT,CAA0BL,EAA1B,CAAxB;;AACA,UAAI,KAAKG,QAAL,CAAcC,OAAd,CAAsBE,MAA1B,EAAkC;AAChCL,QAAAA,OAAO;AACR,OAFD,MAEO;AACLC,QAAAA,MAAM,CAACR,cAAc,CAACa,QAAhB,CAAN;AACD;AACF,KAPM,CAAP;AAQD,GAlBa;;AAmBd;AACF;AACA;AACA;AACEC,EAAAA,IAAI,CAACT,QAAD,EAAW;AACbA,IAAAA,QAAQ,CAACU,GAAT,CAAa,KAAKN,QAAL,CAAcC,OAA3B;AAEA,WAAOZ,OAAO,CAACS,OAAR,EAAP;AACD;;AA3Ba,CAAhB;AA8BAV,cAAc,CAACmB,QAAf,CAAwBf,OAAxB;AAEA,eAAeA,OAAf","sourcesContent":["/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Remove an object\r\n */\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.REMOVE_OBJECT,\r\n\r\n /**\r\n * Remove an object\r\n * @param {Graphics} graphics - Graphics instance\r\n * @param {number} id - object id\r\n * @returns {Promise}\r\n */\r\n execute(graphics, id) {\r\n return new Promise((resolve, reject) => {\r\n this.undoData.objects = graphics.removeObjectById(id);\r\n if (this.undoData.objects.length) {\r\n resolve();\r\n } else {\r\n reject(rejectMessages.noObject);\r\n }\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.add(this.undoData.objects);\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"}