Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha Premium Member
    Join Date
    Sep 2009
    Posts
    101
    Vote Rating
    1
    EZboy is on a distinguished road

      0  

    Default [4.0.2 and 4.0.1] sprite.getBBox() issue with coordinates for "circle" sprite

    [4.0.2 and 4.0.1] sprite.getBBox() issue with coordinates for "circle" sprite


    Hi there,

    I've noticed that x and y values returned by getBBox() on a "circle" sprite are incorrect.
    To obtain proper coordinates one could access the property directly: sprite.x or sprite.y.

    This behaviour is confirmed in 4.0.1 and 4.0.2

    Thank you

  2. #2
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,408
    Vote Rating
    179
    LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold LesJ is a splendid one to behold

      0  

    Default Looks about right

    Looks about right


    See my test code. The BBox is 'about' right.

    I'm not sure why x and width are not full numbers.

    Code:
    height 100    
    path [["M", 100, 100], ["M", 100, 50], ["C", 138.49001794597504, 50, 4 more...], 4 more...]    
    width 100.14918923031419    
    x 49.92540538484291    
    y 50

    Code:
    var cmp = Ext.create('Ext.draw.Component', {
        id: 'drawCmp'
    });
    
    Ext.create('Ext.Window', {
        width: 300,
        height: 300,
        layout: 'fit',
        items: [cmp]
    }).show();
    
    
    Ext.getCmp("drawCmp").surface.add({
        type: 'circle',
        fill: 'yellow',
        radius: 50,
        x: 100,
        y: 100
    }).show(true).getBBox()

  3. #3
    Sencha Premium Member
    Join Date
    Sep 2009
    Posts
    101
    Vote Rating
    1
    EZboy is on a distinguished road

      0  

    Default


    I see, this works indeed.

    In my case i am trying to getBBox() before the element is actually shown. So show(true) did not happen yet. This does not work with "circle", but works with line!

    Try this:

    PHP Code:

    var tmp Ext.getCmp('drawCmp').surface.add({
        
    type'path',
        
    fill'yellow',
        
    path'M100,100L300,300',
        
    strokestroke,
        
    "stroke-width"strokewidth,
    });

    tmp.getBBox();
    alert("X: "b.+" Y: "b.y);

    var 
    tmp Ext.getCmp('drawCmp').surface.add({
        
    type'circle',
        
    fill'yellow',
        
    radius50,
        
    x100,
        
    y100
    });

    tmp.getBBox();
    alert("X: "b.+" Y: "b.y); 
    Am I missing something? Why this works for some sprites, but not for others?

Thread Participants: 1