129 Commits

Author SHA1 Message Date
Paul Kaplan
76886ad92b Add JSDoc for isStamping opt flag 2017-03-07 12:21:30 -05:00
Paul Kaplan
983c704761 Add stamping flag to make draw ignore visibility 2017-03-07 11:19:39 -05:00
Ray Schamp
2de55f0474 Add scratchOffset data to extractDrawable
Makes it easier to translate between canvas coordinates and scratch coordinates
2017-03-03 09:18:20 -05:00
Andrew Sliwinski
e67d8a2126 Merge pull request #94 from CSnap/getBounds
Fix getBounds for Hidden Sprites
2017-03-02 11:31:45 -05:00
Andrew Sliwinski
fc7610716e Merge pull request #96 from CSnap/fix_getConvexHullPointsForDrawable
Round pixelBase
2017-03-02 08:47:00 -05:00
Ray Schamp
b6008078ed Merge pull request #93 from griffpatch/feature/FenceAgain
Feature fenceagain
2017-02-23 09:25:53 -05:00
griffpatch
04f7e2ac24 Add const for FENCE_WIDTH
Pull out the 15 pixels into a const
2017-02-23 14:09:00 +00:00
Ray Schamp
9824d109b0 Merge pull request #102 from rschamp/jsdoc
Generate docs from src, publish to gh-pages
2017-02-23 08:42:10 -05:00
Chris Willis-Ford
71135236f2 Merge pull request #107 from LLK/greenkeeper/twgl.js-3.0.2
chore(package): update twgl.js to version 3.0.2
2017-02-22 21:15:52 -08:00
Christopher Willis-Ford
58801fab14 Fix drawBufferInfo call for twgl API change 2017-02-22 21:07:47 -08:00
Chris Willis-Ford
ed0c39c2ac Merge pull request #100 from TheBrokenRail/patch-1
Fix IE/Edge Support (#85 and LLK/scratch-vm#367)
2017-02-22 11:45:26 -08:00
TheBrokenRail
1113149363 Fix 2017-02-21 15:43:39 -05:00
Ray Schamp
3c6511d94e Generate docs from src, publish to gh-pages
Fix any broken JSDoc syntax. Unfortunately there is no way to document tuples like `{[int, int]}` for a `[width, height]` array. We could possibly fix this and make the code more readable with `{width: number, height: number}` instead of tuples.

Remove single `@fileoverview` from Rectangle.js, since it was the only file with one and was weird to have that one module show up on the docs home page.

Add a `docs` script to `package.json`, run it from `npm test`, so invalid docs will cause tests to fail (eventually we may want to start using eslint-plugin-jsdoc to catch these errors with the linter alone).
2017-02-21 14:46:24 -05:00
Ray Schamp
b7d5610b23 Merge pull request #97 from rschamp/dnd
Add method to retrieve drawable pixel data
2017-02-21 14:45:17 -05:00
TheBrokenRail
ec2361cf91 Fix IE/Edge Support (#85) 2017-02-18 14:06:45 -05:00
Ray Schamp
68600e794d Return null for invalid drawableIDs 2017-02-18 12:18:04 -05:00
Ray Schamp
6dd3c0ed81 Don't clip drawables to stage when extracting 2017-02-17 17:37:05 -05:00
Ray Schamp
e035cadb04 Don't apply ghost when extracting drawables 2017-02-17 17:36:47 -05:00
Ray Schamp
3bc00176ed Refactor _drawThese to take options
So the number of arguments doesn't get out of hand
2017-02-17 17:35:45 -05:00
Ray Schamp
a65ea3daed Add method to retrieve drawable pixel data
Towards LLK/scratch-gui#66
2017-02-17 14:51:04 -05:00
SillyInventor
4eacde74e6 Round pixelBase to allow for non-integer SVG widths in _getConvexHullPointsForDrawable 2017-02-15 14:14:03 -05:00
griffpatch
f3b3f0aca7 Feature - Fencing again
This is a resubmission of the same scripts that got reverted. The actual
issues was within scratch-vm.
2017-02-15 16:19:08 +00:00
Ray Schamp
42e5e724c2 Revert "Feature fencing" 2017-02-15 09:38:23 -05:00
SillyInventor
9c51cf0a04 Switch to getFastBounds from get bounds, and add check for if the hull points are empty. 2017-02-14 19:58:22 -05:00
Christopher Willis-Ford
959c635f58 SVG: compensate for viewbox offset
In Scratch 2.0, an SVG costume's origin is stored relative to that SVG's
viewbox. In order to use the origin values correctly, then, we need to
compensate for the viewbox offset.
2017-02-14 15:59:45 -08:00
griffpatch
b39bb4d3fd Fencing Take 3
Refactor to accept and return a position as an array of ints [x, y]
2017-02-14 09:08:32 +00:00
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 #84 from CSnap/fix_SkinMeasurements
Initialize Measurement
2017-02-10 12:04:54 -08:00
Chris Willis-Ford
fd4ef087d5 Merge pull request #79 from LLK/greenkeeper/initial
Update dependencies to enable Greenkeeper 🌴
2017-02-10 11:42:13 -08:00
SillyInventor
dc53feaf41 Initialize Measurement 2017-02-10 14:21:45 -05:00
Chris Willis-Ford
a0b3a687cd Merge pull request #81 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
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
9a8f4f2a88 Fix SVG size calculation
It was being incorrectly calculated based on devicePixelRatio.

Fixes LLK/scratch-gui#73. 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
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 #74 from CSnap/clear_fix
Clear Button Fix
2017-01-25 09:51:57 -05:00
Ray Schamp
2fc9005c60 Merge pull request #70 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
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
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 LLK/scratch-gui#18
2017-01-13 13:10:20 -05: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
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