svgedit/dist/editor/system/extensions/ext-shapes/ext-shapes.js

10 lines
15 KiB
JavaScript
Raw Normal View History

2020-09-06 06:32:10 +00:00
System.register([],(function(t,e){"use strict";return{execute:function(){function asyncGeneratorStep(t,e,l,n,r,a,o){try{var c=t[a](o),i=c.value}catch(t){return void l(t)}c.done?e(i):Promise.resolve(i).then(n,r)}function _slicedToArray(t,e){return function _arrayWithHoles(t){if(Array.isArray(t))return t}(t)||function _iterableToArrayLimit(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var l=[],n=!0,r=!1,a=void 0;try{for(var o,c=t[Symbol.iterator]();!(n=(o=c.next()).done)&&(l.push(o.value),!e||l.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{n||null==c.return||c.return()}finally{if(r)throw a}}return l}(t,e)||function _unsupportedIterableToArray(t,e){if(!t)return;if("string"==typeof t)return _arrayLikeToArray(t,e);var l=Object.prototype.toString.call(t).slice(8,-1);"Object"===l&&t.constructor&&(l=t.constructor.name);if("Map"===l||"Set"===l)return Array.from(t);if("Arguments"===l||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l))return _arrayLikeToArray(t,e)}(t,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-shapes.js
*
* @license MIT
*
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
*
*/()}function _arrayLikeToArray(t,e){(null==e||e>t.length)&&(e=t.length);for(var l=0,n=new Array(e);l<e;l++)n[l]=t[l];return n}t("default",{name:"shapes",init:function init(t){var l=this;return function _asyncToGenerator(t){return function(){var e=this,l=arguments;return new Promise((function(n,r){var a=t.apply(e,l);function _next(t){asyncGeneratorStep(a,n,r,_next,_throw,"next",t)}function _throw(t){asyncGeneratorStep(a,n,r,_next,_throw,"throw",t)}_next(void 0)}))}}(regeneratorRuntime.mark((function _callee(){var n,r,a,o,c,i,s,u,m,d,p,h,f,v,g,_,b,y,z,x,w;return regeneratorRuntime.wrap((function _callee$(A){for(;;)switch(A.prev=A.next){case 0:return x=function _loadLibrary(t){var e=m[t];if(!e)return n("#shape_buttons").html(o.loading),void n.getJSON("./shapelib/"+t+".json",(function(e){b=m[t]={data:e.data,size:e.size,fill:e.fill},z(t,e),y()}));b=e,e.buttons.length||z(t,e),y()},z=function _makeButtons(t,e){var l=b.size||300,r=b.fill||!1,a=.05*l,o=[-a,-a,l+2*a,l+2*a].join(" "),c=r?0:l/30,i=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+o+'"><path fill="'+(r?"#333":"none")+'" stroke="#000" stroke-width="'+c+'" /></svg></svg>',"text/xml");i.documentElement.setAttribute("width",24),i.documentElement.setAttribute("height",24);var s=n(document.importNode(i.documentElement,!0)),u=e.data;b.buttons=Object.entries(u).map((function(t){var e=_slicedToArray(t,2),l=e[0],n=e[1],r=s.clone();return r.find("path").attr("d",n),r.wrap('<div class="tool_button">').parent().attr({id:d+"_"+l,title:l})[0]}))},y=function _loadIcons(){n("#shape_buttons").empty().append(b.buttons)},n=t.$,r=l,A.next=7,e.import("./locale/".concat(r.curPrefs.lang,".js"));case 7:return a=A.sent,o=a.default,c=r.canvas,i=c.getRootElem(),s={},u=o.categories,d="shapelib",p={},b=(m={basic:{data:{heart:"m150,73c61,-175 300,0 0,225c-300,-225 -61,-400 0,-225z",frame:"m0,0l300,0l0,300l-300,0zm35,-265l0,230l230,0l0,-230z",donut:"m1,150l0,0c0,-82.29042 66.70958,-149 149,-149l0,0c39.51724,0 77.41599,15.69816 105.35889,43.64108c27.94293,27.94293 43.64111,65.84165 43.64111,105.35892l0,0c0,82.29041 -66.70958,149 -149,149l0,0c-82.29041,0 -149,-66.70959 -149,-149zm74.5,0l0,0c0,41.1452 33.35481,74.5 74.5,74.5c41.14522,0 74.5,-33.3548 74.5,-74.5c0,-41.1452 -33.3548,-74.5 -74.5,-74.5l0,0c-41.14519,0 -74.5,33.35481 -74.5,74.5z",triangle:"m1,280.375l149,-260.75l149,260.75z",right_triangle:"m1,299l0,-298l298,298z",diamond:"m1,150l149,-149l149,149l-149,149l-149,-149z",pentagon:"m1.00035,116.97758l148.99963,-108.4053l148.99998,108.4053l-56.91267,175.4042l-184.1741,0l-56.91284,-175.4042z",hexagon:"m1,149.99944l63.85715,-127.71428l170.28572,0l63.85713,127.71428l-63.85713,127.71428l-170.28572,0l-63.85715,-127.71428z",septagon1:"m0.99917,191.06511l29.51249,-127.7108l119.48833,-56.83673l119.48836,56.83673l29.51303,127.7108l-82.69087,102.41679l-132.62103,0l-82.69031,-102.41679z",heptagon:"m1,88.28171l87.28172,-87.28171l123.43653,0l87.28172,87.28171l0,123.43654l-87.28172,87.28172l-123.43653,0l-87.28172,-87.28172l0,-123.43654z",decagon:"m1,150.00093l28.45646,-88.40318l74.49956,-54.63682l92.08794,0l74.50002,54.63682l28.45599,88.40318l-28.45599,88.40318l-74.50002,54.63681l-92.08794,0l-74.49956,-54.63681l-28.45646,-88.40318z",dodecagon:"m1,110.07421l39.92579,-69.14842l69.14842,-39.92579l79.85159,0l69.14842,39.92579l39.92578,69.14842l0,79.85159l-39.92578,69.14842l-69.14842,39.92578l-79.85159,0l-69.14842,-39.92578l-39.92579,-69.14842l0,-79.85159z",star_points_5:"m1,116.58409l113.82668,0l35.17332,-108.13487l35.17334,108.13487l113.82666,0l-92.08755,66.83026l35.17514,108.13487l-92.08759,-66.83208l-92.08757,66.83208l35.17515,-108.13487l-92.08758,-66.83026z",trapezoid:"m1,299l55.875,-298l186.25001,0l55.87498,298z",arrow_up:"m1.49805,149.64304l148.50121,-148.00241l148.50121,148.00241l-74.25061,0l0,148.71457l-148.5012,0l0,-148.71457z",vertical_scrool:"m37.375,261.625l0,-242.9375l0,0c0,-10.32083 8.36669,-18.6875 18.6875,-18.6875l224.25,0c10.32083,0 18.6875,8.36667 18.6875,18.6875c0,10.32081 -8.36667,18.6875 -18.6875,18.6875l-18.6875,0l0,242.9375c0,10.32083 -8.36668,