Commit graph

20 commits

Author SHA1 Message Date
Valerie R Young
3fe1d3bf6d Minor typo 2018-11-13 14:58:28 -05:00
Valerie R Young
43c5d5c053 Correct infinity comparisons and toNumber 2018-11-13 13:51:12 -05:00
Michael "Z" Goddard
ec414fffc6
use Number.isNaN in Cast.toNumber
Number.isNaN does not coerce and may help performance since we either
do not need to coerce the value or already have with Number.
2018-10-31 14:40:19 -04:00
Michael "Z" Goddard
5b10d41ba3
check if toNumber is given a number and shortcut if so
If toNumber is called on a number avoiding passing the number to Number
can provide a small performance improvement.
2018-10-30 11:28:22 -04:00
jokebookservice1
ab8d4dc560
style(util): Address linting issues 2018-09-17 22:07:26 +01:00
jokebookservice1
dab78c4f62
fix(util): Make string comparisons match Flash's, everywhere 2018-09-17 21:25:14 +01:00
Ray Schamp
32bc087bba Fix remaining lint issues 2017-08-26 13:24:10 -04:00
Ray Schamp
5113876588 Pass with --fix 2017-08-26 13:24:10 -04:00
Ray Schamp
a4f095db5e Use ES6 style classes 2017-04-17 19:42:48 -04:00
Ray Schamp
e01c4ae108 Pass with --fix 2017-04-17 15:10:04 -04:00
griffpatch
ad5bc1afbd Pull white space checks into function
Clean up code by pulling white space checks into a seperate helper
function
2017-02-10 08:02:11 +00:00
griffpatch
cf215bf0bc Fix for the "Empty or white space strings equal 0" bug
See: Empty or white space strings equal 0 #435
2017-02-08 08:38:50 +00:00
Ray Schamp
727fcc7875 Lint for eslint-config-scratch@3 2017-02-01 16:27:55 -05:00
Christopher Willis-Ford
369c02b5d5 Implement pen blocks
These blocks implement pen features as found in Scratch 2.0

Supporting changes include:
- `Target` is now an event emitter
- `RenderedTarget` now emits an event when it moves
- `Target` can now store arbitrary "extra" data, called "custom state"
  in the code, using a `Target`'s `setCustomState` and `getCustomState`
  methods. This is used to store per-target pen state without requiring
  `Target` or `RenderedTarget` to know anything about the pen.
- `Cast` can now cast to an RGB color object.
- `Color` now has functions to convert between RGB and HSV, constants
  for for black & white, and a `mixRgb` function to lerp between two
  colors.
2017-01-19 11:51:22 -08:00
Ray Schamp
f6c0064235 All linting other than console statements 2016-10-23 22:20:29 -04:00
Tim Mickel
2357d63243 Drop useRound option from Cast.toListIndex (#213)
* Drop `useRound` option from `Cast.toListIndex`

* Param fix
2016-09-26 12:01:21 -04:00
Tim Mickel
a118d50056 Variables and lists (#187)
* Import lists and variables from SB2

* Switch to Variable and List objects

* Add Clone.lookupOrCreateVariable, Clone.getVariable, Clone.setVariable

* Add (get, set, change) variable blocks.

* Copy variables and lists on clone instantiation

* Move variable options closer to blocks

* Add list primitives

* Move variable and lists storage to `Target` instead of `Clone`

* Move _computeIndex to a Cast function

* Rename `getList` -> `getListAsString`

* Renames renames

* Remove extra check in Cast.isNaN
2016-09-21 16:38:33 -04:00
Tim Mickel
dec5d054c8 Better handling of float values (fix #172) (#176)
* Better handling of float values (fix #172)

* Stricter equality in Cast.isInt
2016-09-13 17:53:17 -04:00
Tim Mickel
d93eeed05d More color utilities, touching color, color touching color (#155)
* Fill out color utilities

* Amend Color.decimalToHex name

* Add `Cast.toScaledRgbColor`

* Add touching color, color touching color blocks

* Fix scale of Cast.toRgbColor

* Fix format of colors to use renderer-style lists

* Update `Color.decimalToRgb`

* Lint self
2016-09-12 10:58:50 -04:00
Tim Mickel
bfe007e29f Add casting utilities and apply them to operator blocks 2016-08-11 18:47:55 -04:00