rearranged internal order of categories

snap7
jmoenig 2021-07-16 12:15:12 +02:00
rodzic cefab403f1
commit 78da81e104
4 zmienionych plików z 10 dodań i 19 usunięć

Wyświetl plik

@ -31,6 +31,7 @@
* new libraries manual versions, thanks, Brian!
* palette hiding/showing primitives fixes, tanks, Michael!
* readme update, thanks, Michael!
* objects, gui: rearranged internal order of categories
### 2021-07-15
* gui: made sprite-bar height independent of the number of categories

Wyświetl plik

@ -20,7 +20,7 @@
<script src="src/threads.js?version=2021-07-09"></script>
<script src="src/objects.js?version=2021-07-16"></script>
<script src="src/scenes.js?version=2021-07-06"></script>
<script src="src/gui.js?version=2021-07-15"></script>
<script src="src/gui.js?version=2021-07-16"></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-06"></script>

Wyświetl plik

@ -85,7 +85,7 @@ Animation, BoxMorph, BlockDialogMorph, RingMorph, Project, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2021-July-15';
modules.gui = '2021-July-16';
// Declarations
@ -1335,8 +1335,8 @@ IDE_Morph.prototype.createCategories = function () {
myself.categories.children.forEach(button => {
i += 1;
row = Math.ceil(i / 2);
col = 2 - (i % 2);
row = 1 + ((i - 1) % 4);
col = i < 5 ? 1 : 2;
button.setPosition(new Point(
l + (col * xPadding + ((col - 1) * buttonWidth)),
t + (row * yPadding + ((row - 1) * buttonHeight) + border)

Wyświetl plik

@ -138,12 +138,12 @@ SpriteMorph.prototype.attributes =
SpriteMorph.prototype.categories =
[
'motion',
'control',
'looks',
'sensing',
'sound',
'operators',
'pen',
'control',
'sensing',
'operators',
'variables',
'lists',
'other'
@ -2960,8 +2960,7 @@ SpriteMorph.prototype.freshPalette = function (category) {
hideNextSpace = false,
shade = new Color(140, 140, 140),
searchButton,
makeButton,
unifiedCategories;
makeButton;
palette.owner = this;
palette.padding = unit / 2;
@ -3119,15 +3118,7 @@ SpriteMorph.prototype.freshPalette = function (category) {
// In a Unified Palette custom blocks appear following each category,
// but there is only 1 make a block button (at the end).
// arrange the blocks in the unified palette column-wise:
let cat1 = this.categories.slice(0, 8),
cat2 = this.categories.slice(8);
unifiedCategories = cat1.filter(
(elem, idx) => idx % 2 === 0
).concat(cat1.filter(
(elem, idx) => idx % 2 === 1)
).concat(cat2);
blocks = unifiedCategories.reduce((blocks, category) => {
blocks = this.categories.reduce((blocks, category) => {
let header = [ this.categoryText(category), '-' ],
primitives = this.getPrimitiveTemplates(category),
customs = this.customBlockTemplatesForCategory(category),
@ -3155,7 +3146,6 @@ SpriteMorph.prototype.freshPalette = function (category) {
blocks.push(...this.customBlockTemplatesForCategory('other'));
}
blocks.forEach(block => {
if (block === null) {
return;