[Laszlo-checkins] r12112 - openlaszlo/trunk/lps/components/base

bargull@openlaszlo.org bargull at openlaszlo.org
Sun Dec 14 12:01:17 PST 2008


Author: bargull
Date: 2008-12-14 12:01:13 -0800 (Sun, 14 Dec 2008)
New Revision: 12112

Modified:
   openlaszlo/trunk/lps/components/base/basescrollbar.lzx
   openlaszlo/trunk/lps/components/base/submit.lzx
   openlaszlo/trunk/lps/components/base/swatchview.lzx
Log:
Change 20081213-bargull-kO9 by bargull at dell--p4--2-53 on 2008-12-13 19:12:22
    in /home/Admin/src/svn/openlaszlo/trunk
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: scrollbar issue; can't use delete in swf9

New Features:

Bugs Fixed: LPP-7472, LPP-7475

Technical Reviewer: promanik
QA Reviewer: (pending)
Doc Reviewer: (pending)

Documentation:

Release Notes:

Details:
You can't delete fixed attributes (defined at compile time) in swf9, instead set them to `null`. (LPP-7475)

lz.basescrollthumb:
- move code from onmousedown/up handler into startDrag() resp. stopDrag() 
- add to startDrag() the init-code from thumbControl() 
- change thumbControl() use new thumb-position ("thumbpos") instead of the previous one ("this[this.axis]") (main fix for LPP-7472)


    

Tests:
see bugreport for LPP-7472



Modified: openlaszlo/trunk/lps/components/base/basescrollbar.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/basescrollbar.lzx	2008-12-14 16:30:06 UTC (rev 12111)
+++ openlaszlo/trunk/lps/components/base/basescrollbar.lzx	2008-12-14 20:01:13 UTC (rev 12112)
@@ -272,11 +272,11 @@
                 this.heightDel = null;
             }
 
-            delete this.scrolltarget;
-            delete this.focusview;
-            delete this.othersb;
+            this.scrolltarget = null;
+            this.focusview = null;
+            this.othersb = null
 
-            super.destroy.apply(this, arguments);
+            super.destroy();
         ]]></method>
 
         <!---  @keywords private -->
@@ -534,24 +534,58 @@
     <!--- Basescrollthumb expects to be within a basescrollbar (or a subclass).
           In other words, its "classroot" must be a scrollbar. -->
     <class name="basescrollthumb" extends="basecomponent"
-           focusable="false" styleable="false"
-           onmousedown="classroot.targetPosDel.disable(); this.startDrag = true;
-                        this[classroot.axis+'thumbdrag'].setAttribute('applied', true)"
-           onmouseup="this[classroot.axis+'thumbdrag'].setAttribute('applied', false);
-                      classroot.targetPosDel.enable();">
+           focusable="false" styleable="false" >
         <!--- @keywords private -->
-       <handler name="oninit">
-           classroot.thumb = this;
-       </handler>
-        
+        <attribute name="target" value="null" />
         <!--- @keywords private -->
+        <attribute name="axis" value="" type="string" />
+        <!--- @keywords private -->
+        <attribute name="trackscroll" value="0" type="number" />
+        <!--- @keywords private -->
+        <attribute name="targetscroll" value="0" type="number" />
+
+        <!--- @keywords private -->
+        <method name="init">
+            super.init();
+            this.classroot.thumb = this;
+        </method>
+
+        <!--- @keywords private -->
         <method name="destroy" ><![CDATA[
-            delete this.classroot.thumb;
-            delete this.target;
-            
-            super.destroy.apply(this, arguments);
+            this.classroot.thumb = null;
+            this.target = null;
+
+            super.destroy();
         ]]></method>
-        
+
+        <!--- @keywords private -->
+        <handler name="onmousedown" method="startDrag" />
+        <!--- @keywords private -->
+        <handler name="onmouseup" method="stopDrag" />
+
+        <!--- @keywords private -->
+        <method name="startDrag" args="ignore=null"><![CDATA[
+            var croot = this.classroot;
+            // disable targetpos delegate while dragging
+            croot.targetPosDel.disable();
+            // calculate temp var for what doesn't change while dragging
+            var sizeAxis = croot.sizeAxis;
+            this.target = croot.scrolltarget;
+            this.axis = croot.axis;
+            this.trackscroll = this.immediateparent[sizeAxis] - this[sizeAxis];
+            this.targetscroll = croot.scrollmax - this.target.immediateparent[sizeAxis];
+            // apply thumbdrag state
+            this[this.axis + 'thumbdrag'].setAttribute('applied', true);
+        ]]></method>
+
+        <!--- @keywords private -->
+        <method name="stopDrag" args="ignore=null"><![CDATA[
+            // remove thumbdrag state
+            this[this.axis + 'thumbdrag'].setAttribute('applied', false);
+            // re-enable targetpos delegate
+            this.classroot.targetPosDel.enable();
+        ]]></method>
+
         <state name="ythumbdrag">
             <attribute name="doffset" value="this.getMouse( 'y' )" when="once" />
             <attribute name="y"
