Compare commits

..

18 Commits

Author SHA1 Message Date
greenkeeper[bot]
b192a81229 chore(package): update babel-loader to version 8.0.5
Closes #342
2019-01-04 14:39:39 +00:00
Chris Willis-Ford
bfa90a07cc Merge pull request #385 from fsih/fixBlurry
Always use nearest for raster textures
2019-01-03 14:00:29 -05:00
DD
5f38cd1ee1 Always use nearest for raster textures 2019-01-03 12:00:28 -05:00
Karishma Chadha
7d8bcafe2b Merge pull request #384 from ktbee/pixel-center-bounding-box
Align the bounding box to the center of the pixel instead of top left
2018-12-26 10:28:37 -05:00
Katie Broida
770ae92b25 Align the bounding box to the center of the pixel instead of top left 2018-12-21 16:51:36 -05:00
DD Liu
401c368ebc Merge pull request #383 from fsih/updateNewlines
update svg renderer
2018-12-20 14:28:18 -05:00
DD
4eb04896d3 update svg renderer 2018-12-20 14:06:14 -05:00
DD Liu
ca488e6439 Merge pull request #380 from LLK/greenkeeper/scratch-svg-renderer-0.2.0-prerelease.20181218153528
Update scratch-svg-renderer to the latest version 🚀
2018-12-18 10:56:10 -05:00
greenkeeper[bot]
0de5befa4f fix(package): update scratch-svg-renderer to version 0.2.0-prerelease.20181218153528 2018-12-18 15:36:46 +00:00
DD Liu
322e311b17 Merge pull request #379 from LLK/greenkeeper/scratch-svg-renderer-0.2.0-prerelease.20181213192400
fix(package): update scratch-svg-renderer to version 0.2.0-prerelease…
2018-12-13 15:42:20 -05:00
greenkeeper[bot]
2394fb5610 fix(package): update scratch-svg-renderer to version 0.2.0-prerelease.20181213192400
Closes #378
2018-12-13 20:08:32 +00:00
DD Liu
109507f6fe Merge pull request #377 from LLK/greenkeeper/scratch-svg-renderer-0.2.0-prerelease.20181212190400
Update scratch-svg-renderer to the latest version 🚀
2018-12-12 18:30:48 -05:00
DD Liu
9292bacdae Update package.json 2018-12-12 18:17:29 -05:00
greenkeeper[bot]
c6a4aa870e fix(package): update scratch-svg-renderer to version 0.2.0-prerelease.20181212190400 2018-12-12 19:05:19 +00:00
DD Liu
40cbe50238 Merge pull request #372 from LLK/greenkeeper/scratch-svg-renderer-0.2.0-prerelease.20181126212715
fix(package): update scratch-svg-renderer to version 0.2.0-prerelease…
2018-11-27 14:40:27 -05:00
Paul Kaplan
1a2b7a6253 Merge pull request #369 from towerofnix/fix-empty-speech-bubble-size
Fix empty speech bubbles showing up squished
2018-11-26 16:31:59 -05:00
greenkeeper[bot]
077d2f1d69 fix(package): update scratch-svg-renderer to version 0.2.0-prerelease.20181126212715
Closes #367
2018-11-26 21:28:37 +00:00
Florrie
4189377128 Fix empty speech bubbles showing up squished 2018-11-16 11:29:06 -04:00
3 changed files with 21 additions and 14 deletions

View File

@@ -26,7 +26,7 @@
"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^8.2.1",
"babel-loader": "^7.1.4",
"babel-loader": "^8.0.5",
"babel-polyfill": "^6.22.0",
"babel-preset-env": "^1.6.1",
"chromeless": "^1.5.1",
@@ -38,7 +38,7 @@
"jsdoc": "^3.5.5",
"json": "^9.0.4",
"scratch-vm": "0.2.0-prerelease.20181024204838",
"tap": "^12.0.2",
"tap": "^11.0.0",
"travis-after-all": "^1.4.4",
"uglifyjs-webpack-plugin": "^1.2.5",
"webpack": "^4.8.0",
@@ -53,7 +53,7 @@
"minilog": "3.1.0",
"raw-loader": "^0.5.1",
"scratch-storage": "^1.0.0",
"scratch-svg-renderer": "0.2.0-prerelease.20181024192149",
"scratch-svg-renderer": "0.2.0-prerelease.20181220183040",
"twgl.js": "4.4.0"
}
}

View File

@@ -426,16 +426,16 @@ class Drawable {
* Should the drawable use NEAREST NEIGHBOR or LINEAR INTERPOLATION mode
*/
get useNearest () {
// We can't use nearest neighbor unless we are a multiple of 90 rotation
if (this._direction % 90 !== 0) {
return false;
}
// Raster skins (bitmaps) should always prefer nearest neighbor
if (this.skin.isRaster) {
return true;
}
// We can't use nearest neighbor unless we are a multiple of 90 rotation
if (this._direction % 90 !== 0) {
return false;
}
// If the scale of the skin is very close to 100 (0.99999 variance is okay I guess)
if (Math.abs(this.scale[0]) > 99 && Math.abs(this.scale[0]) < 101 &&
Math.abs(this.scale[1]) > 99 && Math.abs(this.scale[1]) < 101) {
@@ -536,13 +536,15 @@ class Drawable {
_getTransformedHullPoints () {
const projection = twgl.m4.ortho(-1, 1, -1, 1, -1, 1);
const skinSize = this.skin.size;
const halfXPixel = 1 / skinSize[0] / 2;
const halfYPixel = 1 / skinSize[1] / 2;
const tm = twgl.m4.multiply(this._uniforms.u_modelMatrix, projection);
const transformedHullPoints = [];
for (let i = 0; i < this._convexHullPoints.length; i++) {
const point = this._convexHullPoints[i];
const glPoint = twgl.v3.create(
0.5 + (-point[0] / skinSize[0]),
(point[1] / skinSize[1]) - 0.5,
0.5 + (-point[0] / skinSize[0]) - halfXPixel,
(point[1] / skinSize[1]) - 0.5 + halfYPixel,
0
);
twgl.m4.transformPoint(tm, glPoint, glPoint);

View File

@@ -145,11 +145,16 @@ class SVGTextBubble {
</g>`;
}
_getTextSize () {
const svgString = this._wrapSvgFragment(this._textFragment);
_getTextSize (textFragment) {
const svgString = this._wrapSvgFragment(textFragment);
if (!this._textSizeCache[svgString]) {
this._textSizeCache[svgString] = this.svgRenderer.measure(svgString);
if (this._textSizeCache[svgString].height === 0) {
// The speech bubble is empty, so use the height of a single line with content (or else it renders
// weirdly, see issue #302).
const dummyFragment = this._buildTextFragment('X');
this._textSizeCache[svgString] = this._getTextSize(dummyFragment);
}
}
return this._textSizeCache[svgString];
}
@@ -183,7 +188,7 @@ class SVGTextBubble {
let fragment = '';
const radius = 16;
const {x, y, width, height} = this._getTextSize();
const {x, y, width, height} = this._getTextSize(this._textFragment);
const padding = 10;
const fullWidth = Math.max(MIN_WIDTH, width) + (2 * padding);
const fullHeight = height + (2 * padding);