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

Add fade-out effect to slides #96

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dennisklad
Copy link

Also formatted the code :)

Solves #95 .This was easier to do that I though.

Basically the only code you need is this after the selectWrapper definition:

// First, hide all modules before showing the new ones
for (let i = 0; i < this.length; i += 1) {
    this[i].hide(this.slideTransitionSpeed, false, { lockString: "mmmc" }); // Hide all modules
}

setTimeout(() => {
    /* The existing code for processing the slides */
    for (let i = 0; i < this.length; i += 1) {
        /*
        * There is currently no easy way to discover whether a module is ALREADY shown/hidden
        * In testing, calling show/hide twice seems to cause no issues
        */
        Log.log(`Processing ${this[i].name}`)
        [.....]
        } else {
            // We aren't using slides and this module shouldn't be shown.
            this[i].hide(0, false, { lockString: "mmmc" });
        }
    }
}, this.slideTransitionSpeed);

Disclaimer:
This works as expected for my configuration with two slides, but should be tested with other modes as well.

Also formatted the code :)
@KristjanESPERANTO
Copy link
Collaborator

Thanks for the PR! 😃

Also formatted the code :)

This makes it hard to review. We use ESLint to lint and format the code 🙂 Please run npm run lint:fix to apply the ESLint rules.

@dennisklad
Copy link
Author

This makes it hard to review.

You are right, I am sorry - this was not the smartest commit. I will push again.

@dennisklad
Copy link
Author

The formatting with npm run lint:fix ended with 40 problems.
image

You basically only need the code after the selectWrapper definition:

// First, hide all modules before showing the new ones
for (let i = 0; i < this.length; i += 1) {
    this[i].hide(this.slideTransitionSpeed, false, { lockString: "mmmc" }); // Hide all modules
}

setTimeout(() => {
    /* The existing code for processing the slides */
    for (let i = 0; i < this.length; i += 1) {
        /*
        * There is currently no easy way to discover whether a module is ALREADY shown/hidden
        * In testing, calling show/hide twice seems to cause no issues
        */
        Log.log(`Processing ${this[i].name}`)
        [.....]
        } else {
            // We aren't using slides and this module shouldn't be shown.
            this[i].hide(0, false, { lockString: "mmmc" });
        }
    }
}, this.slideTransitionSpeed);

@KristjanESPERANTO
Copy link
Collaborator

KristjanESPERANTO commented Oct 21, 2024

OK, I tested it and checked your changes. I really like the fade-out! 👏

But before merging:

  1. What do you think, should there be a separate config option to set the fade-out? Maybe some people want to configure it asynchronously or like the current behaviour.
  2. The README needs updating.

The formatting with npm run lint:fix ended with 40 problems.

I will take care of it as soon as we are done with this PR.

@dennisklad
Copy link
Author

dennisklad commented Oct 22, 2024 via email

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

Successfully merging this pull request may close these issues.

2 participants