kopia lustrzana https://github.com/backface/turtlestitch
new feature: hide custom helper blocks in palette
rodzic
e34acb2653
commit
52ab29c261
|
|
@ -6,6 +6,7 @@
|
|||
* extensions
|
||||
* single blocks palette option, thanks, Michael!
|
||||
* web-serial support, thanks, Dariusz Dorożalski!
|
||||
* hide custom helper blocks in palette
|
||||
* **Notable Changes:**
|
||||
* saved projects remember the last edited srpite
|
||||
* libraries no longer rely on the JSF primitive, project may need to re-import their libraries to run without having to enable JS extensions
|
||||
|
|
@ -18,6 +19,9 @@
|
|||
* **Translation Updates:**
|
||||
* German
|
||||
|
||||
### 2021-07-06
|
||||
* byob, objects: new feature: hide custom helper blocks in palette
|
||||
|
||||
### 2021-07-05
|
||||
* gui: unified palette: indicate "selected" category in selector buttons
|
||||
* extensions: web-serial extension primitives, pioneered by Dariusz Dorożalski
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
<script src="src/widgets.js?version=2021-07-05"></script>
|
||||
<script src="src/blocks.js?version=2021-07-05"></script>
|
||||
<script src="src/threads.js?version=2021-07-05"></script>
|
||||
<script src="src/objects.js?version=2021-07-05"></script>
|
||||
<script src="src/objects.js?version=2021-07-06"></script>
|
||||
<script src="src/scenes.js?version=2021-07-05"></script>
|
||||
<script src="src/gui.js?version=2021-07-05"></script>
|
||||
<script src="src/paint.js?version=2021-07-05"></script>
|
||||
<script src="src/lists.js?version=2021-07-05"></script>
|
||||
<script src="src/byob.js?version=2021-07-05"></script>
|
||||
<script src="src/byob.js?version=2021-07-06"></script>
|
||||
<script src="src/tables.js?version=2021-05-07"></script>
|
||||
<script src="src/sketch.js?version=2021-07-05"></script>
|
||||
<script src="src/video.js?version=2019-06-27"></script>
|
||||
|
|
|
|||
20
src/byob.js
20
src/byob.js
|
|
@ -108,7 +108,7 @@ WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.byob = '2021-July-05';
|
||||
modules.byob = '2021-July-06';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
|
@ -145,6 +145,7 @@ function CustomBlockDefinition(spec, receiver) {
|
|||
// value: [type, default, options, isReadOnly]
|
||||
this.variableNames = [];
|
||||
this.comment = null;
|
||||
this.isHelper = false;
|
||||
this.codeMapping = null; // experimental, generate text code
|
||||
this.codeHeader = null; // experimental, generate text code
|
||||
this.translations = {}; // experimental, format: {lang : spec}
|
||||
|
|
@ -1174,6 +1175,13 @@ CustomCommandBlockMorph.prototype.userMenu = function () {
|
|||
);
|
||||
}
|
||||
}
|
||||
addOption(
|
||||
'in palette',
|
||||
() => hat.isHelper = !hat.isHelper,
|
||||
!hat.isHelper,
|
||||
'uncheck to\nhide in palette',
|
||||
'check to\nshow in palette'
|
||||
);
|
||||
} else {
|
||||
menu = this.constructor.uber.userMenu.call(this);
|
||||
if (!menu) {
|
||||
|
|
@ -2404,6 +2412,7 @@ BlockEditorMorph.prototype.updateDefinition = function () {
|
|||
}
|
||||
this.definition.category = head.blockCategory;
|
||||
this.definition.type = head.type;
|
||||
this.definition.isHelper = head.isHelper;
|
||||
if (head.comment) {
|
||||
this.definition.comment = head.comment.fullCopy();
|
||||
this.definition.comment.block = true; // serialize in short form
|
||||
|
|
@ -2476,6 +2485,14 @@ BlockEditorMorph.prototype.variableNames = function () {
|
|||
).variableNames();
|
||||
};
|
||||
|
||||
BlockEditorMorph.prototype.isHelper = function () {
|
||||
// answer the helper declaration from my (edited) prototype hat
|
||||
return detect(
|
||||
this.body.contents.children,
|
||||
c => c instanceof PrototypeHatBlockMorph
|
||||
).isHelper;
|
||||
};
|
||||
|
||||
// BlockEditorMorph translation
|
||||
|
||||
BlockEditorMorph.prototype.editTranslations = function () {
|
||||
|
|
@ -2577,6 +2594,7 @@ PrototypeHatBlockMorph.prototype.init = function (definition) {
|
|||
// additional attributes to store edited data
|
||||
this.blockCategory = definition ? definition.category : null;
|
||||
this.type = definition ? definition.type : null;
|
||||
this.isHelper = definition ? definition.isHelper : false;
|
||||
|
||||
// init inherited stuff
|
||||
HatBlockMorph.uber.init.call(this);
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.objects = '2021-July-05';
|
||||
modules.objects = '2021-July-06';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
|
@ -2833,8 +2833,9 @@ SpriteMorph.prototype.customBlockTemplatesForCategory = function (category) {
|
|||
isInherited = false, block, inheritedBlocks;
|
||||
|
||||
function addCustomBlock(definition) {
|
||||
if (definition.category === category ||
|
||||
(Array.isArray(category) && category.includes(definition.category))
|
||||
if (!definition.isHelper &&
|
||||
(definition.category === category ||
|
||||
(Array.isArray(category) && category.includes(definition.category)))
|
||||
) {
|
||||
block = definition.templateInstance();
|
||||
if (isInherited) {block.ghost(); }
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue