f4751ff3c945cff5eeb2f47beacda17b.json
4.62 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 commandFactory from '../factory/command';\nimport { Promise } from '../util';\nimport { commandNames, rejectMessages } from '../consts';\nconst command = {\n name: commandNames.SET_OBJECT_POSITION,\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} posInfo - position object\r\n * @param {number} posInfo.x - x position\r\n * @param {number} posInfo.y - y position\r\n * @param {string} posInfo.originX - can be 'left', 'center', 'right'\r\n * @param {string} posInfo.originY - can be 'top', 'center', 'bottom'\r\n * @returns {Promise}\r\n */\n execute(graphics, id, posInfo) {\n const targetObj = graphics.getObject(id);\n\n if (!targetObj) {\n return Promise.reject(rejectMessages.noObject);\n }\n\n this.undoData.objectId = id;\n this.undoData.props = graphics.getObjectProperties(id, ['left', 'top']);\n graphics.setObjectPosition(id, posInfo);\n graphics.renderAll();\n return Promise.resolve();\n },\n\n /**\r\n * @param {Graphics} graphics - Graphics instance\r\n * @returns {Promise}\r\n */\n undo(graphics) {\n const {\n objectId,\n props\n } = this.undoData;\n graphics.setObjectProperties(objectId, props);\n graphics.renderAll();\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/setObjectPosition.js"],"names":["commandFactory","Promise","commandNames","rejectMessages","command","name","SET_OBJECT_POSITION","execute","graphics","id","posInfo","targetObj","getObject","reject","noObject","undoData","objectId","props","getObjectProperties","setObjectPosition","renderAll","resolve","undo","setObjectProperties","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,mBADL;;AAGd;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,CAACC,QAAD,EAAWC,EAAX,EAAeC,OAAf,EAAwB;AAC7B,UAAMC,SAAS,GAAGH,QAAQ,CAACI,SAAT,CAAmBH,EAAnB,CAAlB;;AAEA,QAAI,CAACE,SAAL,EAAgB;AACd,aAAOV,OAAO,CAACY,MAAR,CAAeV,cAAc,CAACW,QAA9B,CAAP;AACD;;AAED,SAAKC,QAAL,CAAcC,QAAd,GAAyBP,EAAzB;AACA,SAAKM,QAAL,CAAcE,KAAd,GAAsBT,QAAQ,CAACU,mBAAT,CAA6BT,EAA7B,EAAiC,CAAC,MAAD,EAAS,KAAT,CAAjC,CAAtB;AAEAD,IAAAA,QAAQ,CAACW,iBAAT,CAA2BV,EAA3B,EAA+BC,OAA/B;AACAF,IAAAA,QAAQ,CAACY,SAAT;AAEA,WAAOnB,OAAO,CAACoB,OAAR,EAAP;AACD,GA5Ba;;AA6Bd;AACF;AACA;AACA;AACEC,EAAAA,IAAI,CAACd,QAAD,EAAW;AACb,UAAM;AAAEQ,MAAAA,QAAF;AAAYC,MAAAA;AAAZ,QAAsB,KAAKF,QAAjC;AAEAP,IAAAA,QAAQ,CAACe,mBAAT,CAA6BP,QAA7B,EAAuCC,KAAvC;AACAT,IAAAA,QAAQ,CAACY,SAAT;AAEA,WAAOnB,OAAO,CAACoB,OAAR,EAAP;AACD;;AAxCa,CAAhB;AA2CArB,cAAc,CAACwB,QAAf,CAAwBpB,OAAxB;AAEA,eAAeA,OAAf","sourcesContent":["/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Set object properties\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.SET_OBJECT_POSITION,\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} posInfo - position object\r\n * @param {number} posInfo.x - x position\r\n * @param {number} posInfo.y - y position\r\n * @param {string} posInfo.originX - can be 'left', 'center', 'right'\r\n * @param {string} posInfo.originY - can be 'top', 'center', 'bottom'\r\n * @returns {Promise}\r\n */\r\n execute(graphics, id, posInfo) {\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.objectId = id;\r\n this.undoData.props = graphics.getObjectProperties(id, ['left', 'top']);\r\n\r\n graphics.setObjectPosition(id, posInfo);\r\n graphics.renderAll();\r\n\r\n return Promise.resolve();\r\n },\r\n /**\r\n * @param {Graphics} graphics - Graphics instance\r\n * @returns {Promise}\r\n */\r\n undo(graphics) {\r\n const { objectId, props } = this.undoData;\r\n\r\n graphics.setObjectProperties(objectId, props);\r\n graphics.renderAll();\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"}