I have been going on about non optimal scrolling performance with the qooxdoo
scrollbar ... for example here:

http://demo.qooxdoo.org/current/demobrowser/#virtual~Table.html
(try it in firefox or IE)

I spent some quality time with the code to figure out the issues at work.

As the scrollbar is moved, it issues changeValue events. Whoever
whants to 'scroll' along adds a listener to this event.

It seems that, due to the virtual table takeing quite some time
to render, the system overwhelms itself with screen updates exhibitng sub 
optimal
usability.

The patch below implements the idea to measure how much time the
system spends processing the event handlers. And then only fiering
new changeValue events at half that frequncy.

With this change, scrolling becomes fun again.

Another idea would be to use a timer in drag mode. It again would measure the 
time required for processing the events and then tune itself to send
value updates at the given interval as long as the value changes from one 
interval to the next.
When drag mode ends, the timer would be stopped.

--- Slider.js.orig      2010-07-01 14:58:23.000000000 +0200
+++ Slider.js   2010-07-01 16:16:15.000000000 +0200
@@ -105,7 +105,9 @@
   },


-
+  events : {
+    changeValue: 'qx.event.type.Data'
+  },

   /*
   *****************************************************************************
@@ -152,7 +154,6 @@
       check : "typeof 
value==='number'&&value>=this.getMinimum()&&value<=this.getMaximum()",
       init : 0,
       apply : "_applyValue",
-      event : "changeValue",
       nullable: true
     },

@@ -237,7 +238,7 @@
     __trackingDirection : null,
     __trackingEnd : null,
     __timer : null,
-
+    __nextValueEvent: 0,

     // overridden
     /**
@@ -979,7 +980,15 @@
     _applyValue : function(value, old) {
       if (value != null) {
         this._updateKnobPosition();
-      } else {
+               // moderate  ourselfes in firering events only spend
+               // a maximum of 50% of the time processing the event handlers
+               var start = new Date().getTime();
+               if (start > this.__nextValueEvent){
+                       this.fireEvent('changeValue',qx.event.type.Data,[value, 
old]);
+                       var duration = new Date().getTime() - start;
+                       this.__nextValueEvent = start + duration * 2;
+               }
+         } else {
         this.resetValue();
       }
     },

-- 
Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
http://it.oetiker.ch [email protected] ++41 62 775 9902 / sb: -9900

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to