code-surfer
code-surfer copied to clipboard
Feature Request: Step back starts from from last animation on previous slide
Hi there,
First off Code Surfer is the bomb(!) and I've been really enjoying using it! Thanks for creating such an awesome tool! 😄
One thing I've run into is when presenting if you want to go back to a previous slide, Code Surfer will start animating from the beginning of the previous slide, not the end, so you can sometimes lose a bit of continuity if you overshoot or need to go back.
I'm not sure if this is hard to add or not or if it's more related to MDX Slides as opposed to Code Surfer but having the ability to opt-in or out of this behaviour would be amazing and super useful.
Thank you very much for your time and keep up the awesome work! 🙂
Cheers!
Tom
Hey, thanks.
The decks I've tried start animating from the end of the prev slide when you go back. For example, https://codesurfer.pomb.us/demo/
Maybe I misunderstood, can you show me your issue?
Hmm perhaps I need a later version of Code Surfer? I'm on version 3.1.0
So say I have a slide that looks like this... (I'm writing one on C++17)
<CodeSurfer>
std::vector<int> numbers{1, 2, 3, 4, 5, 6, 7, 8, 9};
auto it = std::find(
std::cbegin(numbers), std::cend(numbers), 5);
if (it != std::cend(numbers))
{
std::cout << "Found " << *it << "!\n"; // Found 5!
}
std::vector<int> numbers{1, 2, 3, 4, 5, 6, 7, 8, 9};
if (auto it = std::find(
std::cbegin(numbers), std::cend(numbers), 5);
it != std::cend(numbers))
{
std::cout << "Found " << *it << "!\n"; // Found 5!
}
std::vector<int> numbers{1, 2, 3, 4, 5, 6, 7, 8, 9};
if (auto it = std::find(
std::cbegin(numbers), std::cend(numbers), 5);
it != std::cend(numbers))
{
std::cout << "Found " << *it << "!\n"; // Found 5!
}
if (init; condition)
switch (init; condition)
</CodeSurfer>
if I get passed the last block (pressing right to move to the next slide) and then press left, I jump back to the very first block again. Is this something that was fixed recently?
Thanks for the quick response!
Tom
So I tried out the link you provided and that did work just as I'd expect! (my presentation does not seem to work the same for whatever reason 😖).
I found the source here - https://github.com/pomber/code-surfer/blob/0f825b0b2b421dc0a2f3e91901fd5ad75f012cac/sites/docs/decks/demo.mdx and mine does not seem to be too different as far as I can tell... I could try and send you a snippet of mine if that would help to reproduce the problem.
Thanks again,
Tom
I would suggest creating a new deck with npm init code-surfer-deck my-deck
and add your slides. If it doesn't happen anymore it's probably an issue from an old version (maybe from mdx-deck). If it still happens, share it and I'll see what could be done.
Hi @pomber,
Thank you very much for the suggestion - by creating a new deck using npm init code-surfer-deck my-deck
the problem went away!
I did a little digging and the default init
command uses "mdx-deck": "3.0.13"
and I'd since upgraded to 4.1.0
- it seems like it's broken with 4.1.0
and works fine in 3.0.131
😬
When upgrading to 4.1.0
I also ran into this problem - https://github.com/jxnblk/mdx-deck/issues/654 and had to install gatsby-source-filesystem
. Might be worth seeing if you can repro locally if you have time.
For now, I'll just go back to the older version (it just, unfortunately, complains about a few vulnerabilities - which is why I'd decided to try and upgrade).
Thanks again,
Tom
Thanks for testing it. I haven't tried Code Surfer with MDX-Deck v4 yet, feel free to open any other issue you find (specific to Code Surfer) for that version.
No worries at all,
Sure thing, would it be a good idea to do that on the MDX-Deck repo?
Annoyingly I would really like the newly added <Footer>
element that exists in v4 🙈
Thanks for your help,
Tom