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

10 lines
58 KiB
JavaScript
Raw Normal View History

System.register([],(function(t){"use strict";return{execute:function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function commonjsRequire(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var check=function(t){return t&&t.Math==Math&&t},r=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof e&&e)||Function("return this")(),fails=function(t){try{return!!t()}catch(t){return!0}},n=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),o={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,a={f:i&&!o.call({1:2},1)?function propertyIsEnumerable(t){var e=i(this,t);return!!e&&e.enumerable}:o},createPropertyDescriptor=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},c={}.toString,classofRaw=function(t){return c.call(t).slice(8,-1)},l="".split,u=fails((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==classofRaw(t)?l.call(t,""):Object(t)}:Object,requireObjectCoercible=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},toIndexedObject=function(t){return u(requireObjectCoercible(t))},isObject=function(t){return"object"==typeof t?null!==t:"function"==typeof t},toPrimitive=function(t,e){if(!isObject(t))return t;var r,n;if(e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;if("function"==typeof(r=t.valueOf)&&!isObject(n=r.call(t)))return n;if(!e&&"function"==typeof(r=t.toString)&&!isObject(n=r.call(t)))return n;throw TypeError("Can't convert object to primitive value")},s={}.hasOwnProperty,has=function(t,e){return s.call(t,e)},f=r.document,p=isObject(f)&&isObject(f.createElement),documentCreateElement=function(t){return p?f.createElement(t):{}},h=!n&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),y=Object.getOwnPropertyDescriptor,d={f:n?y:function getOwnPropertyDescriptor(t,e){if(t=toIndexedObject(t),e=toPrimitive(e,!0),h)try{return y(t,e)}catch(t){}if(has(t,e))return createPropertyDescriptor(!a.f.call(t,e),t[e])}},anObject=function(t){if(!isObject(t))throw TypeError(String(t)+" is not an object");return t},v=Object.defineProperty,m={f:n?v:function defineProperty(t,e,r){if(anObject(t),e=toPrimitive(e,!0),anObject(r),h)try{return v(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[e]=r.value),t}},g=n?function(t,e,r){return m.f(t,e,createPropertyDescriptor(1,r))}:function(t,e,r){return t[e]=r,t},setGlobal=function(t,e){try{g(r,t,e)}catch(n){r[t]=e}return e},b="__core-js_shared__",w=r[b]||setGlobal(b,{}),S=Function.toString;"function"!=typeof w.inspectSource&&(w.inspectSource=function(t){return S.call(t)});var _,j,O,x=w.inspectSource,E=r.WeakMap,A="function"==typeof E&&/native code/.test(x(E)),P=createCommonjsModule((function(t){(t.exports=function(t,e){return w[t]||(w[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})})),T=0,k=Math.random(),uid=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++T+k).toString(36)},L=P("keys"),sharedKey=function(t){return L[t]||(L[t]=uid(t))},M={},I=r.WeakMap;if(A){var C=new I,G=C.get,z=C.has,N=C.set;_=function(t,e){return N.call(C,t,e),e},j=function(t){return G.call(C,t)||{}},O=function(t){return z.call(C,t)}}else{var R=sharedKey("state");M[R]=!0,_=function(t,e){return g(t,R,e),e},j=function(t){return has(t,R)?t[R]:{}},O=function(t){return has(t,R)}}var D,B={set:_,get:j,has:O,enforce:function(t){return O(t)?j(t):_(t,{})},getterFor:function(t){return function(e){var r;if(!isObject(e)||(r=j(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}},q=cr
2020-09-10 06:24:38 +00:00
/**
2020-09-11 23:27:47 +00:00
* @file ext-shapes.js
*
2020-09-10 06:24:38 +00:00
* @license MIT
*
2020-09-11 23:27:47 +00:00
* @copyright 2010 Christian Tzurcanu, 2010 Alexis Deveria
2020-09-10 06:24:38 +00:00
*
*/var bo=function(){var t=_asyncToGenerator(regeneratorRuntime.mark((function _callee(t){var e;return regeneratorRuntime.wrap((function _callee$(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,__variableDynamicImportRuntime0__("./locale/".concat(t,".js"));case 3:e=r.sent,r.next=12;break;case 6:return r.prev=6,r.t0=r.catch(0),console.error("Missing translation (".concat(t,") - using 'en'")),r.next=11,Promise.resolve().then((function(){return wo}));case 11:e=r.sent;case 12:return r.abrupt("return",e.default);case 13:case"end":return r.stop()}}),_callee,null,[[0,6]])})));return function loadExtensionTranslation(e){return t.apply(this,arguments)}}(),wo=(t("default",{name:"shapes",init:function init(t){var e=this;return _asyncToGenerator(regeneratorRuntime.mark((function _callee2(){var r,n,o,i,a,c,l,u,s,f,p,h,y,d,v,m,g,b,w,S;return regeneratorRuntime.wrap((function _callee2$(_){for(;;)switch(_.prev=_.next){case 0:return w=function _loadLibrary(t){var e=u[t];if(!e)return r("#shape_buttons").html(o.loading),void r.getJSON("./shapelib/"+t+".json",(function(e){m=u[t]={data:e.data,size:e.size,fill:e.fill},b(t,e),g()}));m=e,e.buttons.length||b(t,e),g()},b=function _makeButtons(t,e){var n=m.size||300,o=m.fill||!1,i=.05*n,a=[-i,-i,n+2*i,n+2*i].join(" "),c=o?0:n/30,l=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+a+'"><path fill="'+(o?"#333":"none")+'" stroke="#000" stroke-width="'+c+'" /></svg></svg>',"text/xml");l.documentElement.setAttribute("width",24),l.documentElement.setAttribute("height",24);var u=r(document.importNode(l.documentElement,!0)),f=e.data;m.buttons=Object.entries(f).map((function(t){var e=_slicedToArray(t,2),r=e[0],n=e[1],o=u.clone();return o.find("path").attr("d",n),o.wrap('<div class="tool_button">').parent().attr({id:s+"_"+r,title:r})[0]}))},g=function _loadIcons(){r("#shape_buttons").empty().append(m.buttons)},r=t.$,n=e,_.next=7,bo(n.curPrefs.lang);case 7:return o=_.sent,i=n.canvas,a=i.getRootElem(),c={},l=o.categories,s="shapelib",f={},m=(u={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.7