update manual custom block-type changes in data references

snap8
Jens Mönig 2022-05-25 16:18:02 +02:00
rodzic 492188f553
commit ecd436f2fb
4 zmienionych plików z 30 dodań i 8 usunięć

Wyświetl plik

@ -51,6 +51,7 @@
### 2022-05-25
* threads: update programmatic custom block-type changes in data references
* byob: update manual custom block-type changes in data references
### 2022-05-23
* blocks: fixed block label color when expanding or inserting variadic infix slots

Wyświetl plik

@ -23,7 +23,7 @@
<script src="src/gui.js?version=2022-05-19"></script>
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2022-05-19"></script>
<script src="src/byob.js?version=2022-05-20"></script>
<script src="src/byob.js?version=2022-05-25"></script>
<script src="src/tables.js?version=2022-01-28"></script>
<script src="src/sketch.js?version=2021-11-03"></script>
<script src="src/video.js?version=2019-06-27"></script>

Wyświetl plik

@ -111,7 +111,7 @@ ArgLabelMorph*/
// Global stuff ////////////////////////////////////////////////////////
modules.byob = '2022-May-20';
modules.byob = '2022-May-25';
// Declarations
@ -2665,12 +2665,27 @@ BlockEditorMorph.prototype.refreshAllBlockInstances = function (oldSpec) {
var def = this.definition,
template = this.target.paletteBlockInstance(def);
if (this.definition.isGlobal) {
this.target.allBlockInstances(this.definition).reverse().forEach(
function isMajorTypeChange(oldType) {
var rep = ['reporter', 'predicate'],
type = def.type;
return (type === 'command' && rep.includes(oldType)) ||
(oldType == 'command' && rep.includes(type));
}
if (def.isGlobal) {
this.target.allBlockInstances(def).reverse().forEach(
block => block.refresh()
);
this.target.parentThatIsA(StageMorph).allContextsUsing(def).forEach(
context => context.changed()
context => {
if (context.expression.isCustomBlock &&
context.expression.isUnattached() &&
isMajorTypeChange(context.expression.type())
) {
context.expression = def.blockInstance();
}
context.changed();
}
);
} else {
this.target.allDependentInvocationsOf(oldSpec).reverse().forEach(
@ -2680,7 +2695,15 @@ BlockEditorMorph.prototype.refreshAllBlockInstances = function (oldSpec) {
def.blockSpec(),
this.target
).forEach(
context => context.changed()
context => {
if (context.expression.isCustomBlock &&
context.expression.isUnattached() &&
isMajorTypeChange(context.expression.type())
) {
context.expression = def.blockInstance();
}
context.changed();
}
);
}
if (template) {

Wyświetl plik

@ -5724,8 +5724,6 @@ Process.prototype.doSetBlockAttribute = function (attribute, block, val) {
);
}
}
break;
case 'scope':
if (isInUse()) {