Commit graph

156 commits

Author SHA1 Message Date
griffpatch
1a3e9845d0 Merge remote-tracking branch 'refs/remotes/LLK/develop' into feature/fencing 2017-02-14 08:30:42 +00:00
griffpatch
100625c6d7 Fencing 2017-02-14 08:30:07 +00:00
griffpatch
fea7643e7e rename fencing method 2017-02-11 14:23:05 +00:00
Chris Willis-Ford
4d8b5da491 Merge pull request from CSnap/fix_SkinMeasurements
Initialize Measurement
2017-02-10 12:04:54 -08:00
Chris Willis-Ford
fd4ef087d5 Merge pull request from LLK/greenkeeper/initial
Update dependencies to enable Greenkeeper 🌴
2017-02-10 11:42:13 -08:00
Christopher Willis-Ford
8087dca4a9 docs(readme): clean up badges 2017-02-10 11:36:57 -08:00
SillyInventor
dc53feaf41 Initialize Measurement 2017-02-10 14:21:45 -05:00
Chris Willis-Ford
a0b3a687cd Merge pull request from griffpatch/bug/alphaChannelConversion
Bug alphachannelconversion
2017-02-09 07:49:56 -08:00
griffpatch
4e21184854 Lint Issues
Comments too long
2017-02-09 10:04:48 +00:00
griffpatch
aa993779bb Feature - Fencing of drawables
Provide a method in the scratch-render to return the fenced coordinates
of a drawable moving to a given position.
2017-02-09 09:56:27 +00:00
griffpatch
fd2b86ea7a Merge remote-tracking branch 'refs/remotes/LLK/develop' into feature/fencing 2017-02-09 08:55:32 +00:00
griffpatch
4dba5db28d Alpha channel conversion
I wasn't so clever with this - I'm sorry. Now that I have managed to
link up my local render & vm projects I am able to fix the issue
properly. Many appologies!
2017-02-09 08:36:57 +00:00
Ray Schamp
35803dcfc9 Merge pull request from rschamp/bugfix/73-retina-size
Fix SVG size calculation
2017-02-07 13:58:47 -05:00
Ray Schamp
9a8f4f2a88 Fix SVG size calculation
It was being incorrectly calculated based on devicePixelRatio.

Fixes . Thanks to @cwillisf for figuring it out!
2017-02-07 10:48:47 -05:00
Christopher Willis-Ford
805ec54f57 chore: adapt code for Webpack 2 2017-02-03 11:01:29 -08:00
greenkeeper[bot]
187a783e74 docs(readme): add Greenkeeper badge
https://greenkeeper.io/
2017-02-02 17:25:31 +00:00
greenkeeper[bot]
549f596195 chore(package): update dependencies
https://greenkeeper.io/
2017-02-02 17:25:30 +00:00
griffpatch
3e476e2d25 Merge remote-tracking branch 'refs/remotes/LLK/develop' into develop 2017-01-28 13:53:08 +00:00
Andrew Sliwinski
c3c7bb28ae Merge pull request from griffpatch/develop
Bug in alpha channel conversion
2017-01-27 10:58:38 -05:00
griffpatch
6f5acfee7b Bug in alpha channel conversion
This is groundwork required by the issue:
https://github.com/LLK/scratch-vm/issues/393
2017-01-27 12:26:11 +00:00
Chris Willis-Ford
9841de85f1 Merge pull request from CSnap/clear_fix
Clear Button Fix
2017-01-25 09:51:57 -05:00
Ray Schamp
2fc9005c60 Merge pull request from rschamp/bugfix/new-skins-without-rotationCenter
Calculate rotation center if it's not supplied
2017-01-25 09:43:24 -05:00
Ray Schamp
bf2863921c Carry rotationCenter assignment to create*Skin 2017-01-25 09:29:29 -05:00
Ray Schamp
c478ebec35 Use explicit rotationCenter argument
This is more explicit than the previous behavior, and more in line with the way we supply the costumeResolution
2017-01-25 09:28:58 -05:00
SillyInventor
ea786aa4bd set canvas to dirty when clearing pen canvas 2017-01-24 19:44:47 -05:00
Chris Willis-Ford
abd76720ee Merge pull request from cwillisf/pen
Pen
2017-01-20 13:21:54 -08:00
Christopher Willis-Ford
5eef82a9dc Add missing jsdoc for _setAttributes on PenSkin 2017-01-20 13:16:22 -08:00
Christopher Willis-Ford
3bdb1fff1f Small changes & fixes from VM integration
Changes include:
- Implement pen clear
- Upack pen-related location parameters
- Fix inverted vertical position on pen actions
- Remove canvas debug content
- Set `strokeStyle` instead of `fillStyle`
- Remove location parameter from stamp operation: always stamp in place
2017-01-19 11:22:32 -08:00
Andrew Sliwinski
ce5a3b8ad6 Merge pull request from thisandagain/bugfix/oss
Add Contribution Guidelines and Issue / PR Templates
2017-01-18 08:23:28 -05:00
Andrew Sliwinski
f393d86b8e Improve contribution guidelines and issue/pr templates 2017-01-17 17:07:12 -05:00
Chris Willis-Ford
a4b863e464 Merge pull request from cwillisf/fix-webpack-dev-server
Fix webpack dev server
2017-01-13 13:31:45 -08:00
Ray Schamp
875a5a3ec1 Calculate rotation center if it's not supplied
When a new skin is added, previously the rotation center was set to `[0, 0]`.  In the case of costumes and backdrops added from libraries, the center should be calculated from the bounding box of the imported skin.

