This duplicates another bug already reported in our system: EXTJS-4581
  1. #1
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Exclamation Ext.draw.Sprite draggable: true Bug?

    Ext.draw.Sprite draggable: true Bug?


    Hi guys, I'm starting dev on an App and I have a really simple example of a page that renders some sprites on a draw component. When I set draggable to true on the sprites though the page generates an error in Google Chrome:
    Uncaught TypeError: Cannot read property 'dom' of undefined

    line 57279 of ext-all-debug, it's the if (me.el.dom.childNodes[idx + 2] line
    Code:
    applyZIndex: function(sprite) {
            var me = this,
                items = me.items,
                idx = items.indexOf(sprite),
                el = sprite.el,
                prevEl;
            if (me.el.dom.childNodes[idx + 2] !== el.dom) {
                if (idx > 0) {
                    do {
                        prevEl = items.getAt(--idx).el;
                    } while (!prevEl && idx > 0);
                }
                el.insertAfter(prevEl || me.bgRect);
            }
            sprite.zIndexDirty = false;
        }
    My code is very simple, just comment out draggable: true and it works fine:

    Code:
    Ext.ns("Gal");
    
    
    Ext.onReady(function() {
    
    
    	var tiles = [];
    	for(var i = 0, j = 0, leftShift = false, y = 0; i < 20; i++, j++)
    	{
    		if(i % 5 == 0 && i != 0)
    		{
    			if(leftShift)
    				leftShift = false;
    			else
    				leftShift = true;
    			j = 0;
    			y = y + 150;
    		}
    		tiles.push({
    			id:   "space_hex_" + i,
    			group: "game_hexes",
    			type: 'rect',
    			src:  "space_hex.png",
    			width: 200,
    			height: 200,
    			fill: "#000000",
    			draggable: true,
    			x: (200 * j) + (leftShift ? 100 : 0),
    			y: y/*,
    			listeners: {
    				mouseover: function(tile){
    					tile.setAttributes({
    						src: "space_hex_hover.png"
    					}, true);
    				},
    				mouseout: function(tile){
    					tile.setAttributes({
    						src: "space_hex.png"
    					}, true);
    				},
    				click: function(){
    					var gameHexes = Gal.drawComponent.surface.getGroup('game_hexes');
    					gameHexes.animate({
    						duration: 1000,
    						to: {
    							translate: {
    								y: Math.floor(Math.random()*111)
    							}
    						}
    					});
    				}
    			}*/
    		});
    	}	
    
    
    	Gal.drawComponent = Ext.create('Ext.draw.Component', {
    		viewBox: false,
    		items: tiles
    	});
    
    
    	Gal.cheese = Ext.create('Ext.Panel', {
    		width: 215,
    		height: 235,
    		region: "center",
    		layout: 'fit',
    		items: [Gal.drawComponent]
    	});
    
    
    	Gal.viewport = Ext.create('Ext.Viewport', {
    		items: [Gal.cheese],
    		layout: "border"
    	});
    });

  2. #2
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    I'm using Ext 4.0.6, sorry as that's probably important.

  3. #3
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Tried this in Ext 4.0.7 and it still doesn't work. Actually I've tried my example with just rendering the draw component to the document.body and it still doesn't work It's like draggable sprites don't work period.

  4. #4
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    No one has experienced this issue?

  5. #5
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Here is a much more simplified example if that helps:
    Code:
    Ext.ns("Gal");
    
    
    
    
    Ext.onReady(function() {
    
    
    
    
    	var tiles = [{
    			id:   "space_hex_1",
    			group: "game_hexes",
    			type: 'rect',
    			width: 200,
    			height: 200,
    			fill: "#000000",
    			draggable: true,
    			x: 200,
    			y: 200
    		}];
    
    
    
    
    	Gal.drawComponent = Ext.create('Ext.draw.Component', {
    		viewBox: false,
    		items: tiles
    	});
    
    
    
    
    	Gal.cheese = Ext.create('Ext.Panel', {
    		width: 215,
    		height: 235,
    		region: "center",
    		layout: 'fit',
    		items: [Gal.drawComponent]
    	});
    
    
    
    
    	Gal.viewport = Ext.create('Ext.Viewport', {
    		items: [Gal.cheese],
    		layout: "border"
    	});
    });

  6. #6
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,483
    Vote Rating
    218
    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 LesJ is a splendid one to behold

      0  

    Default


    Quote Originally Posted by Reimius View Post
    No one has experienced this issue?
    This forum has a search feature

    There are at least two tickets created related to draggable sprites.

  7. #7
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Wow... thanks for being unhelpful. I have read those threads and they are not the same issue.

    What I meant by what I said was that I find it hard to believe that no one uses the draggable sprites because it seems to me that they don't work at all, even with a simple example.

  8. #8
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,483
    Vote Rating
    218
    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 LesJ is a splendid one to behold

      0  

    Default


    Quote Originally Posted by Reimius View Post
    Wow... thanks for being unhelpful. I have read those threads and they are not the same issue.

    What I meant by what I said was that I find it hard to believe that no one uses the draggable sprites because it seems to me that they don't work at all, even with a simple example.

    If you searched this forum as you claim, you would find out that draggable sprites are not stable. There was even one post where the author implemented his own logic for dragging sprites.

  9. #9
    Ext JS Premium Member
    Join Date
    Apr 2010
    Location
    Midwest, USA
    Posts
    96
    Vote Rating
    2
    Reimius is on a distinguished road

      0  

    Default


    Posting those links is actually the helpful thing to do.

  10. #10
    Touch Premium Member
    Join Date
    Nov 2010
    Location
    Chicago
    Posts
    1,483
    Vote Rating
    218
    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 LesJ is a splendid one to behold

      0  

    Default


    Quote Originally Posted by Reimius View Post
    Posting those links is actually the helpful thing to do.
    Here's one bug that I experienced and thankfully it was fixed in 4.1

    http://www.sencha.com/forum/showthre...-Follow-Cursor

Thread Participants: 1

Tags for this Thread