ENART.POLALA.COM
welcome to my space
X
Coffee | Sexuality | Medicine | Elderly Care | Soccer | Insurance | Small Business | Exotic Locations | Related articles

constrainTo sets global variable

Published by: webmaster 2010-03-19
  • It had been originally posted on community and was told to post as a bug

    1. Ext version 1.1
    2. ext-base.js / ext-core.js/ DDCore-min.js/ JSON-min.js
    3. windows xp and linux?
    4. browser FF 2.0, 1.5

    Ok, I noticed that there was a xy array declared in the global scope; after hours trying to figure if my code was doing it I found out it's from the library.

    when you instantiate a DD object and use the constrainTo function (not in the API), this same function declares xy on this part of the code in bold

    constrainTo : function(constrainTo, pad, inContent){
    if(typeof pad == "number"){
    pad = {left: pad, right:pad, top:pad, bottom:pad};
    }
    pad = pad this.defaultPadding;
    var b = Ext.get(this.getEl()).getBox();
    var ce = Ext.get(constrainTo);
    var s = ce.getScroll();
    var c, cd = ce.dom;
    if(cd == document.body){
    c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
    }else{
    xy = ce.getXY();
    c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
    }


    var topSpace = b.y - c.y;
    var leftSpace = b.x - c.x;

    this.resetConstraints();
    this.setXConstraint(leftSpace - (pad.left0), // left
    c.width - leftSpace - b.width - (pad.right0) //right
    );
    this.setYConstraint(topSpace - (pad.top0), //top
    c.height - topSpace - b.height - (pad.bottom0) //bottom
    );
    },

    Notice that xy is not declare up on top, and if you "alert" xy before and after the constrainTo() call you will see that xy will appear in the global scope.

    I fixed my DDCore-min.js, and declared xy locally in constrainTo() and it works now.

    usage:

    var sDD =new Ext.dd.DD("slider");
    sDD.constrainTo("slider_cont");


  • include this patch in your overrides file till the next release of Ext

    Ext.override(Ext.dd.DragDrop, {
    constrainTo : function(constrainTo, pad, inContent){
    if(typeof pad == "number"){
    pad = {left: pad, right:pad, top:pad, bottom:pad};
    }
    pad = pad this.defaultPadding;
    var b = Ext.get(this.getEl()).getBox();
    var ce = Ext.get(constrainTo);
    var s = ce.getScroll();
    var c, cd = ce.dom;
    if(cd == document.body){
    c = { x: s.left, y: s.top, width: Ext.lib.Dom.getViewWidth(), height: Ext.lib.Dom.getViewHeight()};
    }else{
    var xy = ce.getXY();
    c = {x : xy[0]+s.left, y: xy[1]+s.top, width: cd.clientWidth, height: cd.clientHeight};
    }

    var topSpace = b.y - c.y;
    var leftSpace = b.x - c.x;

    this.resetConstraints();
    this.setXConstraint(leftSpace - (pad.left0), // left
    c.width - leftSpace - b.width - (pad.right0) //right
    );
    this.setYConstraint(topSpace - (pad.top0), //top
    c.height - topSpace - b.height - (pad.bottom0) //bottom
    );
    }
    });


  • Fixed in SVN. There was also an undeclared "i" var in unregAll that was corrected in the same file.





  • Allergies.. no relief?!?
    Religion in the workplace?
  • love your job too much philadephia mt holly afd
  • thunder classifications wink
  • satellite shot of tx ok dust cloud
  • winds of change end of drought maybe
  • the enhanced f scale takes effect february 2006
  • news 2006 college of dupage severe weather conference
  • don t hold your breath for 2006 spc watch 15
  • noaa predicts weak la niŅa
  • can anyone identify this tornado or afb in the foreground
  • nws radar web presentations will change on jan 31st
  • finally a good storm in iraq
  • ice age is coming
  • katrina video needed
  • high shear low instability tornadic storm
  • dry line strategy
  •  
  • 2006 chase tour roundup
  • jan 2 2006
  • 1947 the logan county f4
  • my 2006 svr wx forecast
  • no sign of winter
  • 1 12 06 arkansas tornado
  • interesting hole punch clouds
  • unnamed storm feature
  • overlay storm reports on spc outlooks
  • nws new glossary feature available for text products
  • supercell photograph contest 2
  • drought in the southern plains
  • seattle wa 23 rainy days and going for record
  • dust bowl era and tornadoes
  • Search:  
    #If you have any other info about this subject , Please add it free.#
    Your name:
    E-mail:
    Telphone:

    Your comments:


    If you have any other info about constrainTo sets global variable , Please add it free.

    About us -Site map -Advertisement -Jion us -Contact usExchange linksSponsor us
    Copyright© 2008 enart.polala.com All Rights Reserved
    Site made&Support support@enart.polala.com    E-mail: web@enart.polala.com