Merge pull request #2449 from apple502j/patch-13

fix: wrapClamp direction during deserialization
This commit is contained in:
Christopher Willis-Ford authored and GitHub committed 2023-10-17 13:01:20 -07:00
commit 2ae67598ee
2 files changed
+6 -2

No files matched your search

+3 -1
View File
@@ -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;
+3 -1
View File
@@ -1060,7 +1060,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;