From 1859b4a1bf1002b6e3acc0db7e0c5ec69a7a1ab6 Mon Sep 17 00:00:00 2001 From: jmoenig Date: Fri, 16 Jul 2021 12:31:34 +0200 Subject: [PATCH] updated byob.js for new internal categories ordering --- HISTORY.md | 1 + snap.html | 2 +- src/byob.js | 15 +++++++++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index 449a1f9e..228b729c 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -32,6 +32,7 @@ * palette hiding/showing primitives fixes, tanks, Michael! * readme update, thanks, Michael! * objects, gui: rearranged internal order of categories +* byob: rearranged internal order of categories ### 2021-07-15 * gui: made sprite-bar height independent of the number of categories diff --git a/snap.html b/snap.html index 1a3da66f..9442e223 100755 --- a/snap.html +++ b/snap.html @@ -23,7 +23,7 @@ - + diff --git a/src/byob.js b/src/byob.js index 576092da..dac4fc3f 100644 --- a/src/byob.js +++ b/src/byob.js @@ -108,7 +108,7 @@ WatcherMorph, XML_Serializer, SnapTranslator, SnapExtensions*/ // Global stuff //////////////////////////////////////////////////////// -modules.byob = '2021-July-06'; +modules.byob = '2021-July-16'; // Declarations @@ -1811,7 +1811,9 @@ BlockDialogMorph.prototype.addCategoryButton = function (category) { var labelWidth = 75, colors = [ IDE_Morph.prototype.frameColor, - IDE_Morph.prototype.frameColor.darker(MorphicPreferences.isFlat ? 5 : 50), + IDE_Morph.prototype.frameColor.darker + (MorphicPreferences.isFlat ? 5 : 50 + ), SpriteMorph.prototype.blockColor[category] ], button; @@ -1869,8 +1871,13 @@ BlockDialogMorph.prototype.fixCategoriesLayout = function () { this.categories.children.forEach(button => { i += 1; - row = Math.ceil(i / 2); - col = 2 - (i % 2); + if (i < 8) { + row = 1 + ((i - 1) % 4); + col = i < 5 ? 1 : 2; + } else { + row = Math.ceil(i / 2); + col = 2 - (i % 2); + } button.setPosition(new Point( l + (col * xPadding + ((col - 1) * buttonWidth)), t + (row * yPadding + ((row - 1) * buttonHeight) + border)