@@ -565,32 +599,19 @@
         </state>
 
         <!--- @keywords private -->
-        <method name="thumbControl" args="mousepos">
-            <![CDATA[
-            // thumbControl method becomes a method of 'thumb'
-            // when the state is applied
-            if (this.startDrag) {
-              // calculate temp var for what doesn't change while dragging
-                var sizeAxis = classroot.sizeAxis;
-                this.target = classroot.scrolltarget;
-                this.axis = classroot.axis;
-                this.trackscroll = this.immediateparent[sizeAxis] - this[sizeAxis];
-                this.targetscroll = classroot.scrollmax -
-                    classroot.scrolltarget.immediateparent[sizeAxis];
-                this.startDrag = false;
+        <method name="thumbControl" args="mousepos"><![CDATA[
+            var thumbpos = mousepos - this.doffset;
+            if (thumbpos <= 0) {
+                thumbpos = 0;
+            } else if (thumbpos > this.trackscroll) {
+                thumbpos = this.trackscroll;
             }
-            var pos = Math.round(-this[this.axis] /  this.trackscroll * this.targetscroll);
 
+            var pos = Math.round(-thumbpos / this.trackscroll * this.targetscroll);
+            this.target.setAttribute(this.classroot.scrollattr, pos);
 
-            this.target.setAttribute(classroot.scrollattr, pos);
-
-            var thumbpos = mousepos - this.doffset;
-            if (thumbpos <= 0) return 0;
-            if (thumbpos > this.trackscroll) return this.trackscroll;
-
             return thumbpos;
-            ]]>
-        </method>
+        ]]></method>
 
         <doc>
           <tag name="shortdesc"><text>Provides non-visual aspects of a scrollbar thumb.</text></tag>
@@ -611,11 +632,11 @@
             <attribute name="direction" value="1"/>
             <!--- @keywords private -->
             <handler name="onmousedown">
-                classroot.step(this.direction);
+                this.classroot.step(this.direction);
             </handler>
             <!--- @keywords private -->
             <handler name="onmousestilldown">
-                classroot.step(this.direction);
+                this.classroot.step(this.direction);
             </handler>
         <doc>
           <tag name="shortdesc"><text>Provides non-visual aspects of scrollbar's arrow.</text></tag>
@@ -638,17 +659,12 @@
         <attribute name="direction" value="1"/>
         <!--- @keywords private -->
         <handler name="onmousedown">
-            //setAttribute('bgcolor', 0x000000);
-            classroot.page(this.direction);
+            this.classroot.page(this.direction);
         </handler>
         <!--- @keywords private -->
         <handler name="onmousestilldown">
-            classroot.page(this.direction);
+            this.classroot.page(this.direction);
         </handler>
-        <!--- @keywords private -->
-        <handler name="onmouseup">
-            //setAttribute('bgcolor', 0xdedede);
-        </handler>
         <doc>
           <tag name="shortdesc"><text>Provides non-visual aspects of a scrollbar track.</text></tag>
           <text>

Modified: openlaszlo/trunk/lps/components/base/submit.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/submit.lzx	2008-12-14 16:30:06 UTC (rev 12111)
+++ openlaszlo/trunk/lps/components/base/submit.lzx	2008-12-14 20:01:13 UTC (rev 12112)
@@ -107,15 +107,15 @@
         <method name="_clearDels">
             if (this._dataDel) {
                 this._dataDel.unregisterAll();
-                delete this._dataDel;
+                this._dataDel = null;
             }
             if (this._errorDel) {
                 this._errorDel.unregisterAll();
-                delete this._errorDel;
+                this._errorDel = null;
             }
             if (this._timeoutDel) {
                 this._timeoutDel.unregisterAll();
-                delete this._timeoutDel;
+                this._timeoutDel = null;
             }
         </method>
 

Modified: openlaszlo/trunk/lps/components/base/swatchview.lzx
===================================================================
--- openlaszlo/trunk/lps/components/base/swatchview.lzx	2008-12-14 16:30:06 UTC (rev 12111)
+++ openlaszlo/trunk/lps/components/base/swatchview.lzx	2008-12-14 20:01:13 UTC (rev 12112)
@@ -65,7 +65,6 @@
         @param Object o: color transform object (see view.setColorTransform for details)
     -->
     <method name="setColorTransform" args="o">
-        delete this.ctransform;
         this.ctransform = o;
         this.setAttribute('bgcolor', this.color);
     </method>



More information about the Laszlo-checkins mailing list