fixed a race condition in Morph.glideTo()

pull/89/head
jmoenig 2019-07-01 19:03:11 +02:00
rodzic 9f11b84413
commit f0c192778c
3 zmienionych plików z 19 dodań i 12 usunięć

Wyświetl plik

@ -13,6 +13,7 @@
* lists: fixed #2446
* threads: fixed an issue when iterating over a linked list with a script mutating it, thanks, Brian!
* cloud: fixed collection grid page size, thanks, Bernat!
* morphic: fixed a race condition in Morph.glideTo()
## v5
### 2019-06-27

Wyświetl plik

@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Snap! Build Your Own Blocks 5.0.1 - dev -</title>
<link rel="shortcut icon" href="src/favicon.ico">
<script type="text/javascript" src="src/morphic.js?version=2019-06-27"></script>
<script type="text/javascript" src="src/morphic.js?version=2019-07-01"></script>
<script type="text/javascript" src="src/widgets.js?version=2019-06-27"></script>
<script type="text/javascript" src="src/blocks.js?version=2019-06-27"></script>
<script type="text/javascript" src="src/threads.js?version=2019-07-01"></script>

Wyświetl plik

@ -1162,7 +1162,7 @@
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
var morphicVersion = '2019-May-21';
var morphicVersion = '2019-July-01';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@ -3894,21 +3894,27 @@ Morph.prototype.slideBackTo = function (
Morph.prototype.glideTo = function (endPoint, msecs, easing, onComplete) {
var world = this.world(),
myself = this;
world.animations.push(new Animation(
function (x) {myself.setLeft(x); },
function () {return myself.left(); },
-(this.left() - endPoint.x),
msecs || 100,
easing,
onComplete
));
myself = this,
horizontal = new Animation(
function (x) {myself.setLeft(x); },
function () {return myself.left(); },
-(this.left() - endPoint.x),
msecs || 100,
easing
);
world.animations.push(horizontal);
world.animations.push(new Animation(
function (y) {myself.setTop(y); },
function () {return myself.top(); },
-(this.top() - endPoint.y),
msecs || 100,
easing
easing,
function () {
horizontal.setter(horizontal.destination);
horizontal.isActive = false;
onComplete();
}
));
};