You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by ov...@apache.org on 2021/04/08 07:28:03 UTC

[echarts] branch fix-timeline-event created (now 0e29b0d)

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

ovilia pushed a change to branch fix-timeline-event
in repository https://gitbox.apache.org/repos/asf/echarts.git.


      at 0e29b0d  fix(timeline): trigger timelineplaychange event when play to the end #14588

This branch includes the following new commits:

     new 0e29b0d  fix(timeline): trigger timelineplaychange event when play to the end #14588

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org


[echarts] 01/01: fix(timeline): trigger timelineplaychange event when play to the end #14588

Posted by ov...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ovilia pushed a commit to branch fix-timeline-event
in repository https://gitbox.apache.org/repos/asf/echarts.git

commit 0e29b0d74413e1aa959a4ece7d4345e3cde594fe
Author: Ovilia <zw...@gmail.com>
AuthorDate: Thu Apr 8 15:25:26 2021 +0800

    fix(timeline): trigger timelineplaychange event when play to the end #14588
---
 src/component/timeline/timelineAction.ts | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/component/timeline/timelineAction.ts b/src/component/timeline/timelineAction.ts
index c4ef686..202bc18 100644
--- a/src/component/timeline/timelineAction.ts
+++ b/src/component/timeline/timelineAction.ts
@@ -22,6 +22,7 @@ import TimelineModel from './TimelineModel';
 import { defaults } from 'zrender/src/core/util';
 import { Payload } from '../../util/types';
 import { EChartsExtensionInstallRegisters } from '../../extension';
+import ExtensionAPI from '../../core/ExtensionAPI';
 
 export interface TimelineChangePayload extends Payload {
     type: 'timelineChange'
@@ -38,14 +39,25 @@ export function installTimelineAction(registers: EChartsExtensionInstallRegister
 
         {type: 'timelineChange', event: 'timelineChanged', update: 'prepareAndUpdate'},
 
-        function (payload: TimelineChangePayload, ecModel: GlobalModel) {
+        function (payload: TimelineChangePayload, ecModel: GlobalModel, api: ExtensionAPI) {
 
             const timelineModel = ecModel.getComponent('timeline') as TimelineModel;
             if (timelineModel && payload.currentIndex != null) {
                 timelineModel.setCurrentIndex(payload.currentIndex);
 
-                if (!timelineModel.get('loop', true) && timelineModel.isIndexMax()) {
+                if (
+                    !timelineModel.get('loop', true)
+                    && timelineModel.isIndexMax()
+                    && timelineModel.getPlayState()
+                ) {
                     timelineModel.setPlayState(false);
+
+                    // The timeline has played to the end, trigger event
+                    api.dispatchAction({
+                        type: 'timelinePlayChange',
+                        playState: false,
+                        from: payload.from
+                    });
                 }
             }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org