Code Monkey home page Code Monkey logo

Comments (8)

metonym avatar metonym commented on June 9, 2024

The solution (#4) is to keep track of keys that are currently pressed and reset combo when no keys are pressed down.

Published to NPM in v0.3.1

from svelte-keydown.

lukaszpolowczyk avatar lukaszpolowczyk commented on June 9, 2024

@metonym Why can't you handle it normally?
Creating an additional variable spoils all the transparency of the solution.

from svelte-keydown.

metonym avatar metonym commented on June 9, 2024

@lukaszpolowczyk Can you submit a PR with your preferred solution?

from svelte-keydown.

lukaszpolowczyk avatar lukaszpolowczyk commented on June 9, 2024

@metonym It turns out that I just can't install version 0.3.1
There is 0.3.0 in npm: https://www.npmjs.com/package/svelte-keydown

In the previous comment, I thought the reason was different. Sorry.

It works fine here:
https://metonym.github.io/svelte-keydown/#on%3Acombo

Looks like you just need to update the npm database.

from svelte-keydown.

metonym avatar metonym commented on June 9, 2024

@lukaszpolowczyk No problem – try installing 0.3.1 now from npm

from svelte-keydown.

lukaszpolowczyk avatar lukaszpolowczyk commented on June 9, 2024

@metonym It's better, but there is still some bug.
Steps:

  1. Press and hold Shift
  2. At the same time, I press ArrowRight
  3. I release ArrowRight
  4. Press ArrowRight
  5. I release ArrowRight

And the effect is:
obraz

So despite releasing ArrowLeft, it is still saved in combining.

The bug is because I'm holding Shift.

from svelte-keydown.

metonym avatar metonym commented on June 9, 2024

So your expected behavior would be to preserve the Shift key but not ArrowRight/ArrowLeft after releasing?

from svelte-keydown.

lukaszpolowczyk avatar lukaszpolowczyk commented on June 9, 2024

@metonym I want this effect:
obraz

Because I am holding the Shift button but releasing the ArrowRight/ArrowLeft button.

If (holding Shift) I let go of ArrowRight and then hit ArrowLeft, then ArrowRight should disappear from the latest combination.

I have two separate shortcuts:
Shift-ArrowRight
Shift-ArrowLeft
And they call separate functions that I alternate without letting go of Shift because that would be inconvenient and unintuitive.

from svelte-keydown.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.