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 41 by isao-hara, Mon Jul 26 08:39:09 2010 UTC revision 42 by isao-hara, Tue Jul 27 02:39:25 2010 UTC
# Line 61  var svg_line_width = 1; Line 61  var svg_line_width = 1;
61    
62  var editingTextObj = null;  var editingTextObj = null;
63  var svg_rotate_locked = true;  var svg_rotate_locked = true;
64    var svg_scale_locked = true;
65    
66    var dupItems;
67    var dupX;
68    var dupY;
69    
70    var firstTouch = new Date();
71    
72  ///// Color  ///// Color
73  var colors=new Array('none', '#ffffff',  var colors=new Array('none', '#ffffff',
# Line 93  function initEditor(name, dispname, size Line 100  function initEditor(name, dispname, size
100    restoreValues();    restoreValues();
101  }  }
102    
103    //// localStorage
104  function restoreValues(){  function restoreValues(){
105    if(typeof(localStorage) == 'undefined'){    if(typeof(localStorage) == 'undefined'){ alert('local storage not suported'); }
     alert('local storage not suported');  
   }  
106    MgrPath = localStorage.getItem('MgrPath') ? localStorage.getItem('MgrPath')  : "";    MgrPath = localStorage.getItem('MgrPath') ? localStorage.getItem('MgrPath')  : "";
107    window.onbeforeuload=function(){ return saveChanges(); }    window.onbeforeuload=function(){ return saveChanges(); }
108  }  }
# Line 119  function initDB(name, dispname, size) { Line 125  function initDB(name, dispname, size) {
125          var version = '1.0';          var version = '1.0';
126          var myDB = openDatabase(name, version, dispname, size);          var myDB = openDatabase(name, version, dispname, size);
127      }      }
128    } catch(e) {    }catch(e){
129      if (e == INVALID_STATE_ERR) {      if (e == INVALID_STATE_ERR){ alert("Invalid database version."); }else{ alert("Unknown error "+e+"."); }
       alert("Invalid database version.");  
     } else {  
       alert("Unknown error "+e+".");  
     }  
130      return null;      return null;
131    }    }
   
132    createTables(myDB);    createTables(myDB);
133    return myDB;    return myDB;
134  }  }
135    
136  function createTables(db) {  function createTables(db) {
   if (0)  dropTables(db);  
   
137    db.transaction(    db.transaction(
138      function (transaction) {      function (transaction) {
139          transaction.executeSql('CREATE TABLE IF NOT EXISTS files(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, filedata_id INTEGER NOT NULL, deleted INTEGER NOT NULL DEFAULT 0);', [], nullDataHandler, killTransaction);        transaction.executeSql('CREATE TABLE IF NOT EXISTS files(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name TEXT NOT NULL, filedata_id INTEGER NOT NULL, deleted INTEGER NOT NULL DEFAULT 0);', [], nullDataHandler, killTransaction);
140          transaction.executeSql('CREATE TABLE IF NOT EXISTS filedata(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, datablob BLOB NOT NULL DEFAULT "");', [], nullDataHandler, errorHandler);        transaction.executeSql('CREATE TABLE IF NOT EXISTS filedata(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, datablob BLOB NOT NULL DEFAULT "");', [], nullDataHandler, errorHandler);
141      }      }
142    );    );
143  }  }
144    
145  function dropTables(db) {  function dropTables(db) {
146     db.transaction(    db.transaction(
147       function (transaction) {      function (transaction) {
148          transaction.executeSql('DROP TABLE files;');        transaction.executeSql('DROP TABLE files;');
149          transaction.executeSql('DROP TABLE filedata;');        transaction.executeSql('DROP TABLE filedata;');
150       }      }
151     );    );
152  }  }
153    
154  /// Create New File  /// Create New File
# Line 159  function reallyCreateNewFileAction(name, Line 158  function reallyCreateNewFileAction(name,
158    
159    myDB.transaction(    myDB.transaction(
160      function (transaction) {      function (transaction) {
161        var myfunc = new Function("transaction", "results", "transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+name+"', results.insertId], nullDataHandler, killTransaction);");        var myfunc = new Function("transaction","results","transaction.executeSql('INSERT INTO files (name, filedata_id) VALUES (?, ?);', [ '"+name+"', results.insertId], nullDataHandler, killTransaction);");
162    
163         transaction.executeSql('INSERT INTO filedata (datablob) VALUES ("");', [], myfunc, errorHandler);         transaction.executeSql('INSERT INTO filedata (datablob) VALUES ("");', [], myfunc, errorHandler);
164      }      }
165    );    );
   
166    fileSelector();    fileSelector();
167  }  }
168    
# Line 196  function createNewFileAction(db){ Line 194  function createNewFileAction(db){
194  }  }
195    
196  //// Delete File  //// Delete File
197  function deleteUpdateResults(transaction, results)  function deleteUpdateResults(transaction, results){
198  {    if (results.rowsAffected) {
199      if (results.rowsAffected) {      fileSelector();
200          fileSelector();    }
     }  
201  }  }
202    
203  function reallyDelete(id, db){  function reallyDelete(id, db){
# Line 285  function renameFileAction(db){ Line 282  function renameFileAction(db){
282    
283  }  }
284    
   
