Update of /cvsroot/dynapi/dynapi/src/lib/dynapi/gui
In directory usw-pr-cvs1:/tmp/cvs-serv8580
Modified Files:
label.js
Log Message:
Ns6 fixes + other. Still not perfect but very close to it. I've had to include a
setInterval check, waiting for the content's size to update, synchronizing with pack()
calls. Simply painful
Index: label.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi/src/lib/dynapi/gui/label.js,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** label.js 2001/01/25 21:13:35 1.10
--- label.js 2001/02/15 18:41:42 1.11
***************
*** 8,12 ****
dynapi.api [dynlayer, dyndocument, browser, events]
*/
-
function Label(text) {
this.DynLayer = DynLayer;
--- 8,11 ----
***************
*** 22,26 ****
--- 21,31 ----
this.pHeight = false;
this.selectable = true;
+ // NS6 dirty patch. Store old content's size in order to detect changes
+ this.oldCW = this.oldCH = 0;
+ this.contentChecker = null;
+ this.timeOut = 0;
+ this.packPending = null;
this.setText(text);
+
var listener = new EventListener(this);
listener.oncreate = function(e) {
***************
*** 35,47 ****
var o = e.target;
if (o.created) {
! if (o.pWidth && o.pHeight) {
!
o.setSize(o.getContentWidth(),o.getContentHeight(),false);
! }
! if (o.pWidth) {
! o.setWidth(o.getContentWidth(),false);
! }
! if (o.pHeight) {
! o.setHeight(o.getContentHeight(),false);
! }
}
};
--- 40,45 ----
var o = e.target;
if (o.created) {
! if(is.ns&&o.wrap) o.setText(o.text)
! o.pack(o.wrap&&o.pWidth,o.pHeight)
}
};
***************
*** 54,60 ****
e.cancelBrowserEvent();
};
};
Label.prototype = new DynLayer();
-
Label.prototype.setText = function(text) {
this.text = text || '';
--- 52,60 ----
e.cancelBrowserEvent();
};
+ this.selectListener.onmouseup = function(e) {
+ e.cancelBrowserEvent();
+ };
};
Label.prototype = new DynLayer();
Label.prototype.setText = function(text) {
this.text = text || '';
***************
*** 66,71 ****
--- 66,93 ----
var wrap = this.wrap? '':'nowrap';
this.textFull = '<table '+width+' cellpadding='+this.padding+' cellspacing=0
border=0><td align="'+this.align+'" '+wrap+'>'+styled+'</td></table>';
+
this.setHTML(this.textFull);
+ if(is.ns6) {
+ // Start interval contentsize update process. Will have to synchonize
+with any pack() calls
+ this.oldCW = this.getContentWidth()
+ this.oldCH = this.getContentHeight()
+ this.timeOut = 3
+ if(!this.contentChecker) {
+ //debug(text)
+ this.contentChecker = setInterval(this+".MozChkCnt()",50)
+ }
+ }
};
+ Label.prototype.MozChkCnt = function() {
+ if(this.getContentWidth()!=this.oldCW || this.getContentWidth()!=this.oldCH) {
+ this.timeOut = 0
+ //debug('canvi')
+ if(this.packPending!=null) { eval(this.packPending);
+this.packPending=null; }
+ } else {
+ //debug('nya')
+ this.timeOut--;
+ }
+ if(this.timeOut==0) { clearInterval(this.contentChecker);
+this.contentChecker=null; }
+ };
Label.prototype.setFontFamily = function(f,noevt) {
this.font.family = f;
***************
*** 125,135 ****
};
Label.prototype.pack = function(bWidth,bHeight) {
! if (bWidth==null && bHeight==null) {
! bWidth=bHeight=true;
! }
! var w = bWidth? this.getContentWidth() : this.w;
! var h = bHeight? this.getContentHeight() : this.h;
this.pWidth = bWidth;
this.pHeight = bHeight;
! if (this.created) this.setSize(w,h,false);
};
--- 147,162 ----
};
Label.prototype.pack = function(bWidth,bHeight) {
! if (!bWidth && bWidth!=false) bWidth=true;
! if (!bHeight && bHeight!=false) bHeight=true;
this.pWidth = bWidth;
this.pHeight = bHeight;
! if(is.ns6&&this.timeOut!=0&&(bWidth||bHeight)) {
! this.packPending = "this.pack("+bWidth+","+bHeight+")"
! //debug(this.packPending)
! } else {
! var w = bWidth? this.getContentWidth() : this.w;
! var h = bHeight? this.getContentHeight() : this.h;
! //debug(h)
! if (this.created) this.setSize(w,h,false);
! }
};
_______________________________________________
Dynapi-CVS mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dynapi-cvs