fixed a loading bug for projects with watchers on SVG costumes

pull/95/head
jmoenig 2020-11-20 15:39:07 +01:00
rodzic 01971e2dec
commit cd9229cb7d
2 zmienionych plików z 9 dodań i 5 usunięć

Wyświetl plik

@ -5,6 +5,7 @@
* **Notable Changes:**
* changed determining "neighbors" from rectangular to circular perimeter
* **Notable Fixes:**
* fixed a loading bug for projects with watchers on SVG costumes
* fixed stretching SVG costumes with fixed aspect ratios in Firefox
* only report neighbors that are visible
* **Translation Updates:**
@ -16,6 +17,7 @@
* Italian translation update, thanks, Stefano!
* Spanish translation update, thanks, Joan!
* threads, objects: changed determining "neighbors" from rectangular to circular perimeter
* objects: fixed a loading bug for projects with watchers on SVG costumes
* prepared patch
### 2020-11-19

Wyświetl plik

@ -9948,15 +9948,17 @@ Costume.prototype.thumbnail = function (extentPoint, recycleMe, noPadding) {
// if "noPadding" is "true" the resulting thumbnail fits inside the
// given extentPoint without padding it, i.e. one of the dimensions
// is likely to be lesser than that of the extentPoint
var src = this.contents, // at this time sprites aren't composite morphs
var src = this.contents,
w = src ? src.width : 1, // could be an asynchronously loading SVG
h = src ? src.height : 1, // could be an asynchronously loading SVG
scale = Math.min(
(extentPoint.x / src.width),
(extentPoint.y / src.height)
(extentPoint.x / w),
(extentPoint.y / h)
),
xOffset = noPadding ? 0
: Math.floor((extentPoint.x - (src.width * scale)) / 2),
: Math.floor((extentPoint.x - (w * scale)) / 2),
yOffset = noPadding ? 0
: Math.floor((extentPoint.y - (src.height * scale)) / 2),
: Math.floor((extentPoint.y - (h * scale)) / 2),
trg, ctx;
trg = newCanvas(