Changeset 7772

Show
Ignore:
Timestamp:
03/23/07 09:21:42 (22 months ago)
Author:
elazutkin
Message:

gfx: added getTranslatedBoundingBox() method

Location:
trunk
Files:
1 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gfx/shape.js

    r7345 r7772  
    9999                //      (see dojo.gfx.defaultRect) 
    100100                return this.bbox;       // dojo.gfx.Rectangle 
     101        }, 
     102        getTransformedBoundingBox: function(){ 
     103                // summary: returns an array of four points or null 
     104                //      four points represent four corners of the untransformed bounding box 
     105                if(!this.bbox){ 
     106                        return null;    // null 
     107                } 
     108                var g = dojo.gfx.matrix; 
     109                var m = this._getRealMatrix(); 
     110                var b = this.getBoundingBox(); 
     111                var r = []; 
     112                r.push(g.multiplyPoint(m, b.x, b.y)); 
     113                r.push(g.multiplyPoint(m, b.x + b.width, b.y)); 
     114                r.push(g.multiplyPoint(m, b.x + b.width, b.y + b.height)); 
     115                r.push(g.multiplyPoint(m, b.x, b.y + b.height)); 
     116                return r;       // Array 
    101117        }, 
    102118        getEventSource: function(){ 
  • trunk/src/gfx/svg.js

    r7345 r7772  
    171171         
    172172        _applyTransform: function() { 
    173                 var matrix = this._getRealMatrix(); 
     173                var matrix = this.matrix; 
    174174                if(matrix){ 
    175175                        var tm = this.matrix; 
     
    354354                        this.shape = this.attachShape(rawNode); 
    355355                } 
     356        }, 
     357         
     358        _getRealMatrix: function(){ 
     359                var m = this.matrix; 
     360                var p = this.parent; 
     361                while(p){ 
     362                        if(p.matrix){ 
     363                                m = dojo.gfx.matrix.multiply(p.matrix, m); 
     364                        } 
     365                        p = p.parent; 
     366                } 
     367                return m; 
    356368        } 
    357369});