svgedit/dist/editor/extensions/ext-panning.js

12 lines
2.4 KiB
JavaScript

function _AwaitValue(e){this.wrapped=e}function _AsyncGenerator(e){var n,t;function resume(n,t){try{var r=e[n](t),o=r.value,a=o instanceof _AwaitValue;Promise.resolve(a?o.wrapped:o).then((function(e){a?resume("return"===n?"return":"next",e):settle(r.done?"return":"normal",e)}),(function(e){resume("throw",e)}))}catch(e){settle("throw",e)}}function settle(e,r){switch(e){case"return":n.resolve({value:r,done:!0});break;case"throw":n.reject(r);break;default:n.resolve({value:r,done:!1})}(n=n.next)?resume(n.key,n.arg):t=null}this._invoke=function send(e,r){return new Promise((function(o,a){var u={key:e,arg:r,resolve:o,reject:a,next:null};t?t=t.next=u:(n=t=u,resume(e,r))}))},"function"!=typeof e.return&&(this.return=void 0)}function asyncGeneratorStep(e,n,t,r,o,a,u){try{var i=e[a](u),c=i.value}catch(e){return void t(e)}i.done?n(c):Promise.resolve(c).then(r,o)}"function"==typeof Symbol&&Symbol.asyncIterator&&(_AsyncGenerator.prototype[Symbol.asyncIterator]=function(){return this}),_AsyncGenerator.prototype.next=function(e){return this._invoke("next",e)},_AsyncGenerator.prototype.throw=function(e){return this._invoke("throw",e)},_AsyncGenerator.prototype.return=function(e){return this._invoke("return",e)};
/**
* @file ext-panning.js
*
* @license MIT
*
* @copyright 2013 Luis Aguirre
*
*/
var e={name:"panning",init:function init(e){var n=this;return function _asyncToGenerator(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var a=e.apply(n,t);function _next(e){asyncGeneratorStep(a,r,o,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(a,r,o,_next,_throw,"throw",e)}_next(void 0)}))}}(regeneratorRuntime.mark((function _callee(){var t,r,o,a,u;return regeneratorRuntime.wrap((function _callee$(i){for(;;)switch(i.prev=i.next){case 0:return t=e.importLocale,i.next=3,t();case 3:return r=i.sent,a=(o=n).canvas,u=[{id:"ext-panning",icon:"panning.png",type:"mode",events:{click:function click(){a.setMode("ext-panning")}}}],i.abrupt("return",{name:r.name,svgicons:"ext-panning.xml",buttons:r.buttons.map((function(e,n){return Object.assign(u[n],e)})),mouseDown:function mouseDown(){if("ext-panning"===a.getMode())return o.setPanning(!0),{started:!0}},mouseUp:function mouseUp(){if("ext-panning"===a.getMode())return o.setPanning(!1),{keep:!1,element:null}}});case 8:case"end":return i.stop()}}),_callee)})))()}};export default e;
//# sourceMappingURL=ext-panning.js.map