wrapClamp direction during sb3 deserialization

This commit is contained in:
apple502j authored and GitHub committed 2020-05-30 21:58:14 +09:00
1 parent 1012a2aa61
commit bfbea4266a
1 file changed
+3 -1
+3 -1
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;