psychojs icon indicating copy to clipboard operation
psychojs copied to clipboard

[BUG?] Inconsistent Behavior of Slider's `_ratingToPos` in PsychoJS vs PsychoPy

Open const7 opened this issue 1 year ago • 0 comments

I've encountered inconsistent/incorrect behavior with the _ratingToPos function in PsychoJS compared to PsychoPy.

Possible Bug

In PsychoJS, _ratingToPos only returns the correct x or y position, with the other coordinate always being 0. If the slider's position is offset from the center (not at [0,0]), the resulting position returned by _ratingToPos will be incorrect. https://github.com/psychopy/psychojs/blob/9265fd85023642c12488eba6ff80c426b7b3f2bb/src/visual/Slider.js#L1354-L1403 This issue does not occur in PsychoPy, where both x and y coordinates are correctly computed based on the slider's position. https://github.com/psychopy/psychopy/blob/fa753ec368764989a557e57660adb5c8486c49da/psychopy/visual/slider.py#L586-L610

Feature vs Bug

In PsychoPy, _ratingToPos accepts both single numeric values and array-like inputs for ratings. However, in PsychoJS, the function only accepts arrays. I'm not sure if it's intentional or some other reason.

I would be happy to submit a PR to fix the first issue if you're open to that. As for the second point, perhaps it could be discussed further to determine whether this difference in input handling should be resolved.

const7 avatar Oct 08 '24 03:10 const7