Commit graph

10 commits

Author SHA1 Message Date
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