You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/04/08 07:33:52 UTC

[GitHub] [echarts] Ovilia commented on a change in pull request #14620: fix(timeline): trigger timelineplaychange event when play to the end

Ovilia commented on a change in pull request #14620:
URL: https://github.com/apache/echarts/pull/14620#discussion_r609399846



##########
File path: src/component/timeline/timelineAction.ts
##########
@@ -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

Review comment:
       Should `from` be `payload.from` or `null`? The reason to use `null` is that play ending doesn't come directly from the view (button clicking).




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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