kopia lustrzana https://github.com/backface/turtlestitch
added scene-setting to hide/show buttons in the unified palette
rodzic
8014a3acf4
commit
54d22dd118
|
@ -66,6 +66,7 @@
|
|||
|
||||
### 2021-11-24
|
||||
* threads: fixed #2918
|
||||
* gui, objects, scenes: added scene-setting to hide/show buttons in the unified palette
|
||||
|
||||
### 2021-11-23
|
||||
* byob: refresh category buttons when hiding / showing blocks
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
<script src="src/widgets.js?version=2021-17-09"></script>
|
||||
<script src="src/blocks.js?version=2021-11-09"></script>
|
||||
<script src="src/threads.js?version=2021-11-24"></script>
|
||||
<script src="src/objects.js?version=2021-11-19"></script>
|
||||
<script src="src/scenes.js?version=2021-11-12"></script>
|
||||
<script src="src/gui.js?version=2021-11-23"></script>
|
||||
<script src="src/objects.js?version=2021-11-24"></script>
|
||||
<script src="src/scenes.js?version=2021-11-24"></script>
|
||||
<script src="src/gui.js?version=2021-11-24"></script>
|
||||
<script src="src/paint.js?version=2021-07-05"></script>
|
||||
<script src="src/lists.js?version=2021-07-19"></script>
|
||||
<script src="src/byob.js?version=2021-11-23"></script>
|
||||
|
|
15
src/gui.js
15
src/gui.js
|
@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.gui = '2021-November-23';
|
||||
modules.gui = '2021-November-24';
|
||||
|
||||
// Declarations
|
||||
|
||||
|
@ -4219,6 +4219,13 @@ IDE_Morph.prototype.settingsMenu = function () {
|
|||
'uncheck to hide\ncategory names\nin the palette',
|
||||
'check to show\ncategory names\nin the palette'
|
||||
);
|
||||
addPreference(
|
||||
'Show buttons',
|
||||
() => this.togglePaletteButtons(),
|
||||
this.scene.showPaletteButtons,
|
||||
'uncheck to hide buttons\nin the palette',
|
||||
'check to show buttons\nin the palette'
|
||||
);
|
||||
}
|
||||
addPreference(
|
||||
'Persist linked sublist IDs',
|
||||
|
@ -6363,6 +6370,12 @@ IDE_Morph.prototype.toggleCategoryNames = function () {
|
|||
this.recordUnsavedChanges();
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.togglePaletteButtons = function () {
|
||||
this.scene.showPaletteButtons = !this.scene.showPaletteButtons;
|
||||
this.flushBlocksCache();
|
||||
this.refreshPalette();
|
||||
this.recordUnsavedChanges();
|
||||
};
|
||||
|
||||
IDE_Morph.prototype.setPaletteWidth = function (newWidth) {
|
||||
var msecs = this.isAnimating ? 100 : 0,
|
||||
|
|
|
@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/
|
|||
|
||||
/*jshint esversion: 6*/
|
||||
|
||||
modules.objects = '2021-November-19';
|
||||
modules.objects = '2021-November-24';
|
||||
|
||||
var SpriteMorph;
|
||||
var StageMorph;
|
||||
|
@ -3003,8 +3003,10 @@ SpriteMorph.prototype.palette = function (category) {
|
|||
SpriteMorph.prototype.freshPalette = function (category) {
|
||||
var myself = this,
|
||||
palette = new ScrollFrameMorph(null, null, this.sliderColor),
|
||||
showCategories,
|
||||
unit = SyntaxElementMorph.prototype.fontSize,
|
||||
ide,
|
||||
showCategories,
|
||||
showButtons,
|
||||
x = 0,
|
||||
y = 5,
|
||||
ry = 0,
|
||||
|
@ -3090,7 +3092,9 @@ SpriteMorph.prototype.freshPalette = function (category) {
|
|||
if (category === 'unified') {
|
||||
// In a Unified Palette custom blocks appear following each category,
|
||||
// but there is only 1 make a block button (at the end).
|
||||
showCategories = this.parentThatIsA(IDE_Morph).scene.showCategories;
|
||||
ide = this.parentThatIsA(IDE_Morph);
|
||||
showCategories = ide.scene.showCategories;
|
||||
showButtons = ide.scene.showPaletteButtons;
|
||||
blocks = SpriteMorph.prototype.allCategories().reduce(
|
||||
(blocks, category) => {
|
||||
let header = [this.categoryText(category), '-'],
|
||||
|
@ -3101,11 +3105,19 @@ SpriteMorph.prototype.freshPalette = function (category) {
|
|||
(primitives.some(item =>
|
||||
item instanceof BlockMorph) || customs.length);
|
||||
|
||||
// hide category names
|
||||
if (!showCategories && category !== 'variables') {
|
||||
primitives = primitives.filter(each =>
|
||||
each !== '-' && each !== '=');
|
||||
}
|
||||
|
||||
// hide "make / delete a variable" buttons
|
||||
if (!showButtons && category === 'variables') {
|
||||
primitives = primitives.filter(each =>
|
||||
!(each instanceof PushButtonMorph &&
|
||||
!(each instanceof ToggleMorph)));
|
||||
}
|
||||
|
||||
return blocks.concat(
|
||||
showHeader ? header : [],
|
||||
primitives,
|
||||
|
@ -3120,8 +3132,11 @@ SpriteMorph.prototype.freshPalette = function (category) {
|
|||
// ensure we do not modify the cached array
|
||||
blocks = this.getPrimitiveTemplates(category).slice();
|
||||
}
|
||||
blocks.push('=');
|
||||
blocks.push(this.makeBlockButton(category));
|
||||
|
||||
if (category !== 'unified' || showButtons) {
|
||||
blocks.push('=');
|
||||
blocks.push(this.makeBlockButton(category));
|
||||
}
|
||||
|
||||
if (category !== 'unified') {
|
||||
blocks.push('=');
|
||||
|
|
|
@ -53,7 +53,7 @@ normalizeCanvas, SnapSerializer, Costume, ThreadManager*/
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.scenes = '2021-November-12';
|
||||
modules.scenes = '2021-November-24';
|
||||
|
||||
// Projecct /////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -120,6 +120,7 @@ function Scene(aStageMorph) {
|
|||
this.hasUnsavedEdits = false;
|
||||
this.unifiedPalette = false;
|
||||
this.showCategories = true;
|
||||
this.showPaletteButtons = true;
|
||||
|
||||
// cached IDE state
|
||||
this.sprites = new List();
|
||||
|
|
Ładowanie…
Reference in New Issue