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 55 by isao-hara, Wed Jul 28 08:24:57 2010 UTC revision 56 by isao-hara, Wed Jul 28 13:31:50 2010 UTC
# Line 66  var svg_scale_locked = false; Line 66  var svg_scale_locked = false;
66  var dupItems;  var dupItems;
67  var dupX;  var dupX;
68  var dupY;  var dupY;
69    var is_newPath;
70    
71  var firstTouch = new Date();  var firstTouch = new Date();
72    
# Line 1337  function setArrow(pobj, pos, type){ Line 1338  function setArrow(pobj, pos, type){
1338    if(!pobj) return;    if(!pobj) return;
1339    var pid = pobj.getAttribute('id');    var pid = pobj.getAttribute('id');
1340    var marker = document.getElementById(pid+'_'+pos+'arrow');    var marker = document.getElementById(pid+'_'+pos+'arrow');
1341    if(marker) return;    if(marker){
1342        popupInfo("marker:"+marker);
1343        return;
1344      }
1345    
1346    var obj = createSVGElement('path', 'new');    var obj = createSVGElement('path', 'new');
1347    
# Line 1365  function setArrow(pobj, pos, type){ Line 1369  function setArrow(pobj, pos, type){
1369    marker.setAttribute("fill",pobj.getAttribute("stroke"));    marker.setAttribute("fill",pobj.getAttribute("stroke"));
1370    
1371    defSVGElement(marker);    defSVGElement(marker);
1372      if(!document.getElementById(pid+'_'+pos+'arrow')){
1373         alert("Error in setArrow");
1374         return;
1375      }
1376    var mid = "url(#"+marker.getAttribute("id")+")";    var mid = "url(#"+marker.getAttribute("id")+")";
1377    var mattr = "marker-"+pos;    var mattr = "marker-"+pos;
1378    pobj.setAttribute(mattr, mid);    pobj.setAttribute(mattr, mid);
# Line 1377  function togglePathType(){ Line 1385  function togglePathType(){
1385    var newpath = "";    var newpath = "";
1386    
1387    for(var i=0;i<path.length ;i++){    for(var i=0;i<path.length ;i++){
1388      if(path[i] == "L"){ path[i] = "C"; }      if(path[i] == "L"){ path[i] = "Q"; }
1389      else if("LCQST".indexOf(path[i])> 0){ path[i] = "L"; }      else if("LCQST".indexOf(path[i])> 0){ path[i] = "L"; }
1390      newpath += path[i] + ' ';      newpath += path[i] + ' ';
1391    }    }
1392    if(((i-4) % 4) != 0) {    var mm = path.length % 4;
1393    //  popupInfo(path.length);
1394      if(mm != 0) {
1395      newpath += path[i-2] + ' ';      newpath += path[i-2] + ' ';
1396      newpath += path[i-1] + ' ';      newpath += path[i-1] + ' ';
1397    }    }
# Line 2043  function onTouchStartCore(){ Line 2053  function onTouchStartCore(){
2053           targetItem=createSVGObj(modeSVG,attr, fill.value, color.value, L.value);           targetItem=createSVGObj(modeSVG,attr, fill.value, color.value, L.value);
2054           break;           break;
2055         case 'newPath':         case 'newPath':
2056           var attr = 'd=M '+x+' '+y+' L '+x+' '+y;           //var attr = 'd=M '+x+' '+y+' L '+x+' '+y;
2057             var attr = 'd=M '+x+' '+y+' L';
2058           targetItem=createSVGObj('path' ,attr, 'none', color.value, L.value);           targetItem=createSVGObj('path' ,attr, 'none', color.value, L.value);
2059             is_newPath=true;
2060           break;           break;
2061         case 'newLine':         case 'newLine':
2062           var x2=x+1;           var x2=x+1;
# Line 2074  function onTouchStartCore(){ Line 2086  function onTouchStartCore(){
2086       if(modeSVG == 'newPath'){       if(modeSVG == 'newPath'){
2087         if(targetItem.tagName == 'path' ){         if(targetItem.tagName == 'path' ){
2088           var path = targetItem.getAttribute("d");           var path = targetItem.getAttribute("d");
2089    
2090    /*
2091             if(is_newPath){
2092               path="M ";
2093               var path_arr=path.aplit(' ');
2094               path += path_arr[1]+' '+path_arr[2]+' L';
2095               is_newPath=false;
2096             }
2097             */
2098           path = path + ' '+ getPreviewX(sx) + ' '+ getPreviewY(sy) ;           path = path + ' '+ getPreviewX(sx) + ' '+ getPreviewY(sy) ;
2099    //       popupInfo(path);
2100           targetItem.setAttribute("d",path);           targetItem.setAttribute("d",path);
2101         }         }
2102         return;         return;

Legend:
Removed from v.55  
changed lines
  Added in v.56

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