Toward 
2017-01-13 13:10:20 -05:00
Chris Willis-Ford
51e8aa9b1a Merge pull request from cwillisf/skin-classes
Move `Skin` functionality out of `Drawable` into its own classes
2017-01-12 10:57:07 -08:00
Christopher Willis-Ford
1531ea8ae6 Fix outdated method of collecting size 2017-01-11 10:05:36 -08:00
Christopher Willis-Ford
f7fd05cfba Use skin-relative coordinates for Pen actions 2017-01-10 15:22:33 -08:00
Christopher Willis-Ford
f5af954acb Webpack config cleanup, fix dev server
This change tweaks the expression of paths in the Webpack config to make
`webpack-dev-server` work again. This opened the door for some minor
cleanup of `path` & `filename` in the `output` configuration entries.
Thanks to @rschamp for help resolving the `webpack-dev-server` problems.
2017-01-10 14:55:07 -08:00
Christopher Willis-Ford
c2ca8d2a84 Add source maps to Webpack config 2017-01-10 14:39:47 -08:00
Christopher Willis-Ford
78c0d09c72 Flip y coordinate for internal renders
Scratch uses y=up, whereas WebGL and the Canvas element both use y=down.
To make this work, we set a non-conventional projection matrix when
rendering to the stage. Some of the internal renders (touching color,
stamp, etc.) were using a y-flipped projection matrix, though, which
means that the output was double-flipped and would appear incorrect. For
the touching-color block this just meant a cosmetic issue: the debug
canvas looks upside-down. For pen stamp, though, it's a real issue since
the stamp was appearing upside down on the stage.

This change ensures that the projection matrix for every internal render
follows WebGL / Canvas conventions, and that we only y-flip on the final
render to the stage.
2017-01-10 12:56:32 -08:00
Christopher Willis-Ford
f29ed34ddc Implement pen point, line, and stamp
Also clean up the code around our calls to `readPixels`:
- Use `Uint8Array` instead of `Buffer` to hold the pixels
- Use `ImageData.data.set` instead of a `for` loop when copying pixels
  to a canvas
2017-01-10 11:47:45 -08:00
Christopher Willis-Ford
140c0fbf37 Merge skin classes, convert PenDrawable to PenSkin
Merge the "skin classes" work from another branch and move/convert the
pen work from `PenDrawable` to `PenSkin`.
2017-01-05 16:25:53 -08:00
Christopher Willis-Ford
1f0cd4b61f Fix resource leaks discovered while testing
- `Drawable` now removes its `Skin` on `dispose`, disconnecting events.
- Creating a new `Drawable` doesn't always create a new `Skin` any more:
  now it can share an existing skin.
- Don't throw when asked to update the properties of a `Drawable` that
  has already been destroyed. This seems like a VM bug but was causing
  overwhelming output in the browser for some projects.
2016-12-29 13:42:58 -08:00
Christopher Willis-Ford
6643469ff2 Remember to fill the URL cache... 2016-12-29 11:06:54 -08:00
Christopher Willis-Ford
6a0798062b Make a Skin emit an event when it is altered
This allows any `Drawable` using the `Skin` to update its transform as
necessary.
2016-12-29 10:46:12 -08:00
Christopher Willis-Ford
ba5deb9936 Minor cleanup after Drawable/Skin refactor
- Add & correct a few comments
- Make `Drawable` IDs work like `Skin` IDs
- Remove some dead code
- Fix costume resolution in `BitmapSkin` before first `setBitmap` call
- Rename `Drawable` & `Skin` management variables in `RenderWebGL` to
  clarify their purpose and better distinguish them from each other
- Remove problematic premature optimization in `_drawThese`
- Fix missing return statement in `Skin`'s `setRotationCenter`
- Fix mismatch between getTexture & getUniforms in the `Skin` class
2016-12-28 14:38:48 -08:00
Christopher Willis-Ford
64c5991486 Split Skin functionality out of Drawable
There is now a `Skin` base class along with `SVGSkin` and `BitmapSkin`
classes for vector and bitmap skin support. Loading a skin by URL is in
the process of being deprecated. In the future skin data should be
downloaded outside the renderer and supplied through new `create*Skin`
API calls.
2016-12-28 12:17:45 -08:00
Christopher Willis-Ford
4730a057ff Move Drawable.NONE into new RenderConstants
This constant will soon be shared with another class.
2016-12-22 12:58:58 -08:00
Christopher Willis-Ford
e3a05743b0 Handle changing the stage's native size, tell pen
The `setStageSize` wasn't working correctly. This change fixes that and
also notifies active `PenDrawable` instances about the resize. This was
implemented by making the renderer an `EventEmitter`.
2016-12-21 16:13:57 -08:00
Christopher Willis-Ford
2a64c1dd18 Convert pen to subclass of Drawable: PenDrawable
To test, load the playground and type `renderer.createPenDrawable()`
into the JS console. Note that the pen layer is now just another
drawable object, so it can move and use effects.
2016-12-21 11:36:29 -08:00
Christopher Willis-Ford
c6356f71ff Move uniforms, skins, transform back to Drawable
It turns out that it might make sense for the pen to share these
features. Splitting them out would likely work too, but would introduce
unnecessary complexity.
2016-12-20 15:29:22 -08:00
Christopher Willis-Ford
2dafa70ff7 Use sprite shader for pen 2016-12-20 15:22:54 -08:00