{"version":3,"file":"ext-polystar.js","sources":["../../../../src/editor/extensions/ext-polystar/ext-polystar.js","../../../../src/editor/extensions/ext-polystar/locale/en.js","../../../../src/editor/extensions/ext-polystar/locale/fr.js","../../../../src/editor/extensions/ext-polystar/locale/tr.js","../../../../src/editor/extensions/ext-polystar/locale/zh-CN.js"],"sourcesContent":["/**\n * @file ext-polystar.js\n *\n *\n * @copyright 2010 CloudCanvas, Inc. All rights reserved\n * @copyright 2021 Optimistik SAS, Inc. All rights reserved\n * @license MIT\n *\n */\n\nconst name = 'polystar'\n\nconst loadExtensionTranslation = async function (svgEditor) {\n let translationModule\n const lang = svgEditor.configObj.pref('lang')\n try {\n translationModule = await import(`./locale/${lang}.js`)\n } catch (_error) {\n console.warn(`Missing translation (${lang}) for ${name} - using 'en'`)\n translationModule = await import('./locale/en.js')\n }\n svgEditor.i18next.addResourceBundle(lang, name, translationModule.default)\n}\n\nexport default {\n name,\n async init () {\n const svgEditor = this\n const { svgCanvas } = svgEditor\n const { ChangeElementCommand } = svgCanvas.history\n const addToHistory = (cmd) => { svgCanvas.undoMgr.addCommandToHistory(cmd) }\n const { $id, $click } = svgCanvas\n let selElems\n let started\n let newFO\n await loadExtensionTranslation(svgEditor)\n\n /**\n * @param {boolean} on true=display\n * @param {string} tool \"star\" or \"polygone\"\n * @returns {void}\n */\n const showPanel = (on, tool) => {\n if (on) {\n $id(`${tool}_panel`).style.removeProperty('display')\n } else {\n $id(`${tool}_panel`).style.display = 'none'\n }\n }\n\n /**\n *\n * @param {string} attr attribute to change\n * @param {string|Float} val new value\n * @returns {void}\n */\n const setAttr = (attr, val) => {\n svgCanvas.changeSelectedAttribute(attr, val)\n svgCanvas.call('changed', selElems)\n }\n\n /**\n * @param {Float} n angle\n * @return {Float} cotangeante\n */\n const cot = (n) => 1 / Math.tan(n)\n\n /**\n * @param {Float} n angle\n * @returns {Float} sec\n */\n const sec = (n) => 1 / Math.cos(n)\n\n return {\n name: svgEditor.i18next.t(`${name}:name`),\n // The callback should be used to load the DOM with the appropriate UI items\n callback () {\n // Add the button and its handler(s)\n // Note: the star extension needs to be loaded before the polygon extension\n const fbtitle = `${name}:title`\n const titleStar = `${name}:buttons.0.title`\n const titlePolygon = `${name}:buttons.1.title`\n const buttonTemplate = `\n \n \n \n \n \n \n `\n svgCanvas.insertChildAtIndex($id('tools_left'), buttonTemplate, 10)\n // handler\n $click($id('tool_star'), () => {\n if (this.leftPanel.updateLeftPanel('tool_star')) {\n svgCanvas.setMode('star')\n showPanel(true, 'star')\n showPanel(false, 'polygon')\n }\n })\n $click($id('tool_polygon'), () => {\n if (this.leftPanel.updateLeftPanel('tool_polygon')) {\n svgCanvas.setMode('polygon')\n showPanel(true, 'polygon')\n showPanel(false, 'star')\n }\n })\n const label0 = `${name}:contextTools.0.label`\n const title0 = `${name}:contextTools.0.title`\n const label1 = `${name}:contextTools.1.label`\n const title1 = `${name}:contextTools.1.title`\n const label2 = `${name}:contextTools.2.label`\n const title2 = `${name}:contextTools.2.title`\n const label3 = `${name}:contextTools.3.label`\n const title3 = `${name}:contextTools.3.title`\n // Add the context panel and its handler(s)\n const panelTemplate = document.createElement('template')\n panelTemplate.innerHTML = `\n
\n \n \n \n \n \n \n
\n
\n \n \n
\n `\n // add handlers for the panel\n $id('tools_top').appendChild(panelTemplate.content.cloneNode(true))\n // don't display the panels on start\n showPanel(false, 'star')\n showPanel(false, 'polygon')\n $id('starNumPoints').addEventListener('change', (event) => {\n setAttr('point', event.target.value)\n const orient = 'point'\n const point = event.target.value\n let i = selElems.length\n while (i--) {\n const elem = selElems[i]\n if (elem.hasAttribute('r')) {\n const oldPoint = elem.getAttribute('point')\n const oldPoints = elem.getAttribute('points')\n const radialshift = elem.getAttribute('radialshift')\n let xpos = 0\n let ypos = 0\n if (elem.points) {\n const list = elem.points\n const len = list.numberOfItems\n for (let i = 0; i < len; ++i) {\n const pt = list.getItem(i)\n xpos += parseFloat(pt.x)\n ypos += parseFloat(pt.y)\n }\n const cx = xpos / len\n const cy = ypos / len\n const circumradius = Number(elem.getAttribute('r'))\n const inradius = circumradius / elem.getAttribute('starRadiusMultiplier')\n\n let polyPoints = ''\n for (let s = 0; point >= s; s++) {\n let angle = 2.0 * Math.PI * (s / point)\n if (orient === 'point') {\n angle -= Math.PI / 2\n } else if (orient === 'edge') {\n angle = angle + Math.PI / point - Math.PI / 2\n }\n\n let x = circumradius * Math.cos(angle) + cx\n let y = circumradius * Math.sin(angle) + cy\n\n polyPoints += x + ',' + y + ' '\n\n if (!isNaN(inradius)) {\n angle = 2.0 * Math.PI * (s / point) + Math.PI / point\n if (orient === 'point') {\n angle -= Math.PI / 2\n } else if (orient === 'edge') {\n angle = angle + Math.PI / point - Math.PI / 2\n }\n angle += radialshift\n\n x = inradius * Math.cos(angle) + cx\n y = inradius * Math.sin(angle) + cy\n\n polyPoints += x + ',' + y + ' '\n }\n }\n elem.setAttribute('points', polyPoints)\n addToHistory(new ChangeElementCommand(elem, { point: oldPoint, points: oldPoints }))\n }\n }\n }\n })\n $id('RadiusMultiplier').addEventListener('change', (event) => {\n setAttr('starRadiusMultiplier', event.target.value)\n })\n $id('radialShift').addEventListener('change', (event) => {\n setAttr('radialshift', event.target.value)\n })\n $id('polySides').addEventListener('change', (event) => {\n setAttr('sides', event.target.value)\n const sides = event.target.value\n let i = selElems.length\n while (i--) {\n const elem = selElems[i]\n if (elem.hasAttribute('edge')) {\n const oldSides = elem.getAttribute('sides')\n const oldPoints = elem.getAttribute('points')\n let xpos = 0\n let ypos = 0\n if (elem.points) {\n const list = elem.points\n const len = list.numberOfItems\n for (let i = 0; i < len; ++i) {\n const pt = list.getItem(i)\n xpos += parseFloat(pt.x)\n ypos += parseFloat(pt.y)\n }\n const cx = xpos / len\n const cy = ypos / len\n const edg = elem.getAttribute('edge')\n const inradius = (edg / 2) * cot(Math.PI / sides)\n const circumradius = inradius * sec(Math.PI / sides)\n let points = ''\n for (let s = 0; sides >= s; s++) {\n const angle = (2.0 * Math.PI * s) / sides\n const x = circumradius * Math.cos(angle) + cx\n const y = circumradius * Math.sin(angle) + cy\n points += x + ',' + y + ' '\n }\n elem.setAttribute('points', points)\n addToHistory(new ChangeElementCommand(elem, { sides: oldSides, points: oldPoints }))\n }\n }\n }\n })\n },\n mouseDown (opts) {\n if (svgCanvas.getMode() === 'star') {\n const fill = svgCanvas.getColor('fill')\n const stroke = svgCanvas.getColor('stroke')\n const strokeWidth = svgCanvas.getStrokeWidth()\n started = true\n newFO = svgCanvas.addSVGElementsFromJson({\n element: 'polygon',\n attr: {\n cx: opts.start_x,\n cy: opts.start_y,\n id: svgCanvas.getNextId(),\n shape: 'star',\n point: $id('starNumPoints').value,\n r: 0,\n radialshift: $id('radialShift').value,\n r2: 0,\n orient: 'point',\n fill,\n stroke,\n 'stroke-width': strokeWidth\n }\n })\n return {\n started: true\n }\n }\n if (svgCanvas.getMode() === 'polygon') {\n const fill = svgCanvas.getColor('fill')\n const stroke = svgCanvas.getColor('stroke')\n const strokeWidth = svgCanvas.getStrokeWidth()\n started = true\n newFO = svgCanvas.addSVGElementsFromJson({\n element: 'polygon',\n attr: {\n cx: opts.start_x,\n cy: opts.start_y,\n id: svgCanvas.getNextId(),\n shape: 'regularPoly',\n sides: $id('polySides').value,\n orient: 'x',\n edge: 0,\n fill,\n stroke,\n 'stroke-width': strokeWidth\n }\n })\n\n return {\n started: true\n }\n }\n return undefined\n },\n mouseMove (opts) {\n if (!started) {\n return undefined\n }\n if (svgCanvas.getMode() === 'star') {\n const cx = Number(newFO.getAttribute('cx'))\n const cy = Number(newFO.getAttribute('cy'))\n const point = Number(newFO.getAttribute('point'))\n const orient = newFO.getAttribute('orient')\n const fill = newFO.getAttribute('fill')\n const stroke = newFO.getAttribute('stroke')\n const strokeWidth = Number(newFO.getAttribute('stroke-width'))\n const radialshift = Number(newFO.getAttribute('radialshift'))\n\n let x = opts.mouse_x\n let y = opts.mouse_y\n\n const circumradius =\n Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)) / 1.5\n const RadiusMultiplier = document.getElementById('RadiusMultiplier').value\n const inradius =\n circumradius / RadiusMultiplier\n newFO.setAttribute('r', circumradius)\n newFO.setAttribute('r2', inradius)\n newFO.setAttribute('starRadiusMultiplier', RadiusMultiplier)\n\n let polyPoints = ''\n for (let s = 0; point >= s; s++) {\n let angle = 2.0 * Math.PI * (s / point)\n if (orient === 'point') {\n angle -= Math.PI / 2\n } else if (orient === 'edge') {\n angle = angle + Math.PI / point - Math.PI / 2\n }\n\n x = circumradius * Math.cos(angle) + cx\n y = circumradius * Math.sin(angle) + cy\n\n polyPoints += x + ',' + y + ' '\n\n if (!isNaN(inradius)) {\n angle = 2.0 * Math.PI * (s / point) + Math.PI / point\n if (orient === 'point') {\n angle -= Math.PI / 2\n } else if (orient === 'edge') {\n angle = angle + Math.PI / point - Math.PI / 2\n }\n angle += radialshift\n\n x = inradius * Math.cos(angle) + cx\n y = inradius * Math.sin(angle) + cy\n\n polyPoints += x + ',' + y + ' '\n }\n }\n newFO.setAttribute('points', polyPoints)\n newFO.setAttribute('fill', fill)\n newFO.setAttribute('stroke', stroke)\n newFO.setAttribute('stroke-width', strokeWidth)\n /* const shape = */ newFO.getAttribute('shape')\n\n return {\n started: true\n }\n }\n if (svgCanvas.getMode() === 'polygon') {\n const cx = Number(newFO.getAttribute('cx'))\n const cy = Number(newFO.getAttribute('cy'))\n const sides = Number(newFO.getAttribute('sides'))\n // const orient = newFO.getAttribute('orient');\n const fill = newFO.getAttribute('fill')\n const stroke = newFO.getAttribute('stroke')\n const strokeWidth = Number(newFO.getAttribute('stroke-width'))\n\n let x = opts.mouse_x\n let y = opts.mouse_y\n\n const edg =\n Math.sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)) / 1.5\n newFO.setAttribute('edge', edg)\n\n const inradius = (edg / 2) * cot(Math.PI / sides)\n const circumradius = inradius * sec(Math.PI / sides)\n let points = ''\n for (let s = 0; sides >= s; s++) {\n const angle = (2.0 * Math.PI * s) / sides\n x = circumradius * Math.cos(angle) + cx\n y = circumradius * Math.sin(angle) + cy\n\n points += x + ',' + y + ' '\n }\n\n // const poly = newFO.createElementNS(NS.SVG, 'polygon');\n newFO.setAttribute('points', points)\n newFO.setAttribute('fill', fill)\n newFO.setAttribute('stroke', stroke)\n newFO.setAttribute('stroke-width', strokeWidth)\n return {\n started: true\n }\n }\n return undefined\n },\n mouseUp () {\n if (svgCanvas.getMode() === 'star') {\n const r = newFO.getAttribute('r')\n return {\n keep: r !== '0',\n element: newFO\n }\n }\n if (svgCanvas.getMode() === 'polygon') {\n const edge = newFO.getAttribute('edge')\n const keep = edge !== '0'\n // svgCanvas.addToSelection([newFO], true);\n return {\n keep,\n element: newFO\n }\n }\n return undefined\n },\n selectedChanged (opts) {\n // Use this to update the current selected elements\n selElems = opts.elems\n let i = selElems.length\n // Hide panels if nothing is selected\n if (!i) {\n showPanel(false, 'star')\n showPanel(false, 'polygon')\n return\n }\n while (i--) {\n const elem = selElems[i]\n if (elem?.getAttribute('shape') === 'star') {\n if (opts.selectedElement && !opts.multiselected) {\n $id('starNumPoints').value = elem.getAttribute('point')\n $id('radialShift').value = elem.getAttribute('radialshift')\n showPanel(true, 'star')\n } else {\n showPanel(false, 'star')\n }\n } else if (elem?.getAttribute('shape') === 'regularPoly') {\n if (opts.selectedElement && !opts.multiselected) {\n $id('polySides').value = elem.getAttribute('sides')\n showPanel(true, 'polygon')\n } else {\n showPanel(false, 'polygon')\n }\n } else {\n showPanel(false, 'star')\n showPanel(false, 'polygon')\n }\n }\n }\n }\n }\n}\n","export default {\n name: 'star',\n title: 'Polygone/Star Tool',\n buttons: [\n {\n title: 'Star Tool'\n },\n {\n title: 'Polygon Tool'\n }\n ],\n contextTools: [\n {\n title: 'Number of Sides',\n label: 'points'\n },\n {\n title: 'Pointiness',\n label: 'Pointiness'\n },\n {\n title: 'Twists the star',\n label: 'Radial Shift'\n },\n {\n title: 'Number of Sides',\n label: 'sides'\n }\n ]\n}\n","export default {\n name: 'etoile',\n title: 'Outil Polygone/Etoile',\n buttons: [\n {\n title: 'Outil Etoile'\n },\n {\n title: 'Outil Polygone'\n }\n ],\n contextTools: [\n {\n title: 'Nombre de côtés',\n label: 'points'\n },\n {\n title: 'Précision',\n label: 'Précision'\n },\n {\n title: 'Torsion Etoile',\n label: 'Décalage Radial'\n },\n {\n title: 'Nombre de côtés',\n label: 'côtés'\n }\n ]\n}\n","export default {\n name: 'yıldız',\n title: 'Çokgen/Yıldız Aracı',\n buttons: [\n {\n title: 'Yıldız Aracı'\n },\n {\n title: 'Çokgen Aracı'\n }\n ],\n contextTools: [\n {\n title: 'Kenar Sayısı',\n label: 'noktalar'\n },\n {\n title: 'Sivrilik',\n label: 'Sivrilik'\n },\n {\n title: 'Yıldızı Kıvır',\n label: 'Döngüsel Kaydırma'\n },\n {\n title: 'Kenar Sayısı',\n label: 'kenarlar'\n }\n ]\n}\n","export default {\n name: '星形',\n title: 'Polygone/Star Tool',\n buttons: [\n {\n title: '星形工具'\n },\n {\n title: '多边形工具'\n }\n ],\n contextTools: [\n {\n title: '顶点',\n label: '顶点'\n },\n {\n title: '钝度',\n label: '钝度'\n },\n {\n title: '径向',\n label: '径向'\n },\n {\n title: '边数',\n label: '边数'\n }\n ]\n}\n"],"names":["name","loadExtensionTranslation","async","svgEditor","translationModule","lang","configObj","pref","__variableDynamicImportRuntime0__","concat","_error","console","warn","Promise","resolve","then","en$1","i18next","addResourceBundle","default","extPolystar","this","svgCanvas","ChangeElementCommand","history","addToHistory","cmd","undoMgr","addCommandToHistory","$id","$click","selElems","started","newFO","showPanel","on","tool","style","removeProperty","display","setAttr","attr","val","changeSelectedAttribute","call","cot","n","Math","tan","sec","cos","t","callback","fbtitle","titleStar","titlePolygon","buttonTemplate","insertChildAtIndex","leftPanel","updateLeftPanel","setMode","label0","title0","label1","title1","label2","title2","label3","title3","panelTemplate","document","createElement","innerHTML","appendChild","content","cloneNode","addEventListener","event","target","value","point","i","length","elem","hasAttribute","oldPoint","getAttribute","oldPoints","radialshift","xpos","ypos","points","list","len","numberOfItems","pt","getItem","parseFloat","x","y","cx","cy","circumradius","Number","inradius","polyPoints","s","angle","PI","sin","isNaN","setAttribute","sides","oldSides","mouseDown","opts","getMode","fill","getColor","stroke","strokeWidth","getStrokeWidth","addSVGElementsFromJson","element","start_x","start_y","id","getNextId","shape","r","r2","orient","edge","mouseMove","mouse_x","mouse_y","sqrt","RadiusMultiplier","getElementById","edg","mouseUp","keep","selectedChanged","elems","selectedElement","multiselected","title","buttons","contextTools","label"],"mappings":";;;;;;;;;AAUA,MAAMA,EAAO,WAEPC,yBAA2BC,eAAgBC,GAC/C,IAAIC,EACJ,MAAMC,EAAOF,EAAUG,UAAUC,KAAK,QACtC,IACEH,0hBAA0BI,CAAM,YAAAC,OAAaJ,EAA7C,QACA,MAAOK,GACPC,QAAQC,KAA6BP,wBAAAA,OAAAA,mBAAaL,EAAlD,kBACAI,QAA0BS,QAAAC,UAAAC,MAAA,WAAA,OAAAC,KAE5Bb,EAAUc,QAAQC,kBAAkBb,EAAML,EAAMI,EAAkBe,UAGpE,IAAeC,EAAA,CACbpB,KAAAA,EACAE,aACE,MAAMC,EAAYkB,MACZC,UAAEA,GAAcnB,GAChBoB,qBAAEA,GAAyBD,EAAUE,QACrCC,aAAgBC,IAAUJ,EAAUK,QAAQC,oBAAoBF,KAChEG,IAAEA,EAAFC,OAAOA,GAAWR,EACxB,IAAIS,EACAC,EACAC,QACEhC,yBAAyBE,GAO/B,MAAM+B,UAAY,CAACC,EAAIC,KACjBD,EACFN,EAAG,GAAApB,OAAI2B,EAAP,WAAqBC,MAAMC,eAAe,WAE1CT,EAAG,GAAApB,OAAI2B,EAAP,WAAqBC,MAAME,QAAU,QAUnCC,QAAU,CAACC,EAAMC,KACrBpB,EAAUqB,wBAAwBF,EAAMC,GACxCpB,EAAUsB,KAAK,UAAWb,IAOtBc,IAAOC,GAAM,EAAIC,KAAKC,IAAIF,GAM1BG,IAAOH,GAAM,EAAIC,KAAKG,IAAIJ,GAEhC,MAAO,CAC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