Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext User
    Join Date
    Aug 2010
    Posts
    46
    Vote Rating
    0
    4CastRisk is on a distinguished road

      0  

    Default [PR4] Ext.draw.Sprite createItem/add + surface issues

    [PR4] Ext.draw.Sprite createItem/add + surface issues


    With a lack of documents on Ext.draw I've had to draw an inference from the source on how to create simple sprites without going down the SVG path route.

    Based on what I've done (and this is probably wrong) it throws an error when trying to add a sprite to a surface:

    Below is some test code I wrote:

    Code:
    Ext.define 'Quartermaster.components.RenderSurface',
        extend: 'Ext.draw.Component'
        alias: 'Quartermaster.RenderSurface'
        
        afterRender: ->
            @callParent arguments
            
            #  Seems like this *should* be the way to create a sprite
            sprite = @surface.createItem
                type: 'rect'
                x: 50
                y: 50
                radius: 0
                lineWidth: 3
                stroke: '#55c'
                opacity: 0.8
                color: '#f00'
                # Seems redundant I need to pass the surface as a param
                surface: @surface
            
            # Below also seems redundant
            setTimeout =>
                console.log 'sprite add called'
                @surface.add sprite
                sprite.show()
            , 5000
    What appears to be happening is, when I log `sprite` I can see in Illumination that the returned object has a surface member - but when I try to add the sprite, this gets deleted (line 73 in Ext.draw.Sprite) and then firefox throws an error:

    me.surface is undefined

    Caused by line 100 in the setAttributes method

    Also tried just the following, but nothing gets added to the SVG surface:

    Code:
    Ext.define 'Quartermaster.components.RenderSurface',
        extend: 'Ext.draw.Component'
        alias: 'Quartermaster.RenderSurface'
        
        afterRender: ->
            @callParent arguments
            
            @surface.add
                type: 'rect'
                x: 50
                y: 50
                radius: 0
                lineWidth: 3
                stroke: '#55c'
                opacity: 0.8
                color: '#f00'
                surface: @surface

  2. #2
    Sencha User
    Join Date
    Mar 2011
    Posts
    1
    Vote Rating
    0
    Vezella22 is on a distinguished road

      0  

    Default


    Thanks for replying, everyone. It appears we have a decent cross-section of people here and a lot of well thought-out discussion

  3. #3
    Sencha User
    Join Date
    Mar 2011
    Posts
    114
    Vote Rating
    6
    johanhaest is on a distinguished road

      0  

    Default


    A recatangle needs a width and a height.

    A rectangle is created this way:

    PHP Code:
    Ext.onReady(function () {
          var 
    rectangle Ext.create('Ext.draw.Component', {
            
    width210,
            
    height105,
            
    x250,
            
    y100,
            
    draggabletrue,
            
    constraintrue,
            
    floatingtrue,
            
    renderToExt.getBody(),
            
    items: [{
                
    type"rect",
                
    width200,
                
    height100,
                
    x0,
                
    y0,
                
    stroke"#000",
                
    "stroke-width""2.5",
                
    fill"#ff5500"
            
    }]
        });
    }); 
    This will give you an orange draggable rectangle in your body.

  4. #4
    Ext User
    Join Date
    Aug 2010
    Posts
    46
    Vote Rating
    0
    4CastRisk is on a distinguished road

      0  

    Default


    Basically I have a TreeStore for an organisation chart and want to draw that on the screen, with links - seems like a lot just to create a simple rectangle, especially when I want to hang event handlers off it as well for menus, and I want to be able to dynamically add new items to the surface as the organisation grows.

    Surely there is a simple API for this? I mean the developer of Raphael works at Sencha on this, and this is the API they ended up going with rather than something simpler like Raphaels?

  5. #5
    Sencha User
    Join Date
    Mar 2011
    Posts
    114
    Vote Rating
    6
    johanhaest is on a distinguished road

      0  

    Default


    I don't know, there doesn't seem to be any information for this at all.

  6. #6
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661
    Vote Rating
    20
    Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough Jamie Avins is a jewel in the rough

      0  

    Default


    We continue to work on documentation. A large charting document will be part of the next release and a Draw document will follow after.

Similar Threads

  1. image sprite
    By majid mir in forum Ext 3.x: Help & Discussion
    Replies: 2
    Last Post: 24 Feb 2010, 3:08 AM
  2. Sprite feature?
    By ilazarte in forum Ext 2.x: Help & Discussion
    Replies: 3
    Last Post: 1 May 2009, 11:33 AM
  3. Replies: 1
    Last Post: 5 Dec 2008, 1:55 PM
  4. Potential Release 4 and draw issues
    By ericd in forum Ext 1.x: Help & Discussion
    Replies: 16
    Last Post: 4 Feb 2007, 5:17 AM
  5. Sprite Looping
    By JohnT in forum Ext 1.x: Help & Discussion
    Replies: 3
    Last Post: 28 Jan 2007, 12:32 PM

Thread Participants: 3

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi