Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: [REOPEN-103][3.0.0] DD of Resizable does not listen to constrainTo

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Ext JS Premium Member robincasey's Avatar
    Join Date
    Nov 2007
    Location
    Netherlands, Arnhem
    Posts
    53

    Default [REOPEN-103][3.0.0] DD of Resizable does not listen to constrainTo

    On the ExtJS examples page of Resizables, run:
    Code:
    var div = Ext.DomHelper.insertBefore(document.body.firstChild, {
        tag: "div",
        style: "background:#ff0;width: 200px;height: 300px;"
    });
    var img = Ext.DomHelper.append(div, {
        tag: "img",
        src: "zack.jpg",
        height: 100
    })
    var transparent = new Ext.Resizable(img, {
        wrap: true,
        dynamic: true,
        draggable: true,
        constrainTo: div
    });
    I am expecting the Resizable, when draggable, not to be able to be dragged out of the constrainTo area.


    Added:
    transparent.dd.constrainTo(transparent.constrainTo); is a possible patch
    Last edited by robincasey; 22 Jul 2009 at 3:33 AM. Reason: Added possible patch

  2. #2
    Ext User
    Join Date
    Jul 2007
    Location
    Florida
    Posts
    9,996

    Default

    Thanks for this and the other specific reports (not lumped together).

    I also noted that when resizing I can sometimes resize that resizable item slightly outside of the div. Play with it a little bit though, sometimes it constrains inside, but depending where you drag it, it doesn't constrain the resizing either.

  3. #3

    Default

    I got the constrainTo part to work, but the problem described in the post above is what I am running in to now
    http://extjs.com/forum/showthread.ph...607#post370607

  4. #4

    Default

    I do believe I fixed the problem with the resized element not being constrained correctly...

    the patch below should fix it in addition to the fix in the link to the other post to initialize it
    Code:
    Ext.override(Ext.Resizable, {
        resizeElement : function(){
            var box = this.proxy.getBox();
            if(this.updateBox){
                this.el.setBox(box, false, this.animate, this.duration, null, this.easing);
            }else{
                this.el.setSize(box.width, box.height, this.animate, this.duration, null, this.easing);
            }
            this.updateChildSize();
            if(!this.dynamic){
                this.proxy.hide();
            }
    //////////////////
            if(this.draggable && this.constrainTo) {
                this.dd.resetConstraints();
                this.dd.constrainTo(this.constrainTo);
            }
    //////////////////
            return box;
        }
    });

  5. #5
    Sencha User ludoo's Avatar
    Join Date
    Mar 2007
    Location
    France
    Posts
    67

    Default

    This patch works well only if item has been resized before.
    Try to drag item inside container before resizing, then constraints won't be applied.

    May be an init problem ?

  6. #6

    Default

    look at the url in post #4, it has the init changes as well

  7. #7
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,258

    Default

    Fix applied to svn in rev #5679 for patch release 3.1.

    Thanks for the patch.
    Twitter - @evantrimboli
    Former Sencha framework engineer, available for consulting.
    As of 2017-09-22 I am not employed by Sencha, all subsequent posts are my own and do not represent Sencha in any way.

  8. #8

    Default 3.1.1 Drag Drop Resizable constrainTo


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

    Default

    Reopened, closing 670 as a duplicate.

  10. #10
    Ext JS Premium Member robincasey's Avatar
    Join Date
    Nov 2007
    Location
    Netherlands, Arnhem
    Posts
    53
    onerror = setTimeout(Ext.emptyFn, Infinity)

Page 1 of 2 12 LastLast

Posting Permissions

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