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 2 by isao-hara, Fri Jul 16 05:31:22 2010 UTC revision 3 by isao-hara, Fri Jul 16 07:11:28 2010 UTC
# Line 1338  function checkIntersection(obj, x, y, ex Line 1338  function checkIntersection(obj, x, y, ex
1338        var y1 = getAttributeVal(obj,"y1");        var y1 = getAttributeVal(obj,"y1");
1339        var x2 = getAttributeVal(obj,"x2");        var x2 = getAttributeVal(obj,"x2");
1340        var y2 = getAttributeVal(obj,"y2");        var y2 = getAttributeVal(obj,"y2");
1341        var yy= (y2-y1)/(x2-x1) * (x-x1) + y1;        var d = (y2-y1)/(x2-x1);
1342        if(res) if( y < yy && yy < ey) return true;  
1343          if(res){
1344            var xx = Math.abs(x2-x1);
1345            var sign = 1;
1346            if(x2-x1 < 0){ sign = -1; }
1347            for(var i=0; i < xx; i++){
1348              var nx = i*sign + x1;
1349              var ny = d * i*sign + y1;
1350              if(x < nx && nx < ex && y < ny && ny < ey) return true;
1351            }
1352          }
1353        return false;        return false;
1354    
1355          return res;
1356        break;        break;
1357      case 'text':      case 'text':
1358      case 'rect':      case 'rect':
# Line 1398  function getSelectedObjects(x1, y1, x2, Line 1409  function getSelectedObjects(x1, y1, x2,
1409     if(x1 > x2) { var tmp = x1; x1=x2; x2=tmp; }     if(x1 > x2) { var tmp = x1; x1=x2; x2=tmp; }
1410     if(y1 > y2) { var tmp = y1; y1=y2; y2=tmp; }     if(y1 > y2) { var tmp = y1; y1=y2; y2=tmp; }
1411    
1412       var val="";
1413     if(svg_top){     if(svg_top){
1414       var val ="";       var val ="";
1415       var objs = svg_top.childNodes;       var objs = svg_top.childNodes;
1416       selectedItems = new Array();       selectedItems = new Array();
1417       for(var i=0; i<objs.length;i++){       for(var i=0; i<objs.length;i++){
1418        if(objs[i].tagName){        if(objs[i].tagName){
1419          
1420          if(objs[i] != svg_select && checkIntersection(objs[i], x1, y1, x2, y2)){          if(objs[i] != svg_select && checkIntersection(objs[i], x1, y1, x2, y2)){
1421            selectedItems.push(objs[i]);            selectedItems.push(objs[i]);
1422          }          }
1423              val += objs[i].tagName+" ";
1424        }        }
1425      }      }
1426    }    }

Legend:
Removed from v.2  
changed lines
  Added in v.3

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