Commit fe660b18 authored by Romain Courteaud's avatar Romain Courteaud

erp5_svg_editor: add draft svg shapes

parent 03603be6
......@@ -21,6 +21,7 @@ methodDraw.addExtension("shapes", function() {
// This populates the category list
var categories = {
basic: 'Basic',
nexedi: 'Nexedi Shapes',
object: 'Objects',
symbol: 'Symbols',
arrow: 'Arrows',
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>anonymous_http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>nexedi.json</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>application/octet-stream</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -733,7 +733,7 @@ w.beginPath();w.globalAlpha=0.5;w.moveTo(0.5,C);w.lineTo(0.5,0);w.moveTo(C,0.5);
"g");a(c,{id:"canvasGrid",width:"100%",height:"100%",x:0,y:0,overflow:"visible",display:"none"});var g=$("#canvas_background");g.after(c);c=e.createElementNS("http://www.w3.org/2000/svg","pattern");a(c,{id:"gridpattern",patternUnits:"userSpaceOnUse",x:0,y:0,width:100,height:100});var d=e.createElementNS("http://www.w3.org/2000/svg","image");a(d,{x:0,y:0,width:100,height:100});c.appendChild(d);$("#svgroot defs").append(c);e=e.createElementNS("http://www.w3.org/2000/svg","rect");a(e,{width:"100%",height:"100%",
x:0,y:0,"stroke-width":0,stroke:"none",fill:"url(#gridpattern)",style:"pointer-events: none; display:visible;"});$("#canvasGrid").append(e)}return{name:"view_grid",zoomChanged:function(p){l&&o(p)},buttons:[{id:"view_grid",type:"menu",after:"tool_wireframe",panel:"view_menu",title:"View Grid",events:{click:function(){if($("#view_grid").hasClass("push_button_pressed")){methodDraw.curConfig.showGrid=l=false;$("#view_grid").removeClass("push_button_pressed");$("#canvasGrid").attr("display","none")}else{methodDraw.curConfig.showGrid=
l=true;$("#view_grid").addClass("push_button_pressed");$("#canvasGrid").attr("display","inline");o(b.getZoom())}}}}]}});methodDraw.addExtension("shapes",function(){function a(){$("#shape_buttons").empty();$("#shape_buttons").append(L.buttons)}function o(J){var H=v[J];if(H){L=H;H.buttons.length||e(J,H);a()}else{$("#shape_buttons").html("Loading...");$.getJSON("extensions/shapelib/"+J+".json",function(U){L=v[J]={data:U.data,size:U.size,fill:U.fill};e(J,U);a()})}}function e(J,H){var U=L.size||300,R=L.fill||false,N=U*0.05;N=[-N,-N,U+N*2,U+N*2].join(" ");U=R?0:U/30;U=(new DOMParser).parseFromString('<svg xmlns="http://www.w3.org/2000/svg"><svg viewBox="'+
N+'"><path fill="#333" stroke="transparent" stroke-width="'+U+'" /></svg></svg>',"text/xml");U.documentElement.setAttribute("width",40);U.documentElement.setAttribute("height",40);U=$(document.importNode(U.documentElement,true));R=H.data;L.buttons=[];for(var ca in R){N=R[ca];var la=U.clone();la.find("path").attr("d",N);N=la.wrap('<div class="tool_button">').parent().attr({id:Q+"_"+ca,title:ca});L.buttons.push(N[0])}}var b,l,s=methodDraw.canvas,c,g,d,p=s.getRootElem(),w={},C={basic:"Basic",object:"Objects",
N+'"><path fill="#333" stroke="transparent" stroke-width="'+U+'" /></svg></svg>',"text/xml");U.documentElement.setAttribute("width",40);U.documentElement.setAttribute("height",40);U=$(document.importNode(U.documentElement,true));R=H.data;L.buttons=[];for(var ca in R){N=R[ca];var la=U.clone();la.find("path").attr("d",N);N=la.wrap('<div class="tool_button">').parent().attr({id:Q+"_"+ca,title:ca});L.buttons.push(N[0])}}var b,l,s=methodDraw.canvas,c,g,d,p=s.getRootElem(),w={},C={basic:"Basic",nexedi:"Nexedi Shapes",object:"Objects",
symbol:"Symbols",arrow:"Arrows",flowchart:"Flowchart",nature:"Nature",game:"Cards & Chess",dialog_balloon:"Dialog balloons",music:"Music",weather:"Weather &amp; Time",ui:"User Interface",social:"Social Web"},v={basic:{data:{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",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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment