View Full Version : Why does moving the IFRAME shim slow things down?

27 Dec 2006, 12:18 PM
In an effort to use the IFRAME shim when using a proxy element for dragging a BasicDialog, I modified the onDrag function on BasicDialog to set the bounds of the shim to the bounds of the proxy:

onDrag : function(){
this.xy = this.el.getXY();
} else if (this.shim) {
this.shim.setBounds(this.proxy.getX(), this.proxy.getY(), this.proxy.getWidth(), this.proxy.getHeight());

This works, but I've noticed that performance wise, the dialog drags much slower. I realize I'm doing more work while dragging the dialog, but it seems that setting the bounds of the shim shouldn't cost that much. Does anyone know why this would slow things down signficantly?

Also, I noticied in the latest code from SVN that the iframe shim in BasicDialog is disabled in Firefox:

// adding an iframe shim to FF kills the cursor on the PC, but is needed on the Mac
// where it (luckily) does not kill the cursor
if(!YAHOO.ext.util.Browser.isGecko || YAHOO.ext.util.Browser.isMac){
this.shim = this.el.createShim();
this.shim.hide = this.hideAction;
this.shim = false;

Unfortunately I need the iframe shim in FF and IE in order to get the BasicDialog(s) to float over Flash content. I haven't seen the shim killing the cursor in FF -- is there a bug related to this change?

28 Dec 2006, 3:11 AM
FireFox 2 it kills the cursor.

The slower dragging could be related to the multi-calls to getX and getY both traverse the offsetParents to calculate an xy.

Try using this.shim.setBox(this.proxy.getBox());

If your proxy and shim are both rendered to the body, you can also use:

this.shim.setLeftTop(this.proxy.getLeft(true), this.proxy.getTop(true)) which will skip the calls to YUI getXY/setXY so it will be much faster.