prevent Morphs from sharing canvasses when rerendering

pull/89/head
jmoenig 2020-01-04 23:49:42 +01:00
rodzic cff9dd32d5
commit acab6f7d94
4 zmienionych plików z 20 dodań i 14 usunięć

Wyświetl plik

@ -6,6 +6,13 @@
* **Notable Fixes:**
* **Translation Updates:**
## 5.4.2:
* **Notable Fix:**
* prevent Morphs from sharing canvasses when rerendering
### 2020-01-04
* morphic: fixed tagging of shared Canvasses
* prepared patch
## 5.4.1:
* **Notable Change:**

Wyświetl plik

@ -2,9 +2,9 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Snap! Build Your Own Blocks 5.4.1</title>
<title>Snap! Build Your Own Blocks 5.4.2</title>
<link rel="shortcut icon" href="src/favicon.ico">
<script type="text/javascript" src="src/morphic.js?version=2020-01-03"></script>
<script type="text/javascript" src="src/morphic.js?version=2020-01-04"></script>
<script type="text/javascript" src="src/widgets.js?version=2020-01-03"></script>
<script type="text/javascript" src="src/blocks.js?version=2020-01-03"></script>
<script type="text/javascript" src="src/threads.js?version=2019-12-19"></script>

Wyświetl plik

@ -78,7 +78,7 @@ Animation, BoxMorph, BlockEditorMorph, BlockDialogMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2020-January-03';
modules.gui = '2020-January-04';
// Declarations
@ -3636,7 +3636,7 @@ IDE_Morph.prototype.aboutSnap = function () {
module, btn1, btn2, btn3, btn4, licenseBtn, translatorsBtn,
world = this.world();
aboutTxt = 'Snap! 5.4.1\nBuild Your Own Blocks\n\n'
aboutTxt = 'Snap! 5.4.2\nBuild Your Own Blocks\n\n'
+ 'Copyright \u24B8 2008-2020 Jens M\u00F6nig and '
+ 'Brian Harvey\n'
+ 'jens@moenig.org, bh@cs.berkeley.edu\n\n'

Wyświetl plik

@ -1178,7 +1178,7 @@
/*global window, HTMLCanvasElement, FileReader, Audio, FileList, Map*/
var morphicVersion = '2020-January-03';
var morphicVersion = '2020-January-04';
var modules = {}; // keep track of additional loaded modules
var useBlurredShadows = getBlurredShadowSupport(); // check for Chrome-bug
@ -1451,16 +1451,7 @@ function getDocumentPositionOf(aDOMelement) {
function copy(target) {
// answer a shallow copy of target
var value, c, property, keys, l, i;
if (typeof target !== 'object') {
if (target instanceof HTMLCanvasElement) {
// tag canvas elements as being shared,
// so the next time when rerendering a Morph
// instead of recycling the shared canvas a
// new unshared one get created
// see newCanvas() function
target.dataset.morphicShare = 'true';
}
return target;
}
value = target.valueOf();
@ -1473,6 +1464,14 @@ function copy(target) {
keys = Object.keys(target);
for (l = keys.length, i = 0; i < l; i += 1) {
property = keys[i];
if (target[property] instanceof HTMLCanvasElement) {
// tag canvas elements as being shared,
// so the next time when rerendering a Morph
// instead of recycling the shared canvas a
// new unshared one get created
// see newCanvas() function
target[property].dataset.morphicShare = 'true';
}
c[property] = target[property];
}
} else {