This is an automated email from the ASF dual-hosted git repository.

shenyi pushed a commit to branch graphic-animation
in repository https://gitbox.apache.org/repos/asf/echarts.git


The following commit(s) were added to refs/heads/graphic-animation by this push:
     new 6eb6cd9  fix(graphic): fix textConfig not work
6eb6cd9 is described below

commit 6eb6cd921d3ff214620233bf3e84e6b7e69b6f76
Author: pissang <[email protected]>
AuthorDate: Wed Dec 1 11:59:42 2021 +0800

    fix(graphic): fix textConfig not work
---
 src/animation/customGraphicKeyframeAnimation.ts |  8 +++-
 src/component/graphic/GraphicModel.ts           |  3 +-
 src/component/graphic/GraphicView.ts            |  2 +
 test/graphic-animation.html                     | 53 ++++++++++++++++++++++++-
 4 files changed, 61 insertions(+), 5 deletions(-)

diff --git a/src/animation/customGraphicKeyframeAnimation.ts 
b/src/animation/customGraphicKeyframeAnimation.ts
index a483090..3116a33 100644
--- a/src/animation/customGraphicKeyframeAnimation.ts
+++ b/src/animation/customGraphicKeyframeAnimation.ts
@@ -40,8 +40,14 @@ export interface ElementKeyframeAnimationOption<Props 
extends Record<string, any
 }
 
 export function applyKeyframeAnimation<T extends Record<string, any>>(
-    el: Element, animationOpts: ElementKeyframeAnimationOption<T>, 
animatableModel: Model<AnimationOptionMixin>
+    el: Element,
+    animationOpts: ElementKeyframeAnimationOption<T>,
+    animatableModel: Model<AnimationOptionMixin>
 ) {
+    if (!animatableModel.isAnimationEnabled()) {
+        return;
+    }
+
     // Stop previous keyframe animation.
     el.stopAnimation('keyframe');
 
diff --git a/src/component/graphic/GraphicModel.ts 
b/src/component/graphic/GraphicModel.ts
index 811c715..eab5b9a 100644
--- a/src/component/graphic/GraphicModel.ts
+++ b/src/component/graphic/GraphicModel.ts
@@ -40,6 +40,7 @@ import { copyLayoutParams, mergeLayoutParam } from 
'../../util/layout';
 import { TransitionOptionMixin } from 
'../../animation/customGraphicTransition';
 import { ElementKeyframeAnimationOption } from 
'../../animation/customGraphicKeyframeAnimation';
 import { GroupProps } from 'zrender/src/graphic/Group';
+import { TransformProp } from 'zrender/src/core/Transformable';
 
 interface GraphicComponentBaseElementOption extends
     Partial<Pick<
@@ -122,8 +123,6 @@ interface GraphicComponentBaseElementOption extends
 };
 
 
-export type TransformProp = 'x' | 'y' | 'scaleX' | 'scaleY' | 'originX' | 
'originY' | 'skewX' | 'skewY' | 'rotation';
-
 export interface GraphicComponentDisplayableOption extends
     GraphicComponentBaseElementOption,
     Partial<Pick<Displayable, 'zlevel' | 'z' | 'z2' | 'invisible' | 'cursor'>> 
{
diff --git a/src/component/graphic/GraphicView.ts 
b/src/component/graphic/GraphicView.ts
index a308b8c..4ca8b95 100644
--- a/src/component/graphic/GraphicView.ts
+++ b/src/component/graphic/GraphicView.ts
@@ -218,6 +218,8 @@ export class GraphicComponentView extends ComponentView {
                 const elInner = inner(el);
                 const keyframeAnimation = elOption.keyframeAnimation;
 
+                el.setTextConfig(textConfig);
+
                 elInner.option = elOption;
                 setEventData(el, graphicModel, elOption);
 
diff --git a/test/graphic-animation.html b/test/graphic-animation.html
index 56856d6..2cb5ec6 100644
--- a/test/graphic-animation.html
+++ b/test/graphic-animation.html
@@ -44,7 +44,7 @@ under the License.
 
 
 
-
+<!--
         <script>
         require(['echarts'/*, 'map/js/china' */], function (echarts) {
             var option = {
@@ -89,7 +89,56 @@ under the License.
             });
 
         });
-        </script>
+        </script> -->
+
+        <script>
+            require(['echarts'/*, 'map/js/china' */], function (echarts) {
+                var option = {
+                    graphic: {
+                        elements: [{
+                            type: 'text',
+                            x: 100,
+                            y: 100,
+                            style: {
+                                text: 'Apache ECharts',
+                                fontSize: 50,
+                                fontWeight: 'bold',
+                                lineDash: [0, 200],
+                                lineDashOffset: 0,
+                                fill: 'transparent',
+                                stroke: '#000',
+                                lineWidth: 1
+                            },
+                            keyframeAnimation: {
+                                duration: 4000,
+                                loop: true,
+                                keyframes: [{
+                                    percent: 0.7,
+                                    style: {
+                                        fill: 'transparent',
+                                        lineDashOffset: 200,
+                                        lineDash: [200, 0]
+                                    }
+                                }, {
+                                    percent: 1,
+                                    style: {
+                                        fill: 'black'
+                                    }
+                                }]
+                            },
+                        }]
+                    }
+                }
+
+                var chart = testHelper.create(echarts, 'main1', {
+                    title: [
+                        'Text Stroke'
+                    ],
+                    option: option
+                });
+
+            });
+            </script>
     </body>
 </html>
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to