Develop and Download Open Source Software

Browse Subversion Repository

Diff of /SvgEditor.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 38 by isao-hara, Mon Jul 26 06:22:24 2010 UTC revision 39 by isao-hara, Mon Jul 26 06:34:27 2010 UTC
# Line 970  function updateSVGObjMenu(){ Line 970  function updateSVGObjMenu(){
970       if(selectedItems[0]){       if(selectedItems[0]){
971         res += setSVGObjectProp(selectedItems[0]);         res += setSVGObjectProp(selectedItems[0]);
972       }else{       }else{
973         res += propSVGObj(tag+":", svg_line_width, svg_color, svg_fill_color, 0);         res += propSVGObj(tag+":", svg_line_width, svg_color, svg_fill_color, "",  0);
974       }       }
975       break;       break;
976      case 'image':      case 'image':
# Line 1002  function propSVGText(str, size, color, r Line 1002  function propSVGText(str, size, color, r
1002    return res;    return res;
1003  }  }
1004    
1005  function propSVGObj(type, stroke, color, fill, rot){  function propSVGObj(type, stroke, color, fill, style, rot){
1006    var res = type;    var res = type;
1007    if(!stroke) stroke = 1;    if(!stroke) stroke = 1;
1008    if(!color) color = '#000000';    if(!color) color = '#000000';
1009    if(!fill) fill = '#ffffff';    if(!fill) fill = '#ffffff';
1010    if(!rot) rot = 0;    if(!rot) rot = 0;
1011    
1012    res += "<input type=\"hidden\" id=\"svg_fill\" value=\""+fill+"\" size=\"8\"/>";    res += "<input type=\"hidden\" id=\"svg_fill\" value=\""+fill+"\" size=\"8\"/>";
1013    res += "<input type=\"hidden\" id=\"svg_color\" value=\""+color+"\" size=\"8\"/>";    res += "<input type=\"hidden\" id=\"svg_color\" value=\""+color+"\" size=\"8\"/>";
1014    res += "Width:<input type=\"text\" id=\"svg_stroke\" onChange=\"updateSVGObj();\" value=\""+stroke+"\" size=\"2\"/>";    res += "Width:<input type=\"text\" id=\"svg_stroke\" onChange=\"updateSVGObj();\" value=\""+stroke+"\" size=\"2\"/>";
1015    res += "Rot:<input type=\"text\" id=\"svg_rotate\" onChange=\"updateSVGObj();\" value=\""+rot+"\" size=\"4\"/>";    res += "Rot:<input type=\"text\" id=\"svg_rotate\" onChange=\"updateSVGObj();\" value=\""+rot+"\" size=\"4\"/>";
1016    
1017      if(style==null) style="";
1018      res += "Type:<input type=\"text\" id=\"svg_stroke_type\" onChange=\"updateSVGObj();\" value=\""+style+"\" size=\"8\"/>";
1019    
1020    document.getElementById('toolFill').style.backgroundColor=fill;    document.getElementById('toolFill').style.backgroundColor=fill;
1021    document.getElementById('toolStroke').style.backgroundColor=color;    document.getElementById('toolStroke').style.backgroundColor=color;
1022    return res;    return res;
1023  }  }
1024    
1025  function propSVGLine(type, stroke, color, fill, style, rot){  function propSVGLine(type, stroke, color, fill, style, rot){
1026    var res =  propSVGObj(type, stroke, color, fill, rot);    var res =  propSVGObj(type, stroke, color, fill, style, rot);
1027    if(!rot) rot = 0;    if(!rot) rot = 0;
1028    if(style==null) style="";  
   res += "Type:<input type=\"text\" id=\"svg_stroke_type\" onChange=\"updateSVGObj();\" value=\""+style+"\" size=\"8\"/>";  
1029    res += "Arrow:";    res += "Arrow:";
1030    
1031    if(hasArrow('start')){    if(hasArrow('start')){
# Line 1507  function setSVGObjectProp(obj){ Line 1510  function setSVGObjectProp(obj){
1510      case 'rect':      case 'rect':
1511      case 'circle':      case 'circle':
1512      case 'ellipse':      case 'ellipse':
1513       res =  propSVGObj(tag+":", obj.getAttribute("stroke-width"), obj.getAttribute("stroke"), obj.getAttribute("fill"),getRotateAngle(obj));       res =  propSVGObj(tag+":", obj.getAttribute("stroke-width"), obj.getAttribute("stroke"),
1514             obj.getAttribute("fill"),obj.getAttribute("stroke-dasharray"),getRotateAngle(obj));
1515       break;       break;
1516      case 'path':      case 'path':
1517      case 'line':      case 'line':
# Line 1549  function updateSVGObj(){ Line 1553  function updateSVGObj(){
1553        var fill=document.getElementById('svg_fill');        var fill=document.getElementById('svg_fill');
1554        var color=document.getElementById('svg_color');        var color=document.getElementById('svg_color');
1555        var L=document.getElementById('svg_stroke');        var L=document.getElementById('svg_stroke');
1556          var dash=document.getElementById('svg_stroke_type');
1557        obj.setAttribute("fill", fill.value);        obj.setAttribute("fill", fill.value);
1558        obj.setAttribute("stroke", color.value);        obj.setAttribute("stroke", color.value);
1559        obj.setAttribute("stroke-width", L.value);        obj.setAttribute("stroke-width", L.value);
1560          if(dash) obj.setAttribute("stroke-dasharray", dash.value);
1561        setRotate(obj,deg.value);        setRotate(obj,deg.value);
1562       break;       break;
1563      case 'path':      case 'path':
# Line 1563  function updateSVGObj(){ Line 1569  function updateSVGObj(){
1569        obj.setAttribute("fill", fill.value);        obj.setAttribute("fill", fill.value);
1570        obj.setAttribute("stroke", color.value);        obj.setAttribute("stroke", color.value);
1571        obj.setAttribute("stroke-width", L.value);        obj.setAttribute("stroke-width", L.value);
       setRotate(obj,deg.value);  
1572        if(dash) obj.setAttribute("stroke-dasharray", dash.value);        if(dash) obj.setAttribute("stroke-dasharray", dash.value);
1573          setRotate(obj,deg.value);
1574    
1575        var id = obj.getAttribute("id");        var id = obj.getAttribute("id");
1576        var marker = document.getElementById(id+'_startarrow');        var marker = document.getElementById(id+'_startarrow');
1577        if(marker) marker.setAttribute("fill", color.value);        if(marker) marker.setAttribute("fill", color.value);

Legend:
Removed from v.38  
changed lines
  Added in v.39

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26