enable "peeling off" custom block instances from their prototype templates

pull/95/head
jmoenig 2021-04-20 14:18:10 +02:00
rodzic 23a166316b
commit 3ac1e456a5
3 zmienionych plików z 26 dodań i 3 usunięć

Wyświetl plik

@ -1,6 +1,8 @@
# Snap! (BYOB) History
## in development:
* **New Features:**
* you can now also "peel off" custom block instances from their prototype templates in the block editor
* **Notable Changes:**
* speed-up talk bubble positioning by 5x
* **Notable Fixes:**
@ -9,7 +11,8 @@
### 2021-04-17
* objects: fixed an occasional rendering glitch when changing the display style of a variable watcher
* objects: tweaked CellMorph shadow rendering
* objects: tweaked CellMorph shadow rendering
* byob: enable "peeling off" custom block instances from their prototype templates
### 2021-04-17
* new dev version

Wyświetl plik

@ -14,7 +14,7 @@
<script src="src/gui.js?version=2021-04-17"></script>
<script src="src/paint.js?version=2020-05-17"></script>
<script src="src/lists.js?version=2021-03-15"></script>
<script src="src/byob.js?version=2021-03-05"></script>
<script src="src/byob.js?version=2021-04-20"></script>
<script src="src/tables.js?version=2021-03-05"></script>
<script src="src/sketch.js?version=2020-07-13"></script>
<script src="src/video.js?version=2019-06-27"></script>

Wyświetl plik

@ -106,7 +106,7 @@ WatcherMorph, XML_Serializer, SnapTranslator*/
// Global stuff ////////////////////////////////////////////////////////
modules.byob = '2021-March-05';
modules.byob = '2021-April-20';
// Declarations
@ -645,6 +645,9 @@ CustomCommandBlockMorph.prototype.init = function (definition, isProto) {
this.isGlobal = definition ? definition.isGlobal : false;
this.isPrototype = isProto || false; // optional
CustomCommandBlockMorph.uber.init.call(this);
if (isProto) {
this.isTemplate = true;
}
this.category = definition.category;
this.selector = 'evaluateCustomBlock';
this.variables = null;
@ -655,6 +658,17 @@ CustomCommandBlockMorph.prototype.init = function (definition, isProto) {
}
};
CustomCommandBlockMorph.prototype.reactToTemplateCopy = function () {
var def;
if (this.isPrototype) {
def = this.definition;
this.isPrototype = false;
this.refresh();
this.refreshDefaults(def);
}
CustomCommandBlockMorph.uber.reactToTemplateCopy.call(this);
};
CustomCommandBlockMorph.prototype.initializeVariables = function (oldVars) {
this.variables = new VariableFrame();
if (!this.isGlobal) {
@ -1413,6 +1427,9 @@ CustomReporterBlockMorph.prototype.init = function (
this.isGlobal = definition ? definition.isGlobal : false;
this.isPrototype = isProto || false; // optional
CustomReporterBlockMorph.uber.init.call(this, isPredicate, true); // sil.
if (isProto) {
this.isTemplate = true;
}
this.category = definition.category;
this.storedTranslations = null; // transient - only for "wishes"
this.variables = new VariableFrame();
@ -1426,6 +1443,9 @@ CustomReporterBlockMorph.prototype.init = function (
CustomReporterBlockMorph.prototype.initializeVariables =
CustomCommandBlockMorph.prototype.initializeVariables;
CustomReporterBlockMorph.prototype.reactToTemplateCopy =
CustomCommandBlockMorph.prototype.reactToTemplateCopy;
CustomReporterBlockMorph.prototype.refresh = function (aDefinition) {
var def = aDefinition || this.definition;
CustomCommandBlockMorph.prototype.refresh.call(this, aDefinition, true);