Skip to content

Commit

Permalink
wrapClamp direction during sb/sb2 deserialization
Browse files Browse the repository at this point in the history
  • Loading branch information
apple502j authored May 30, 2020
1 parent 58c460b commit 1012a2a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/serialization/sb2.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,9 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip,
target.y = object.scratchY;
}
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')) {
target.draggable = object.isDraggable;
Expand Down

0 comments on commit 1012a2a

Please sign in to comment.