harc / moonchild

A toolkit for experimenting with new kinds of programming interfaces.
190 stars 15 forks source link

Scrubbing a negative number to positive and back to negative results in a double "-" sign #10

Open Azeirah opened 9 years ago

Azeirah commented 9 years ago

Reproduce: Start with number 50 Scrub to -50 Scrub back to 50, don't release mouse and scrub back to -50.

Looking at a negative number in Moonchild, you can see the minus sign doesn't have a dotted underline.. The sign of a number is not considered.

pdubroy commented 9 years ago

The problem is that the widget looks for AST nodes of type 'Literal', and by JavaScript's grammar, -50 is a 'UnaryExpression' whose argument is the literal 50: http://esprima.org/demo/parse.html?code=-50