Results 1 to 6 of 6

Thread: Draggable : drag area is offset based on position of component

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2189 in a recent build.
  1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    11

    Default Draggable : drag area is offset based on position of component

    The drag works only in the south and east and overshoots the container. The total drag area is fine ..maybe offset calculation is messed up..

    Am I missing something or is this a bug? if a bug any kludge out there..


    ---
    Code:
    Ext.application({
        name: 'dragndrop',
        requires: ['Ext.Container', 'Ext.Panel'],
    
    
        launch: function(){
    
    
            var outer = Ext.create('Ext.Container', {
                            height    : '50%',
                            width    : '50%',
                            top        : '20%',
                            left    : '20%',
                            style    : 'background-color:gray;'
            });
            Ext.Viewport.add(outer);
            
            var drag1 = Ext.create('Ext.Panel', {
                            draggable: true,
                            height    : '10%',
                            width    : '10%',
                            top        :  '0%',
                            left    :  '0%',
                            style    : 'background-color:yellow;'
            });
            
            outer.add(drag1);
            
            var drag2 = Ext.create('Ext.Panel', {
                            draggable: true,
                            height    : '10%',
                            width    : '10%',
                            top        : '50%',
                            left    : '50%',
                            style    : 'background-color:red;',
            });
            
            outer.add(drag2);
        }
    });

  2. #2
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    Sounds like a bug, we'll check into it.

    Sencha Inc

    Jamie Avins

    @jamieavins

  3. #3
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,388

    Default

    I'm going to open a ticket for this as your code should work. I would expect the drag2 to act the same as drag1 but obviously it doesn't.
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  4. #4
    Sencha User
    Join Date
    Jan 2012
    Posts
    11

    Default Addon to the issue

    Thanks gentlemen for the quick reply.

    Just wanted to add one more request. I would like to set constraint = null in case i dont want the draggable to be constrained. Currently I get this error.
    TypeError: 'undefined' is not an object (evaluating 'minOffset.x') in Draggable.js line 283.

    Guess - I am stuck for a while since I am not able to workaround it since the only choice is 'container' and null is not working.

  5. #5
    Sencha User Jamie Avins's Avatar
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    We are updating Draggable to accept the same config as Scroller which is initialOffsets so you can change the initial positioning of the draggable item. For example:

    Code:
                    var drag2 = Ext.create('Ext.Panel', {
                        draggable: {
                            initialOffset: 50
                        },
                        top:'0%',
                        left:'0%',
                        height:'10%',
                        width:'10%',
                        style:'background-color:red;'
                    });
    Note that the initialOffset cannot be a string and doesn't support percentages. We may support this in the future, but there's a lot of code that would have to be in place to do this sort of thing.

    The other issue with setting the constraint to null is also fixed in the next version.

    Sencha Inc

    Jamie Avins

    @jamieavins

  6. #6
    Sencha User
    Join Date
    Jan 2012
    Posts
    11

    Default thanks

    the suggested changes do help a lot.. also for now I am wrapping the floating panels inside a fixed size panel so not a burning issue for now... Look forward to percentage values down the line..

Tags for this Thread

Posting Permissions

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