kopia lustrzana https://github.com/backface/turtlestitch
remodelled context menu for inheritance to use check-boxes
rodzic
4744e97275
commit
a0fe652116
59
blocks.js
59
blocks.js
|
@ -150,7 +150,7 @@ CustomCommandBlockMorph*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.blocks = '2017-July-25';
|
modules.blocks = '2017-July-27';
|
||||||
|
|
||||||
var SyntaxElementMorph;
|
var SyntaxElementMorph;
|
||||||
var BlockMorph;
|
var BlockMorph;
|
||||||
|
@ -2498,21 +2498,16 @@ BlockMorph.prototype.userMenu = function () {
|
||||||
}[this.selector];
|
}[this.selector];
|
||||||
if (field && rcvr && rcvr.exemplar) {
|
if (field && rcvr && rcvr.exemplar) {
|
||||||
menu.addLine();
|
menu.addLine();
|
||||||
if (rcvr.inheritsAttribute(field)) {
|
addOption(
|
||||||
menu.addItem(
|
'inherited',
|
||||||
'disinherit',
|
function () {
|
||||||
function () {
|
rcvr.toggleInheritanceForAttribute(field);
|
||||||
rcvr.shadowAttribute(field);
|
},
|
||||||
}
|
rcvr.inheritsAttribute(field),
|
||||||
);
|
'uncheck to\ndisinherit',
|
||||||
} else {
|
localize('check to inherit\nfrom')
|
||||||
menu.addItem(
|
+ ' ' + rcvr.exemplar.name
|
||||||
localize('inherit from') + ' ' + rcvr.exemplar.name,
|
);
|
||||||
function () {
|
|
||||||
rcvr.inheritAttribute(field);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6118,6 +6113,16 @@ ScriptsMorph.prototype.userMenu = function () {
|
||||||
hasUndropQueue,
|
hasUndropQueue,
|
||||||
stage = obj.parentThatIsA(StageMorph);
|
stage = obj.parentThatIsA(StageMorph);
|
||||||
|
|
||||||
|
function addOption(label, toggle, test, onHint, offHint) {
|
||||||
|
var on = '\u2611 ',
|
||||||
|
off = '\u2610 ';
|
||||||
|
menu.addItem(
|
||||||
|
(test ? on : off) + localize(label),
|
||||||
|
toggle,
|
||||||
|
test ? onHint : offHint
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ide) {
|
if (!ide) {
|
||||||
blockEditor = this.parentThatIsA(BlockEditorMorph);
|
blockEditor = this.parentThatIsA(BlockEditorMorph);
|
||||||
if (blockEditor) {
|
if (blockEditor) {
|
||||||
|
@ -6182,22 +6187,16 @@ ScriptsMorph.prototype.userMenu = function () {
|
||||||
if (ide) {
|
if (ide) {
|
||||||
menu.addLine();
|
menu.addLine();
|
||||||
if (obj.exemplar) {
|
if (obj.exemplar) {
|
||||||
if (obj.inheritsAttribute('scripts')) {
|
addOption(
|
||||||
menu.addItem(
|
'inherited',
|
||||||
'disinherit scripts',
|
|
||||||
function () {
|
function () {
|
||||||
obj.shadowAttribute('scripts');
|
obj.toggleInheritanceForAttribute('scripts');
|
||||||
}
|
},
|
||||||
|
obj.inheritsAttribute('scripts'),
|
||||||
|
'uncheck to\ndisinherit',
|
||||||
|
localize('check to inherit\nfrom')
|
||||||
|
+ ' ' + obj.exemplar.name
|
||||||
);
|
);
|
||||||
} else {
|
|
||||||
menu.addItem(
|
|
||||||
'inherit scripts\nfrom' + ' ' + obj.exemplar.name,
|
|
||||||
function () {
|
|
||||||
obj.inheritAttribute('scripts');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
menu.addLine();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
menu.addItem(
|
menu.addItem(
|
||||||
'make a block...',
|
'make a block...',
|
||||||
|
|
|
@ -3555,6 +3555,7 @@ Fixes:
|
||||||
170727
|
170727
|
||||||
------
|
------
|
||||||
* Objects: don't shadow costume # when editing a costume
|
* Objects: don't shadow costume # when editing a costume
|
||||||
|
* Blocks, Objects: remodelled context menu for inheritance to use check-boxes
|
||||||
|
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
|
@ -5537,6 +5537,14 @@ SpriteMorph.prototype.refreshInheritedAttribute = function (aName) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SpriteMorph.prototype.toggleInheritanceForAttribute = function (aName) {
|
||||||
|
if (this.inheritsAttribute(aName)) {
|
||||||
|
this.shadowAttribute(aName);
|
||||||
|
} else {
|
||||||
|
this.inheritAttribute(aName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// SpriteMorph inheritance - variables
|
// SpriteMorph inheritance - variables
|
||||||
|
|
||||||
SpriteMorph.prototype.isVariableNameInUse = function (vName, isGlobal) {
|
SpriteMorph.prototype.isVariableNameInUse = function (vName, isGlobal) {
|
||||||
|
|
Ładowanie…
Reference in New Issue