Merge pull request #1171 from fsih/rotationCenterZeros

Allow rotation centers with zeros
This commit is contained in:
DD Liu 2018-05-29 10:23:51 -04:00 committed by GitHub
commit 34587403e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,7 +24,11 @@ const loadCostumeFromAsset = function (costume, costumeAsset, runtime, optVersio
} }
const AssetType = runtime.storage.AssetType; const AssetType = runtime.storage.AssetType;
let rotationCenter; let rotationCenter;
if (costume.rotationCenterX && costume.rotationCenterY && costume.bitmapResolution) { // Use provided rotation center and resolution if they are defined. Bitmap resolution
// should only ever be 1 or 2.
if (typeof costume.rotationCenterX === 'number' && !isNaN(costume.rotationCenterX) &&
typeof costume.rotationCenterY === 'number' && !isNaN(costume.rotationCenterY) &&
costume.bitmapResolution) {
rotationCenter = [ rotationCenter = [
costume.rotationCenterX / costume.bitmapResolution, costume.rotationCenterX / costume.bitmapResolution,
costume.rotationCenterY / costume.bitmapResolution costume.rotationCenterY / costume.bitmapResolution