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

11 lines
2.5 KiB
JavaScript

function asyncGeneratorStep(r,e,t,n,o,a,i){try{var l=r[a](i),u=l.value}catch(r){return void t(r)}l.done?e(u):Promise.resolve(u).then(n,o)}function _slicedToArray(r,e){return function _arrayWithHoles(r){if(Array.isArray(r))return r}(r)||function _iterableToArrayLimit(r,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(r)))return;var t=[],n=!0,o=!1,a=void 0;try{for(var i,l=r[Symbol.iterator]();!(n=(i=l.next()).done)&&(t.push(i.value),!e||t.length!==e);n=!0);}catch(r){o=!0,a=r}finally{try{n||null==l.return||l.return()}finally{if(o)throw a}}return t}(r,e)||function _unsupportedIterableToArray(r,e){if(!r)return;if("string"==typeof r)return _arrayLikeToArray(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);"Object"===t&&r.constructor&&(t=r.constructor.name);if("Map"===t||"Set"===t)return Array.from(r);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _arrayLikeToArray(r,e)}(r,e)||function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}
/**
* @file ext-helloworld.js
*
* @license MIT
*
* @copyright 2010 Alexis Deveria
*
*/()}function _arrayLikeToArray(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}var r={name:"helloworld",init:function init(r){var e=this;return function _asyncToGenerator(r){return function(){var e=this,t=arguments;return new Promise((function(n,o){var a=r.apply(e,t);function _next(r){asyncGeneratorStep(a,n,o,_next,_throw,"next",r)}function _throw(r){asyncGeneratorStep(a,n,o,_next,_throw,"throw",r)}_next(void 0)}))}}(regeneratorRuntime.mark((function _callee(){var t,n,o,a,i;return regeneratorRuntime.wrap((function _callee$(l){for(;;)switch(l.prev=l.next){case 0:return t=r.$,r.importLocale,n=e,l.next=4,import("./locale/".concat(n.curPrefs.lang,".js"));case 4:return o=l.sent,a=o.default,i=n.canvas,l.abrupt("return",{name:a.name,svgicons:"helloworld-icon.xml",buttons:[{id:"hello_world",icon:"helloworld.png",type:"mode",title:a.buttons[0].title,events:{click:function click(){i.setMode("hello_world")}}}],mouseDown:function mouseDown(){if("hello_world"===i.getMode())return{started:!0}},mouseUp:function mouseUp(r){if("hello_world"===i.getMode()){var e=i.getZoom(),n=r.mouse_x/e,o=r.mouse_y/e,l=a.text;[["x",n],["y",o]].forEach((function(r){var e=_slicedToArray(r,2),t=e[0],n=e[1];l=l.replace("{"+t+"}",n)})),t.alert(l)}}});case 8:case"end":return l.stop()}}),_callee)})))()}};export default r;
//# sourceMappingURL=ext-helloworld.js.map