jakiestfu / jakiestfu/Snap.js

parseInt - rounding returns wrong value

Open
#116 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
642
PR merge metrics
No merged PRs in 30d

Description

At first, awesome piece of code...

But i've go a problem if i try to implement the toggle-buttons. When the action.translate.get.matrix - method gets called to prove the current state (left, right, close) it always returns a one pixel difference. So the state().state returns a wrong value.

my fix was to change line 176

``` javascript
return parseInt(matrix[index], 10);
```

to

``` javascript
return Math.round(matrix[index]);
```

Is that a possible fix, or will I get some other problems here?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at line 176 and trace the action.translate.get.matrix method used by state() to determine the left, right, or close position. Reproduce the toggle-button behavior and compare the current parseInt handling with the reported rounding behavior. Done means state() identifies each position without the one-pixel discrepancy.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
mobile-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.