285  /// Save File  /// Save File
286  function saveFile(db){  function saveFile(db){
287    var myDB = db;    var myDB = db;
# Line 364  function reallySaveNewFileAction(fname, Line 360  function reallySaveNewFileAction(fname,
360         transaction.executeSql('INSERT INTO filedata (datablob) VALUES (?);', [content], myfunc, errorHandler);         transaction.executeSql('INSERT INTO filedata (datablob) VALUES (?);', [content], myfunc, errorHandler);
361      }      }
362    );    );
   
363    datadiv.textContent="";    datadiv.textContent="";
364    alert("download to "+fname);    alert("download to "+fname);
365  }  }
# Line 380  function saveContentFilename(id, db){ Line 375  function saveContentFilename(id, db){
375  function saveContentWithFilename(fname, contents, db){  function saveContentWithFilename(fname, contents, db){
376    var myDB = db;    var myDB = db;
377    if(!db) myDB = systemDB;    if(!db) myDB = systemDB;
378      if(!contents) { alert("Invalid content"); return; }
   if(!contents) {  
     alert("Invalid content");  
     return;  
   }  
379    
380    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
381    datadiv.setAttribute('lfname', fname);    datadiv.setAttribute('lfname', fname);
# Line 414  function showFileData(transaction, resul Line 405  function showFileData(transaction, resul
405    
406    var datadiv = document.getElementById('tempdata');    var datadiv = document.getElementById('tempdata');
407    datadiv.setAttribute('lfdataid', parseInt(data['filedata_id']));    datadiv.setAttribute('lfdataid', parseInt(data['filedata_id']));
   
408    document.title=filename;    document.title=filename;
409    
410    previewFile(filedata);    previewFile(filedata);
# Line 423  function showFileData(transaction, resul Line 413  function showFileData(transaction, resul
413    setMode('Preview');    setMode('Preview');
414  }  }
415    
416  function showFile(name){  function showFile(name){ getFile(name, 'showFileData'); }
    getFile(name, 'showFileData');  
 }  
417    
418  function getFile(name, func, db){  function getFile(name, func, db){
419    var myDB = db;    var myDB = db;
# Line 442  function getFile(name, func, db){ Line 430  function getFile(name, func, db){
430  }  }
431    
432  //  Error Handlers  //  Error Handlers
433  function killTransaction(transaction, error){  function killTransaction(transaction, error){ return true; }
     return true;  
 }  
434    
435  function errorHandler(transaction, error){  function errorHandler(transaction, error){
436    alert('Oops.  Error was '+error.message+' (Code '+error.code+')');    alert('Oops.  Error was '+error.message+' (Code '+error.code+')');
# Line 454  function errorHandler(transaction, error Line 440  function errorHandler(transaction, error
440    return false;    return false;
441  }  }
442    
443  function nullDataHandler(transaction, results){  function nullDataHandler(transaction, results){ }
 }  
