Hi!

 I'm using the prototype window class to play on my personnal website
(http://dindinx.net/), nothing serious, but this allows me to learn
javascript and prototype in a fun way :)

However, I've noticed some strange drawing bugs when two windows
overlaps, such as the one you can see here:
http://dindinx.net/files/javawin-bug.png

After some investigations, I've discovered that this bug only shows if
at least one of the two windows has some non-interger values in px for
left or top. This can happen since the windows are put at a random place
when the left and top properties aren't set, and Math.rand returns a
floatting point value.

This smallish patch fix this behaviour:

--- window.js
+++ window.js.new
@@ -80,9 +80,9 @@
     }, arguments[optionIndex] || {});

     if (typeof this.options.top == "undefined" &&  typeof this.options.bottom 
==  "undefined")
-      this.options.top = Math.random()*500;
+      this.options.top = Math.floor(Math.random()*500);
     if (typeof this.options.left == "undefined" &&  typeof this.options.right 
==  "undefined")
-      this.options.left = (Math.random()*500;
+      this.options.left = Math.floor(Math.random()*500);

     if (this.options.effectOptions) {
       Object.extend(this.options.hideEffectOptions, 
this.options.effectOptions);


      Regards,

             DindinX

-- 
[EMAIL PROTECTED]

_______________________________________________
Javawin mailing list
[email protected]
http://mail.xilinus.com/mailman/listinfo/javawin_xilinus.com

Reply via email to