Results 1 to 10 of 10

Thread: Draw : unable to fire spriteclick event

  1. #1
    Sencha User
    Join Date
    Feb 2015
    Posts
    21
    Vote Rating
    1
      0  

    Default Answered: Draw : unable to fire spriteclick event

    Hi,

    I am trying to send an event on a sprite click but nothing happen ... a bug in the SpriteEvents plugin ?
    In doc this example does not work.

    In the following code afterrender event work but not spriteclick :

    Code:
    var drawContainer = Ext.create('Ext.draw.Container', {
        plugins: ['spriteevents'],
        renderTo: Ext.getBody(),
        width: 200,
        height: 200,
    
        sprites: [{
            type: 'circle',
            fillStyle: '#79BB3F',
            r: 50,
            x: 100,
            y: 100
        }],
    
        listeners: {
    
            afterrender: function(me) {
                var surface = me.getSurface(),
                    sprite = surface.getItems()[0];
    
                sprite.setAttributes({
                    fillStyle: 'black'
                });
    
                Ext.create('Ext.fx.Anim', {
                    target: surface,
                    duration: 8000,
                    to: {
                        opacity: .5
                    }
                });
            },
    
            spriteclick: function(sprite, event) {
                sprite.setAttributes({
                    fillStyle: 'red'
                });
                sprite.getSurface().renderFrame();
            }
    
        }
    });
    I only want to change color or size of a sprite if i click on it or on a button.

    Can you help plz ?

    Thx,

    Ludo

  2. Yes, this is a bug( EXTJS-16383). It's been resolved for the next release of Ext JS.

    Thanks
    Joel

  3. #2
    Sencha User yeghikyan's Avatar
    Join Date
    Mar 2009
    Location
    München
    Posts
    569
    Answers
    96
    Vote Rating
    46
      0  

    Default

    looks like to be a bug.
    The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague.

  4. #3
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446
    Vote Rating
    186
      0  

    Default

    Yes, this is a bug( EXTJS-16383). It's been resolved for the next release of Ext JS.

    Thanks
    Joel

  5. #4
    Sencha User
    Join Date
    Feb 2015
    Posts
    21
    Vote Rating
    1
      0  

    Default

    Thanks for your replies.

    But I dont understand why this example is working (http://cdn.sencha.com/ext/beta/ext-5.0.0.736/...) ?

    What is the date / version of the next release of Ext JS plz ? GPL and commercial ?

    Ludo

  6. #5
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446
    Vote Rating
    186
      0  

    Default

    Quote Originally Posted by lracapet View Post
    Thanks for your replies.

    But I dont understand why this example is working (http://cdn.sencha.com/ext/beta/ext-5.0.0.736/...) ?

    What is the date / version of the next release of Ext JS plz ? GPL and commercial ?

    Ludo
    Hi--

    That was an early beta--there were many changes in charts since then. Re: dates, I don't have any public dates that I can share.

    Thanks
    Joel

  7. #6
    Sencha User
    Join Date
    Jan 2012
    Location
    Moscow
    Posts
    22
    Answers
    2
    Vote Rating
    10
      0  

    Default

    Same problem with 5.1.1. Sprite events can`t be handled. If there were a workaround...

  8. #7
    Sencha User joel.watson's Avatar
    Join Date
    Nov 2014
    Posts
    3,120
    Answers
    446
    Vote Rating
    186
      0  

    Default

    Quote Originally Posted by odibo View Post
    Same problem with 5.1.1. Sprite events can`t be handled. If there were a workaround...
    Can you explain the issue you're having in 5.1.1? It seems to be working for me:



    Thanks!
    Joel

  9. #8
    Sencha User
    Join Date
    Jan 2012
    Location
    Moscow
    Posts
    22
    Answers
    2
    Vote Rating
    10
      0  

    Default

    Hi, Joel! Thank you for your answer with a fiddle example. It's good news. I have the problem with a composite sprite.

    https://fiddle.sencha.com/#fiddle/n6m

    Code:
    Ext.define('System.view.orgchart.tree.company.View', {
        extend: 'Ext.draw.sprite.Composite',
        alias:'sprite.treeCompany',
        
        constructor:function(){
            this.callParent(arguments);
    
            this.container = this.add({
                type: 'path',
                path: 'M'+10+' '+10+' h162 v100 h-162 v-100',
                fillStyle: '#B8DA83',
                strokeStyle: '#B8DA83'
            });
    
            
        }
    });
    
    Ext.application({
        name: 'Fiddle',
    
        launch: function() {
            var drawContainer = Ext.create('Ext.draw.Container', {
                plugins: ['spriteevents'],
                renderTo: Ext.getBody(),
                width: 200,
                height: 200,
                sprites: [{
                    type: 'treeCompany'
                }],
                listeners: {
                    spriteclick: function(item, event) {
                        alert(1);
                    }
                }
            });
        }
    });

  10. #9
    Ext JS Premium Member
    Join Date
    Oct 2007
    Posts
    37
    Answers
    3
    Vote Rating
    136
      1  

    Default

    Hi,

    I think that CompositeSprite should implement it's own hitTest method like this :



    in order for the events to work on CompositeSprite. Or is there another workaround for this Joel? Any hint will be appreciated.

    Thanks,
    Danny

  11. #10
    Sencha User
    Join Date
    Sep 2015
    Location
    Antwerp
    Posts
    12
    Answers
    1
    Vote Rating
    0
      0  

    Default

    Is there already a solution?
    How to capture the clickEvent when you are using a compositeSprite?

    I dont understand why this hitTest function is used for.


    Regards

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •