Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle out-of-flow frame for interactive documents #362

Open
s-leroux opened this issue May 8, 2016 · 4 comments
Open

Handle out-of-flow frame for interactive documents #362

s-leroux opened this issue May 8, 2016 · 4 comments
Labels

Comments

@s-leroux
Copy link
Contributor

s-leroux commented May 8, 2016

As far as I can tell, when creating a new frame, it is automatically added to the "flow" of the presentation.

But this is not required for the target of a link : there are situations where the target frame of a link should only appear when manually activating the link. And not automatically as part of the presentation flow. This is especially true for interactive presentations.

Ideally (?) the transition after such "out-of-flow" frame should go back to the previous frame.

Maybe we could leverage the "Show in frame list" feature to consider a hidden frame as "out-of-flow" and not showing it at part of the linear flow of the presentation ?

@s-leroux
Copy link
Contributor Author

s-leroux commented May 9, 2016

As a proof-of-concept, I spend some time working on the code :

#364

See here for an example of what I obtain.

By looking at frame number on the top-left, you will see some frame are skipped as part of the presentation flow. Those are hidden frame (based on showInFrameList in this example).

If at any point of the presentation you click on the hand, lungs or knees, the presentation will zoom to that area as they are associated with a link. Once zoomed, if you click outside of the link area, you go back to the parent frame. To do that, I've introduced the notion of hierarchical frame. A frame with an id like arm/hand is considered as a sub-frame, and the next frame is assumed to be its parent. Here, the arm frame.

@aumouvantsillage
Copy link
Collaborator

Thanks for your contribution. I will have a look at your pull request, but I don't have a lot of time to spend on Sozi at the moment.

Maybe we could leverage the "Show in frame list" feature to consider a hidden frame as "out-of-flow" and not showing it at part of the linear flow of the presentation ?

The purpose of the property "Show in frame list" is not to show or hide frames.
It allows to show or hide the frame title in the frame list (table of contents).

@mariopal
Copy link

I just implemented these changes, adapted to the current version of the repository, because I also need hidden frames for interactive documents, and the "Show in frame list" feature is the closest thing to that option: if the frame is not shown in the frame list, it seems logical to me that it should not be shown in the play sequence either.

In case it is of interest to others, these are the changes I had to make to the current version of the repository to get this functionality in my presentation:

diff --git a/src/js/player/Player.js b/src/js/player/Player.js
index a29b233..4e2f5ee 100644
--- a/src/js/player/Player.js
+++ b/src/js/player/Player.js
@@ -167,8 +167,12 @@ export class Player extends EventEmitter {
      */
     get previousFrame() {
         const frame = this.animator.running ? this.targetFrame : this.currentFrame;
-        const index = (frame.index + this.presentation.frames.length - 1) % this.presentation.frames.length;
-        return this.presentation.frames[index];
+
+        let prevFrame = frame.index;
+        while((prevFrame = (prevFrame + this.presentation.frames.length - 1) % this.presentation.frames.length) != frame.index) {
+            if (this.presentation.frames[prevFrame].showInFrameList)
+                return this.presentation.frames[prevFrame];
+        }
     }
 
     /** The frame after the current frame.
@@ -181,8 +185,12 @@ export class Player extends EventEmitter {
      */
     get nextFrame() {
         const frame = this.animator.running ? this.targetFrame : this.currentFrame;
-        const index = (frame.index + 1) % this.presentation.frames.length;
-        return this.presentation.frames[index];
+
+        let nextFrame = frame.index;
+        while((nextFrame = (nextFrame + 1) % this.presentation.frames.length) != frame.index) {
+            if (this.presentation.frames[nextFrame].showInFrameList)
+                return this.presentation.frames[nextFrame];
+        }
     }
 
     /** Finds the last preceding frame which will not automatically transit (i.e. has a timout > 0 ms).

@aumouvantsillage
Copy link
Collaborator

if the frame is not shown in the frame list, it seems logical to me that it should not be shown in the play sequence either

I understand your point of view but I don't agree. The purpose of the "Show in frame list" feature is to select which frames are reachable from the frame list. It does not imply that the other frames should be skipped when the presentation is played.

In some of my presentations, the frame list provides links to the main chapters and sections only, because it is not always relevant to list all frames.

I still believe that "Show in frame list" and "Skip frame" are different features.
Obviously, a skipped frame should not be visible in the frame list.

For the context, the pull request by @s-leroux made a clever use of three existing features (frame IDs, hyperlinks, and hiding frames from the frame list) to support a hierarchical presentation flow. I believe this was great as a proof of concept, but it would deserve to be implemented as a specific feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants