6a0899396c6f796fa7858b44755b72f2.json 3.55 KB
{"ast":null,"code":"/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Resize a canvas\r\n */\nimport commandFactory from '../factory/command';\nimport { Promise } from '../util';\nimport { commandNames } from '../consts';\nconst command = {\n  name: commandNames.RESIZE_CANVAS_DIMENSION,\n\n  /**\r\n   * resize the canvas with given dimension\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {{width: number, height: number}} dimension - Max width & height\r\n   * @returns {Promise}\r\n   */\n  execute(graphics, dimension) {\n    return new Promise(resolve => {\n      this.undoData.size = {\n        width: graphics.cssMaxWidth,\n        height: graphics.cssMaxHeight\n      };\n      graphics.setCssMaxDimension(dimension);\n      graphics.adjustCanvasDimension();\n      resolve();\n    });\n  },\n\n  /**\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @returns {Promise}\r\n   */\n  undo(graphics) {\n    graphics.setCssMaxDimension(this.undoData.size);\n    graphics.adjustCanvasDimension();\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/resizeCanvasDimension.js"],"names":["commandFactory","Promise","commandNames","command","name","RESIZE_CANVAS_DIMENSION","execute","graphics","dimension","resolve","undoData","size","width","cssMaxWidth","height","cssMaxHeight","setCssMaxDimension","adjustCanvasDimension","undo","register"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAOA,cAAP,MAA2B,oBAA3B;AACA,SAASC,OAAT,QAAwB,SAAxB;AACA,SAASC,YAAT,QAA6B,WAA7B;AAEA,MAAMC,OAAO,GAAG;AACdC,EAAAA,IAAI,EAAEF,YAAY,CAACG,uBADL;;AAGd;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,OAAO,CAACC,QAAD,EAAWC,SAAX,EAAsB;AAC3B,WAAO,IAAIP,OAAJ,CAAaQ,OAAD,IAAa;AAC9B,WAAKC,QAAL,CAAcC,IAAd,GAAqB;AACnBC,QAAAA,KAAK,EAAEL,QAAQ,CAACM,WADG;AAEnBC,QAAAA,MAAM,EAAEP,QAAQ,CAACQ;AAFE,OAArB;AAKAR,MAAAA,QAAQ,CAACS,kBAAT,CAA4BR,SAA5B;AACAD,MAAAA,QAAQ,CAACU,qBAAT;AACAR,MAAAA,OAAO;AACR,KATM,CAAP;AAUD,GApBa;;AAqBd;AACF;AACA;AACA;AACES,EAAAA,IAAI,CAACX,QAAD,EAAW;AACbA,IAAAA,QAAQ,CAACS,kBAAT,CAA4B,KAAKN,QAAL,CAAcC,IAA1C;AACAJ,IAAAA,QAAQ,CAACU,qBAAT;AAEA,WAAOhB,OAAO,CAACQ,OAAR,EAAP;AACD;;AA9Ba,CAAhB;AAiCAT,cAAc,CAACmB,QAAf,CAAwBhB,OAAxB;AAEA,eAAeA,OAAf","sourcesContent":["/**\r\n * @author NHN Ent. FE Development Team <dl_javascript@nhn.com>\r\n * @fileoverview Resize a canvas\r\n */\r\nimport commandFactory from '../factory/command';\r\nimport { Promise } from '../util';\r\nimport { commandNames } from '../consts';\r\n\r\nconst command = {\r\n  name: commandNames.RESIZE_CANVAS_DIMENSION,\r\n\r\n  /**\r\n   * resize the canvas with given dimension\r\n   * @param {Graphics} graphics - Graphics instance\r\n   * @param {{width: number, height: number}} dimension - Max width & height\r\n   * @returns {Promise}\r\n   */\r\n  execute(graphics, dimension) {\r\n    return new Promise((resolve) => {\r\n      this.undoData.size = {\r\n        width: graphics.cssMaxWidth,\r\n        height: graphics.cssMaxHeight,\r\n      };\r\n\r\n      graphics.setCssMaxDimension(dimension);\r\n      graphics.adjustCanvasDimension();\r\n      resolve();\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.setCssMaxDimension(this.undoData.size);\r\n    graphics.adjustCanvasDimension();\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"}