444    
445  ///////////////////////////  /////////
   
446  function fileSelector(db) {  function fileSelector(db) {
447    var myDB = db;    var myDB = db;
448    if(!db) myDB = systemDB;    if(!db) myDB = systemDB;
# Line 722  function editCurrentFile(){ Line 706  function editCurrentFile(){
706    editFile(name);    editFile(name);
707  }  }
708    
 function downItem(){  
   if(selectedItems.length != 1) return;  
   var itm = selectedItems[0];  
     
   var nodes = svg_top.childNodes;  
   for(var i=0; i< nodes.length; i++){  
     if(nodes[i] == itm) break;  
   }  
   if (i > 0)  
     svg_top.insertBefore(itm, nodes[i-1]);  
 }  
   
 function upItem(){  
   if(selectedItems.length != 1) return;  
   var itm = selectedItems[0];  
   
   var nodes = svg_top.childNodes;  
   for(var i=0; i< nodes.length; i++){  
     if(nodes[i] == itm) break;  
   }  
   
   if (i == nodes.length-2){  
     svg_top.appendChild(itm);  
   }else if (i < nodes.length-1){  
     svg_top.insertBefore(itm, nodes[i+2]);  
   }  
 }  
   
 function bottomItem(){  
   if(selectedItems.length != 1) return;  
   var itm = selectedItems[0];  
   svg_top.insertBefore(itm, svg_top.firstChild);  
 }  
   
 function topItem(){  
   if(selectedItems.length != 1) return;  
   var itm = selectedItems[0];  
   svg_top.removeChild(itm);  
   svg_top.appendChild(itm);  
 }  
