OSDN Git Service

Modify the accumulate attribute problem
authordhrname <dhrname@users.sourceforge.jp>
Tue, 1 Dec 2015 14:11:11 +0000 (23:11 +0900)
committerdhrname <dhrname@users.sourceforge.jp>
Tue, 1 Dec 2015 14:11:11 +0000 (23:11 +0900)
org/w3c/dom/smil.js
tool/Spec/spec/SvgDomSpec.js

index ac9d7a9..d670973 100644 (file)
@@ -767,9 +767,10 @@ base("$from").of( {
           return f(Ay*t*t*t + By*t*t + Cy*t);\r
         };\r
      } else if (this.mode === "discrete") {\r
+       this.to.call();\r
        return function (t) {\r
          return isNaN(t) ? this.string\r
-                         : this.to.from.string;\r
+                         : this.to.advance(0);\r
        }.bind(this);\r
      }\r
    }\r
@@ -1037,7 +1038,7 @@ base("$calcMode").up("$attribute").mix( {
             call: function() {\r
               return function (t) {\r
                  return isNaN(t) ? this.string\r
-                                 : this.to.string;\r
+                                 : this.to.advance(1);\r
               }.bind(this);\r
             }\r
       } ) );\r
@@ -1279,11 +1280,12 @@ base("$calcMode").up("$attribute").mix( {
     \r
     /*additive属性がsum (加法アニメーション)の場合*/\r
     if (ele.getAttributeNS(null, "additive") === "sum") {\r
+      var attrValue = ele.parentNode.getAttributeNS(null, this.attrName);\r
       ele.addEventListener("beginEvent", function(evt) {\r
         to.forEach( function(x) {\r
-          x.to.setAdditive(evt.target.parentNode.getAttributeNS(null, this.attrName));\r
+          x.to.setAdditive(attrValue);\r
         } )\r
-      }.bind(this), false);\r
+      }, false);\r
     }\r
     /*acuumulate属性がsum (蓄積アニメーション)の場合*/\r
     if (ele.getAttributeNS(null, "accumulate") === "sum") {\r
index 844b211..5359e3a 100644 (file)
@@ -3381,6 +3381,7 @@ describe("SMIL Animation Spec", function() {
       calc.mode = "discrete";\r
       calc.keyTime = 0.5;\r
       calc.to.degit = 1;\r
+      calc.to.string = "1";\r
       calc.to.from.string = "0.5";\r
       expect(calc.call()(0.2)).toBe("0.5");\r
       expect(calc.call()(0.3)).toBe("0.5");\r
@@ -4013,10 +4014,10 @@ describe("SMIL Animation Spec", function() {
           ele.setAttributeNS(null, "calcMode", "discrete");\r
           $animate.init(ele);\r
           expect($animate.mode).toBe("discrete");\r
-          f(24, "M20 0 L20 30");\r
-          f(25, "M20 0 L20 30");\r
-          f(37, "M20 20 L10 30");\r
-          f(48, "M20 20 L10 30");\r
+          f(24, "M20.0 0.0 L20.0 30.0");\r
+          f(25, "M20.0 0.0 L20.0 30.0");\r
+          f(37, "M20.0 20.0 L10.0 30.0");\r
+          f(48, "M20.0 20.0 L10.0 30.0");\r
         } );\r
         /*同値分割をして、有効同値クラスを調べておく (Equivalence partitioning, the following is the valid partion)*/\r
         it("should be this for the value (the valid partion )", function() {\r
@@ -4111,12 +4112,12 @@ describe("SMIL Animation Spec", function() {
           ele.setAttributeNS(null, "calcMode", "discrete");\r
           ele.setAttributeNS(null, "keyTimes", "0.1;0.5;0.4");\r
           $animate.init(ele);\r
-          f(1, "M20 0 L20 30");\r
-          f(4, "M20 0 L20 30");\r
-          f(5, "M20 24 L20 30");\r
-          f(25, "M20 24 L20 30");\r
-          f(29, "M20 26.4 L20 30");\r
-          f(48, "M20 26.4 L20 30");\r
+          f(1, "M20.0 0.0 L20.0 30.0");\r
+          f(4, "M20.0 0.0 L20.0 30.0");\r
+          f(5, "M20.0 24.0 L20.0 30.0");\r
+          f(25, "M20.0 24.0 L20.0 30.0");\r
+          f(29, "M20.0 26.4 L20.0 30.0");\r
+          f(48, "M20.0 26.4 L20.0 30.0");\r
           \r
           frame.timelines.length = 0;\r
           ele.setAttributeNS(null, "calcMode", "spline");\r