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