709    
710  //  Show File  //  Show File
711  function updateShowMenu(){  function updateShowMenu(){
# Line 770  function updateShowMenu(){ Line 714  function updateShowMenu(){
714    menuDiv.innerHTML+= "<button onClick=\"fileSelector();\"><img src=\"images/list.png\"></button>\n";    menuDiv.innerHTML+= "<button onClick=\"fileSelector();\"><img src=\"images/list.png\"></button>\n";
715    menuDiv.innerHTML+= "<button onClick=\"saveData();\"><img src=\"images/save.png\"></button>\n";    menuDiv.innerHTML+= "<button onClick=\"saveData();\"><img src=\"images/save.png\"></button>\n";
716    menuDiv.innerHTML+= "<button onClick=\"showSVGSource();\"><img src=\"images/SVG.png\"></button>\n";    menuDiv.innerHTML+= "<button onClick=\"showSVGSource();\"><img src=\"images/SVG.png\"></button>\n";
   menuDiv.innerHTML+= "<button onClick=\"topItem();\" ><img src=\"images/top.png\"></button>\n";  
   menuDiv.innerHTML+= "<button onClick=\"upItem();\" ><img src=\"images/up.png\"></button>\n";  
   menuDiv.innerHTML+= "<button onClick=\"downItem();\"><img src=\"images/down.png\"></button>\n";  
   menuDiv.innerHTML+= "<button onClick=\"bottomItem();\"><img src=\"images/bottom.png\"></button>\n";  
717    menuDiv.innerHTML+= updateSVGObjMenu();    menuDiv.innerHTML+= updateSVGObjMenu();
718    if(svg_rotate_locked)    if(svg_rotate_locked)
719      menuDiv.innerHTML+= "<button onClick=\"toggleRotateLock();\">UnLockRot</button>\n";      menuDiv.innerHTML+= "<button onClick=\"toggleRotateLock();\"><img src=\"images/rot-lock.png\"></button>\n";
720      else
721        menuDiv.innerHTML+= "<button onClick=\"toggleRotateLock();\"><img src=\"images/rot-unlock.png\"></button>\n";
722    
723      if(svg_scale_locked)
724        menuDiv.innerHTML+= "<button onClick=\"toggleScaleLock();\"><img src=\"images/scalable-lock.png\"></button>\n";
725    else    else
726      menuDiv.innerHTML+= "<button onClick=\"toggleRotateLock();\">LockRot</button>\n";      menuDiv.innerHTML+= "<button onClick=\"toggleScaleLock();\"><img src=\"images/scalable.png\"></button>\n";
727    
728    menuDiv.style.display='block';    menuDiv.style.display='block';
729    updateToolBar();    updateToolBar();
# Line 822  function updateToolBar(){ Line 767  function updateToolBar(){
767      str += "<li>&nbsp;</li>";      str += "<li>&nbsp;</li>";
768      str += "<li><button id=\"b_fillColor\" onClick=\"showColorPalette('fill');\"><img src=\"images/Fill.png\" /><div id=\"toolFill\"></div></button></li> \n";      str += "<li><button id=\"b_fillColor\" onClick=\"showColorPalette('fill');\"><img src=\"images/Fill.png\" /><div id=\"toolFill\"></div></button></li> \n";
769      str += "<li><button id=\"b_strokeColor\" onClick=\"showColorPalette('stroke');\"><img src=\"images/Stroke.png\" /><div id=\"toolStroke\"></div></button></li> \n";      str += "<li><button id=\"b_strokeColor\" onClick=\"showColorPalette('stroke');\"><img src=\"images/Stroke.png\" /><div id=\"toolStroke\"></div></button></li> \n";
770        str += "<li>&nbsp;</li>";
771        str += "<li><button onClick=\"topItem();\" ><img src=\"images/top.png\"></button></li>\n";
772        str += "<li><button onClick=\"upItem();\" ><img src=\"images/up.png\"></button></li>\n";
773        str += "<li><button onClick=\"downItem();\"><img src=\"images/down.png\"></button></li>\n";
774        str += "<li><button onClick=\"bottomItem();\"><img src=\"images/bottom.png\"></button></li>\n";
775        str += "<li>&nbsp;</li>";
776        str += "<li><button onClick=\"dupObject();\"><img src=\"images/copy.png\"></button></li>\n";
777      toolbar.innerHTML= "<ul>"+str+"</ul>";      toolbar.innerHTML= "<ul>"+str+"</ul>";
778    }    }
   
779    toolbar.style.display='block';    toolbar.style.display='block';
780  }  }
781    
# Line 916  function previewFile(data){ Line 867  function previewFile(data){
867    preview.style.left='0px';    preview.style.left='0px';
868    preview.style.right='10px';    preview.style.right='10px';
869    preview.style.width='800px';    preview.style.width='800px';
 //  preview.style.height='600px';  
