wrapClamp direction during sb/sb2 deserialization

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

View file

@ -684,7 +684,9 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip,
target.y = object.scratchY; target.y = object.scratchY;
} }
if (object.hasOwnProperty('direction')) { 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('isDraggable')) { if (object.hasOwnProperty('isDraggable')) {
target.draggable = object.isDraggable; target.draggable = object.isDraggable;