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

catchDistance for static nipple[FEAT] #191

Closed
Txori opened this issue Jun 22, 2022 · 3 comments
Closed

catchDistance for static nipple[FEAT] #191

Txori opened this issue Jun 22, 2022 · 3 comments

Comments

@Txori
Copy link

Txori commented Jun 22, 2022

It would be nice if the catchDistance property would also work with a static nipple. This way, clicking the other side of the screen wouldn't activate the nipple.

@Txori
Copy link
Author

Txori commented Jun 22, 2022

Something like adding:

if (opts.mode === 'static' && dist > opts.catchDistance) return;

just before:

    // If distance is bigger than nipple's size
    // we clamp the position.
    if (dist > size) {
        dist = size;
        pos = u.findCoord(nipple.position, dist, angle);
    }

is working nicely.

I also replaced:

    if (opts.mode !== 'semi') {
        process(nipple);
    } else {
        // In semi we check the distance of the touch
        // to decide if we have to reset the nipple
        var distance = u.distance(position, nipple.position);
        if (distance <= opts.catchDistance) {
            process(nipple);
        } else {
            nipple.destroy();
            self.processOnStart(evt);
            return;
        }
    }

by:

    switch(opts.mode)
    {
        default:
        process(nipple);
        break;

        case 'semi':
        // In semi we check the distance of the touch
        // to decide if we have to reset the nipple
        var distance = u.distance(position, nipple.position);
        if (distance <= opts.catchDistance) {
            process(nipple);
        } else {
            nipple.destroy();
            self.processOnStart(evt);
            return;
        }
        break;

        case 'static':
        var distance = u.distance(position, nipple.position);
        if (distance <= opts.catchDistance) process(nipple);
        break;
    }

So the nipple won't light up if we click farther than catchDistance.

@yoannmoinet
Copy link
Owner

Can you follow the template please?
Feel free to re-open once the description has been updated following the template.

@Txori
Copy link
Author

Txori commented Jan 17, 2024

Bonjour Yoan.
Aujourd'hui, j'avais un peu de temps libre et je me suis dit que j'allais mettre à jour nipplejs et enfin pouvoir m'occuper de ma FEAT correctement. Seulement, je n'arrive pas à compiler nipplejs. Quoi que je fasse avec les versions des dépendances, j'obtiens :

glob-parent  <5.1.2
Severity: high
glob-parent vulnerable to Regular Expression Denial of Service in enclosure regex - https://github.com/advisories/GHSA-ww39-953v-wcq6
No fix available
node_modules/watchpack-chokidar2/node_modules/glob-parent
  chokidar  1.0.0-rc1 - 2.1.8
  Depends on vulnerable versions of glob-parent
  node_modules/watchpack-chokidar2/node_modules/chokidar
    watchpack-chokidar2  *
    Depends on vulnerable versions of chokidar
    node_modules/watchpack-chokidar2
      watchpack  1.7.2 - 1.7.5
      Depends on vulnerable versions of watchpack-chokidar2
      node_modules/watchpack

4 high severity vulnerabilities

Est-ce qu'il y a quelque chose de particulier à faire ?
Merci

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

No branches or pull requests

2 participants