870    preview.style.height='525px';    preview.style.height='525px';
871    mkColorPalette();    mkColorPalette();
872    
# Line 950  function mkColorPalette(){ Line 900  function mkColorPalette(){
900    
901  ////// for SVG object  ////// for SVG object
902  ////////////////  ////////////////
903    function downItem(){
904      if(selectedItems.length != 1) return;
905      var itm = selectedItems[0];
906      var nodes = svg_top.childNodes;
907      for(var i=0; i< nodes.length; i++){ if(nodes[i] == itm) break; }
908      if (i > 0) svg_top.insertBefore(itm, nodes[i-1]);
909    }
910    
911    function upItem(){
912      if(selectedItems.length != 1) return;
913      var itm = selectedItems[0];
914      var nodes = svg_top.childNodes;
915      for(var i=0; i< nodes.length; i++){ if(nodes[i] == itm) break; }
916    
917      if (i == nodes.length-2){
918        svg_top.appendChild(itm);
919      }else if (i < nodes.length-1){
920        svg_top.insertBefore(itm, nodes[i+2]);
921      }
922    }
923    
924    function bottomItem(){
925      if(selectedItems.length != 1) return;
926      var itm = selectedItems[0];
927      svg_top.insertBefore(itm, svg_top.firstChild);
928    }
929    
930    function topItem(){
931      if(selectedItems.length != 1) return;
932      var itm = selectedItems[0];
933      svg_top.removeChild(itm);
934      svg_top.appendChild(itm);
935    }
936    
937  function updateSVGObjMenu(){  function updateSVGObjMenu(){
938    var res = "";    var res = "";
939    var tag = modeSVG;    var tag = modeSVG;
# Line 1035  function propSVGLine(type, stroke, color Line 1019  function propSVGLine(type, stroke, color
1019    res += "Arrow:";    res += "Arrow:";
1020    
1021    if(hasArrow('start')){    if(hasArrow('start')){
1022      res += "<button class=\"tool\" onClick=\"removeLeftArrow();\"><img src=\"images/normal.png\" /></button>";      res += "<button class=\"tool\" onClick=\"removeLeftArrow();\"><img src=\"images/larrow.png\" /></button>";
1023    }else{    }else{
1024      res += "<button class=\"tool\" onClick=\"setLeftArrow();\"><img src=\"images/larrow.png\" /></button>";      res += "<button class=\"tool\" onClick=\"setLeftArrow();\"><img src=\"images/normal.png\" /></button>";
1025    }    }
1026    if(hasArrow('end')){    if(hasArrow('end')){
1027      res += "<button class=\"tool\" onClick=\"removeRightArrow();\"><img src=\"images/normal.png\" /></button>";      res += "<button class=\"tool\" onClick=\"removeRightArrow();\"><img src=\"images/rarrow.png\" /></button>";
1028    }else{    }else{
1029      res += "<button class=\"tool\" onClick=\"setRightArrow();\"><img src=\"images/rarrow.png\" /></button>";      res += "<button class=\"tool\" onClick=\"setRightArrow();\"><img src=\"images/normal.png\" /></button>";
1030    }    }
1031    
1032      res += "<button class=\"tool\" onClick=\"togglePathType();\"><img src=\"images/lineType.png\" /></button>";
1033    document.getElementById('toolFill').style.backgroundColor=fill;    document.getElementById('toolFill').style.backgroundColor=fill;
1034    document.getElementById('toolStroke').style.backgroundColor=color;    document.getElementById('toolStroke').style.backgroundColor=color;
1035    
# Line 1299  function setArrow(pobj, pos, type){ Line 1284  function setArrow(pobj, pos, type){
1284    pobj.setAttribute(mattr, mid);    pobj.setAttribute(mattr, mid);
1285  }  }
1286    
1287    function togglePathType(){
1288      if(selectedItems.length != 1) return;
1289      var itm = selectedItems[0];
1290      var path = itm.getAttribute("d").split(' ');
1291      var newpath = "";
1292    
1293      for(var i=0;i<path.length ;i++){
1294        if(path[i] == "L"){ path[i] = "C"; }
1295        else if(path[i] == "C"){ path[i] = "L"; }
1296        newpath += path[i] + ' ';
1297      }
1298      
1299      itm.setAttribute("d",trim(newpath));
1300    }
1301    
1302  function appendSVGObj(obj){  function appendSVGObj(obj){
1303    var svg_top = document.getElementById('svg_top');    var svg_top = document.getElementById('svg_top');
1304    if(!svg_top) return;    if(!svg_top) return;
# Line 1477  function toggleRotateLock(){ Line 1477  function toggleRotateLock(){
1477    if(svg_rotate_locked) svg_rotate_locked = false;    if(svg_rotate_locked) svg_rotate_locked = false;
1478    else svg_rotate_locked = true;    else svg_rotate_locked = true;
1479    updateShowMenu();    updateShowMenu();
1480    }
1481    
1482    function toggleScaleLock(){
1483      if(svg_scale_locked) svg_scale_locked = false;
1484      else svg_scale_locked = true;
1485      updateShowMenu();
1486        
1487  }  }
1488    
# Line 1769  function getSelectedObjects(x1, y1, x2, Line 1775  function getSelectedObjects(x1, y1, x2,
1775    setSelectBox();    setSelectBox();
1776  }  }
1777    
1778    function dupObject(){
1779      if(selectedItems.length == 0){ return; }
1780      dupItems = selectedItems;
1781      dupX = parseInt(svg_select.getAttribute("x"));
1782      dupY = parseInt(svg_select.getAttribute("y"));
1783      setSVGMode('Duplicate');
1784    }
1785    
1786    function pasteObject(x,y){
1787      if(selectedItems.length == 0){ return; }
1788      for(var i=0;i<dupItems.length;i++){
1789        var itm = dupItems[i].cloneNode(true);
1790        replaceTranslate(itm,x-dupX,y-dupY);
1791        updateTransform(itm);
1792        appendSVGObj(itm);
1793      }
1794    }
1795    
1796  function onTouchStartCore(){  function onTouchStartCore(){
1797    if((!modeSVG || modeSVG == 'selector') && selectedItems.length == 0){ // Selector Mode    if((!modeSVG || modeSVG == 'selector') && selectedItems.length == 0){ // Selector Mode
1798      var x1=getPreviewX(sx-1);      var x1=getPreviewX(sx-1);
# Line 1819  function onTouchStartCore(){ Line 1843  function onTouchStartCore(){
1843           targetItem=createSVGObj(modeSVG,attr, fill.value, color.value, L.value);           targetItem=createSVGObj(modeSVG,attr, fill.value, color.value, L.value);
1844           break;           break;
1845         case 'newPath':         case 'newPath':
1846           var attr = 'd=M '+x+' '+y+' L '+x+' '+y;           //var attr = 'd=M '+x+' '+y+' L '+x+' '+y;
1847             var attr = 'd=M '+x+' '+y+' L';
1848           targetItem=createSVGObj('path' ,attr, 'none', color.value, L.value);           targetItem=createSVGObj('path' ,attr, 'none', color.value, L.value);
1849           break;           break;
1850         case 'newLine':         case 'newLine':
# Line 1845  function onTouchStartCore(){ Line 1870  function onTouchStartCore(){
1870       var y1=getPreviewY(sy-1);       var y1=getPreviewY(sy-1);
1871       var x2=getPreviewX(sx+2);       var x2=getPreviewX(sx+2);
1872       var y2=getPreviewY(sy+2);       var y2=getPreviewY(sy+2);
1873    
1874         if(modeSVG == 'Duplicate'){ pasteObject(x1,y1); }
1875         if(modeSVG == 'newPath'){
1876           if(targetItem.tagName == 'path' ){
1877             var path = targetItem.getAttribute("d");
1878             path = path + ' '+ getPreviewX(sx) + ' '+ getPreviewY(sy) ;
1879             targetItem.setAttribute("d",path);
1880           }
1881           return;
1882         }
1883       if(!checkIntersection(svg_select, x1, y1, x2, y2)){       if(!checkIntersection(svg_select, x1, y1, x2, y2)){
1884          setSVGMode('selector');          setSVGMode('selector');
1885       }       }
# Line 1871  function onDoubleTap(e){ Line 1906  function onDoubleTap(e){
1906          obj.style.display = 'none';          obj.style.display = 'none';
1907          editingTextObj = obj;          editingTextObj = obj;
1908          break;          break;
1909          case 'path':
1910            if(modeSVG == 'newPath'){ setSVGMode('selector'); }
1911            break;
1912        default:        default:
1913          break;          break;
1914      }      }
# Line 1904  function updatePath(d, x, y){ Line 1942  function updatePath(d, x, y){
1942    var isx=true;    var isx=true;
1943    var val;    var val;
1944    for(var i=0; i<p.length;i++){    for(var i=0; i<p.length;i++){
1945        if(trim(p[i]) == "") continue;
1946      if(p[i].match('[MLHVCSQTA]','i')){      if(p[i].match('[MLHVCSQTA]','i')){
1947        res += ' '+p[i];        res += ' '+p[i];
1948      }else{      }else{
# Line 2232  function putInputForm(x, y, txt, size, i Line 2271  function putInputForm(x, y, txt, size, i
2271  }  }
2272    
2273  ///// EventHandler for iPad  ///// EventHandler for iPad
 var firstTouch = new Date();  
2274    
2275  function onTouchStart(e){  function onTouchStart(e){
2276    //e.preventDefault();    //e.preventDefault();
# Line 2327  function onGestureChange(e){ Line 2365  function onGestureChange(e){
2365    
2366    if(targetItem){    if(targetItem){
2367      e.preventDefault();      e.preventDefault();
2368      if (svg_wo && svg_scale_dir != 'y') targetItem.setAttribute("width", Math.round(svg_wo*scale ));      if(!svg_scale_locked){
2369      if (svg_ho && svg_scale_dir != 'x') targetItem.setAttribute("height", Math.round(svg_ho*scale ));        if (svg_wo && svg_scale_dir != 'y') targetItem.setAttribute("width", Math.round(svg_wo*scale ));
2370      if (svg_ro) targetItem.setAttribute("r", Math.round(svg_ro*scale ));        if (svg_ho && svg_scale_dir != 'x') targetItem.setAttribute("height", Math.round(svg_ho*scale ));
2371      if (svg_rxo && svg_scale_dir != 'y') targetItem.setAttribute("rx", Math.round(svg_rxo*scale) );        if (svg_ro) targetItem.setAttribute("r", Math.round(svg_ro*scale ));
2372      if (svg_ryo && svg_scale_dir != 'x') targetItem.setAttribute("ry", Math.round(svg_ryo*scale) );        if (svg_rxo && svg_scale_dir != 'y') targetItem.setAttribute("rx", Math.round(svg_rxo*scale) );
2373      if (svg_fsize) targetItem.setAttribute("font-size", Math.round(svg_fsize*scale) );        if (svg_ryo && svg_scale_dir != 'x') targetItem.setAttribute("ry", Math.round(svg_ryo*scale) );
2374          if (svg_fsize) targetItem.setAttribute("font-size", Math.round(svg_fsize*scale) );
2375        }
2376      if (!svg_rotate_locked) setRotate(targetItem, rotation);      if (!svg_rotate_locked) setRotate(targetItem, rotation);
2377    
2378      updateShowMenu();      updateShowMenu();
# Line 2472  function onMouseMove(e){ Line 2512  function onMouseMove(e){
2512         scale= -1/scale;         scale= -1/scale;
2513      }      }
2514     }     }
2515      if(targetItem){      if(targetItem && !svg_scale_locked){
2516        if (svg_wo && svg_scale_dir != 'y') targetItem.setAttribute("width", Math.round(svg_wo*scale ));        if (svg_wo && svg_scale_dir != 'y') targetItem.setAttribute("width", Math.round(svg_wo*scale ));
2517        if (svg_ho && svg_scale_dir != 'x') targetItem.setAttribute("height", Math.round(svg_ho*scale ));        if (svg_ho && svg_scale_dir != 'x') targetItem.setAttribute("height", Math.round(svg_ho*scale ));
2518        if (svg_ro) targetItem.setAttribute("r", Math.round(svg_ro*scale ));        if (svg_ro) targetItem.setAttribute("r", Math.round(svg_ro*scale ));
# Line 2483  function onMouseMove(e){ Line 2523  function onMouseMove(e){
2523        updateShowMenu();        updateShowMenu();
2524      }      }
2525    }else if(e.shiftKey){    }else if(e.shiftKey){
2526      if(targetItem){      if(targetItem && !svg_rotate_locked){
2527        var dy = e.pageY -sy;        var dy = e.pageY -sy;
2528        var deg = dy % 360;        var deg = dy % 360;
2529        setRotate(targetItem, deg);        setRotate(targetItem, deg);

Legend:
Removed from v.41  
changed lines
  Added in v.42

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