[Laszlo-checkins] r16883 - openlaszlo/trunk/WEB-INF/lps/lfc/core

max@openlaszlo.org max at openlaszlo.org
Tue Jul 6 12:59:51 PDT 2010


Author: max
Date: 2010-07-06 12:59:47 -0700 (Tue, 06 Jul 2010)
New Revision: 16883

Modified:
   openlaszlo/trunk/WEB-INF/lps/lfc/core/LzEventable.lzs
   openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
Log:
Change 20100703-maxcarlson-u by maxcarlson at friendly on 2010-07-03 09:10:37 PDT
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Keep CSS3 transitions from running until after init time

Bugs Fixed: LPP-9020 -Support CSS3 transitions

Technical Reviewer: hminsky
QA Reviewer: ptw

Details: LzNode - __skipSetter() returns true if ! inited, allowing the default setter to run.

LzEventable - Change __skipSetter() to allow conditionally skipping the setter depending on the return value.

Tests: The button doesn't animate until it's clicked:
<canvas>
    <button transition="x 2s" x="100" onclick="this.setAttribute('x', 200)">Hello Laszlo!</button>
</canvas> 



Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzEventable.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzEventable.lzs	2010-07-06 19:42:18 UTC (rev 16882)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzEventable.lzs	2010-07-06 19:59:47 UTC (rev 16883)
@@ -130,14 +130,15 @@
    * calling the setter.
    * @access private
    */
-  protected var __LZskipsetter:Object = {};
+  protected var customSetters:Object = {};
 
   /**
-   * If __LZskipsetter[prop] is true, this method will be called by 
+   * If customSetters[prop] is true, this method will be called by 
    * setAttribute() instead of the setter/property being updated.
    * @access private
    */
-  protected function __skipSetter(prop:String, val) {
+  protected function __invokeCustomSetter(prop:String, val):Boolean {
+    return false;
   }
 
   /**
@@ -161,11 +162,12 @@
     }
     if (this.__LZdeleted) { return; }
 
-    if (this.__LZskipsetter[prop]) {
-      // Optionally do something, then
-      this.__skipSetter(prop, val);
-      // skip the setter
-      return;
+    // If this property has skipsetter set
+    if (this.customSetters[prop]) {
+      if (this.__invokeCustomSetter(prop, val) == true) {
+        // Return early to skip setter
+        return;
+      }
     }
 
     // Must agree with NodeModel in tag compiler

Modified: openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs	2010-07-06 19:42:18 UTC (rev 16882)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/core/LzNode.lzs	2010-07-06 19:59:47 UTC (rev 16883)
@@ -2511,8 +2511,8 @@
    // Overwrite old list of transitions
    this.__transitionAttributes = transitions;
    // Register/unregister for callbacks for transition attributes
-   this.__LZskipsetter = transitions
-   //Debug.info('set_transition', css, transitions, this.__LZskipsetter);
+   this.customSetters = transitions
+   //Debug.info('set_transition', css, transitions, this.customSetters);
  }
 
  /**
@@ -2522,13 +2522,17 @@
   *
   * @access private
   */
- override protected function __skipSetter(prop:String, val) {
+ override protected function __invokeCustomSetter(prop:String, val):Boolean {
+   // If not inited, continue with setter
+   if (this.inited != true) return false;
+
    var ta = this.__transitionAttributes && this.__transitionAttributes[prop];
    // avoid animating to the same value
    if (ta && this[prop] !== val) {
      //Debug.warn('__animateTransition', prop, val, ta);
      this.animate(prop, val, ta.duration, false, {motion: ta.motion});
    }
+   return true;
  }
 
 } // End of LzNode



More information about the Laszlo-checkins mailing list