gpickr icon indicating copy to clipboard operation
gpickr copied to clipboard

Error in setLinearAngle

Open insad opened this issue 5 years ago • 0 comments

There's an error in gpickr.js - setLinearAngle, lines 403/404:

angle = typeof angle === 'number' ? angle : (normalize.angleToDegrees(angle) || (this._angles.find(v => v.name === angle) || {}).angle);

when angle = '0deg', normalize.angleToDegrees(angle) returns (correctly) 0, but in this case in the expression this is considered as logical "false", so lines 403/404 return a value of 'undefined' !

I solved it in the following way:

if (typeof angle !== 'number') { if ((angle = normalize.angleToDegrees(angle)) === null) { angle = (this._angles.find(v => v.name === angle) || {}).angle; } }

insad avatar Apr 20 '20 20:04 insad