wrapClamp direction during sb3 deserialization

This commit is contained in:
apple502j 2020-05-30 21:58:14 +09:00 committed by GitHub
parent 1012a2aa61
commit bfbea4266a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1043,7 +1043,9 @@ const parseScratchObject = function (object, runtime, extensions, zip, assets) {
target.y = object.y;
}
if (object.hasOwnProperty('direction')) {
target.direction = object.direction;
// Sometimes the direction can be outside of the range: LLK/scratch-gui#5806
// wrapClamp it (like we do on RenderedTarget.setDirection)
target.direction = MathUtil.wrapClamp(object.direction, -179, 180);
}
if (object.hasOwnProperty('size')) {
target.size = object.size;