little reformattings, mostly to shut up LINT

snap7
jmoenig 2021-07-02 17:04:56 +02:00
rodzic b958e2fe3a
commit 96bf69b83e
7 zmienionych plików z 65 dodań i 42 usunięć

Wyświetl plik

@ -3,11 +3,15 @@
## in development for v7:
* **New Features:**
* Scenes
* unified blocks palette option, thanks, Michael!
* **Notable Changes:**
* saved projects remember the last edited srpite
* **Notable Fixes:**
* made scrollbars in the wardrobe and jukebox more responsive
### 2021-07-02
* gui, object, store, etc.: unified blocks palette option, thanks, Michael!
### 2021-05-21
* gui, scenes, store: proxied thumbnail, name and notes in project, restored in XML
* gui: distinguished project name from scene names, removed hidden "export as plain text" option

Wyświetl plik

@ -8,11 +8,11 @@
<script src="src/morphic.js?version=2021-04-12"></script>
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-01-05"></script>
<script src="src/blocks.js?version=2021-06-18"></script>
<script src="src/blocks.js?version=2021-07-02"></script>
<script src="src/threads.js?version=2021-06-24"></script>
<script src="src/objects.js?version=2021-06-14"></script>
<script src="src/scenes.js?version=2021-05-21"></script>
<script src="src/gui.js?version=2021-06-23"></script>
<script src="src/objects.js?version=2021-07-02"></script>
<script src="src/scenes.js?version=2021-07-02"></script>
<script src="src/gui.js?version=2021-07-02"></script>
<script src="src/paint.js?version=2020-05-17"></script>
<script src="src/lists.js?version=2021-03-15"></script>
<script src="src/byob.js?version=2021-06-24"></script>
@ -22,7 +22,7 @@
<script src="src/maps.js?version=2021-06-15"></script>
<script src="src/extensions.js?version=2021-07-02"></script>
<script src="src/xml.js?version=2020-04-27"></script>
<script src="src/store.js?version=2021-06-24"></script>
<script src="src/store.js?version=2021-07-02"></script>
<script src="src/locale.js?version=2021-06-11"></script>
<script src="src/cloud.js?version=2021-02-04"></script>
<script src="src/api.js?version=2021-01-25"></script>

Wyświetl plik

@ -158,7 +158,7 @@ CustomCommandBlockMorph, ToggleButtonMorph, DialMorph, SnapExtensions*/
// Global stuff ////////////////////////////////////////////////////////
modules.blocks = '2021-June-18';
modules.blocks = '2021-July-02';
var SyntaxElementMorph;
var BlockMorph;
@ -11030,7 +11030,8 @@ BooleanSlotMorph.prototype.drawKnob = function (ctx, progress) {
var w = this.width(),
r = this.height() / 2,
shift = this.edge / 2,
slideStep = (this.width() - this.height()) / 4 * Math.max(0, (progress || 0)),
slideStep = (this.width() - this.height()) / 4 *
Math.max(0, (progress || 0)),
gradient,
x,
y = r,

Wyświetl plik

@ -83,7 +83,7 @@ Animation, BoxMorph, BlockDialogMorph, Project, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2021-June-23';
modules.gui = '2021-July-02';
// Declarations
@ -1270,7 +1270,7 @@ IDE_Morph.prototype.createCategories = function () {
each.refresh()
);
myself.refreshPalette(true);
}
};
}
function scrollToCategory(category) {
@ -2533,11 +2533,13 @@ IDE_Morph.prototype.refreshPalette = function (shouldIgnorePosition) {
IDE_Morph.prototype.scrollPaletteToCategory = function (category) {
let palette = this.palette,
firstInCategory = palette.contents.children.find(block => block.category == category);
firstInCategory = palette.contents.children.find(
block => block.category === category
);
palette.scrollY(palette.top() - firstInCategory.top() + palette.padding);
palette.adjustScrollBars();
}
};
IDE_Morph.prototype.pressStart = function () {
if (this.world().currentKey === 16) { // shiftClicked
@ -6024,7 +6026,7 @@ IDE_Morph.prototype.toggleUnifiedPalette = function () {
this.flushBlocksCache();
this.currentSprite.palette(this.currentCategory);
this.refreshPalette(true);
}
};
IDE_Morph.prototype.setPaletteWidth = function (newWidth) {
var msecs = this.isAnimating ? 100 : 0,

Wyświetl plik

@ -84,7 +84,7 @@ BlockEditorMorph, BlockDialogMorph, PrototypeHatBlockMorph, BooleanSlotMorph,
localize, TableMorph, TableFrameMorph, normalizeCanvas, VectorPaintEditorMorph,
AlignmentMorph, Process, WorldMap, copyCanvas, useBlurredShadows*/
modules.objects = '2021-June-14';
modules.objects = '2021-July-02';
var SpriteMorph;
var StageMorph;
@ -856,7 +856,7 @@ SpriteMorph.prototype.initBlocks = function () {
doTellTo: {
type: 'command',
category: 'control',
// spec: 'tell %spr to %cl' // I liked this version much better, -Jens
// spec: 'tell %spr to %cl' // I liked this version better, -Jens
spec: 'tell %spr to %cmdRing %inputs'
},
reportAskFor: {
@ -2285,9 +2285,9 @@ SpriteMorph.prototype.variableBlock = function (varName, isLocalTemplate) {
// SpriteMorph block templates
SpriteMorph.prototype.blockTemplates = function (category) {
SpriteMorph.prototype.blockTemplates = function (category = 'motion') {
var blocks = [], myself = this, varNames,
category = category || 'motion';
inheritedVars = this.inheritedVariableNames();
function block(selector, isGhosted) {
if (StageMorph.prototype.hiddenPrimitives[selector]) {
@ -2456,7 +2456,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
// for debugging: ///////////////
if (this.world().isDevMode) {
blocks.push('-');
blocks.push(devModeText());
blocks.push(this.devModeText());
blocks.push('-');
blocks.push(block('doPlayFrequency'));
}
@ -2736,7 +2736,7 @@ SpriteMorph.prototype.blockTemplates = function (category) {
// Utitlies displayed in the palette
SpriteMorph.prototype.makeVariableButton = function () {
let button, myself = this;
var button, myself = this;
function addVar(pair) {
var ide;
@ -2773,10 +2773,10 @@ SpriteMorph.prototype.makeVariableButton = function () {
button.selector = 'addVariable';
button.showHelp = BlockMorph.prototype.showHelp;
return button;
}
};
SpriteMorph.prototype.deleteVariableButton = function () {
let button, myself = this;
var button, myself = this;
button = new PushButtonMorph(
null,
function () {
@ -2806,21 +2806,24 @@ SpriteMorph.prototype.deleteVariableButton = function () {
button.selector = 'deleteVariable';
button.showHelp = BlockMorph.prototype.showHelp;
return button;
}
};
SpriteMorph.prototype.devModeText = function () {
let txt = new TextMorph(localize('development mode \ndebugging primitives:'));
var txt = new TextMorph(
localize('development mode \ndebugging primitives:')
);
txt.fontSize = 9;
txt.setColor(this.paletteTextColor);
return txt;
}
};
SpriteMorph.prototype.helpMenu = function () {
// return a 1 item context menu for anything that implements a 'showHelp' method.
// return a 1 item context menu for anything that implements
// a 'showHelp' method.
var menu = new MenuMorph(this);
menu.addItem('help...', 'showHelp');
return menu;
}
};
// returns an array alock templates for a selected category.
SpriteMorph.prototype.customBlockTemplatesForCategory = function (category) {
@ -2829,7 +2832,8 @@ SpriteMorph.prototype.customBlockTemplatesForCategory = function (category) {
function addCustomBlock(definition) {
if (definition.category === category ||
(Array.isArray(category) && category.includes(definition.category))) {
(Array.isArray(category) && category.includes(definition.category))
) {
block = definition.templateInstance();
if (isInherited) {block.ghost(); }
blocks.push(block);
@ -2848,7 +2852,9 @@ SpriteMorph.prototype.customBlockTemplatesForCategory = function (category) {
// inherited custom blocks:
if (this.exemplar) {
inheritedBlocks = this.inheritedBlocks(true);
if (this.customBlocks.length && inheritedBlocks.length) {blocks.push('='); }
if (this.customBlocks.length && inheritedBlocks.length) {
blocks.push('=');
}
isInherited = true;
inheritedBlocks.forEach(addCustomBlock);
}
@ -2910,7 +2916,7 @@ SpriteMorph.prototype.makeBlock = function () {
};
SpriteMorph.prototype.getPrimitiveTemplates = function (category) {
blocks = this.primitivesCache[category];
var blocks = this.primitivesCache[category];
if (!blocks) {
blocks = this.blockTemplates(category);
if (this.isCachingPrimitives) {
@ -2918,7 +2924,7 @@ SpriteMorph.prototype.getPrimitiveTemplates = function (category) {
}
}
return blocks;
}
};
SpriteMorph.prototype.palette = function (category) {
if (!this.paletteCache[category]) {
@ -2935,7 +2941,6 @@ SpriteMorph.prototype.freshPalette = function (category) {
ry = 0,
blocks,
hideNextSpace = false,
stage = this.parentThatIsA(StageMorph),
shade = new Color(140, 140, 140),
searchButton,
makeButton;
@ -4325,7 +4330,7 @@ SpriteMorph.prototype.setColorComponentHSVA = function (idx, num) {
idx = +idx;
if (idx < 0 || idx > 3) {return; }
if (idx == 0) {
if (idx === 0) {
if (n < 0 || n > 100) { // wrap the hue
n = (n < 0 ? 100 : 0) + n % 100;
}
@ -8479,9 +8484,8 @@ StageMorph.prototype.pauseGenericHatBlocks = function () {
// StageMorph block templates
StageMorph.prototype.blockTemplates = function (category) {
var blocks = [], myself = this, varNames,
category = category || 'motion', txt;
StageMorph.prototype.blockTemplates = function (category = 'motion') {
var blocks = [], myself = this, varNames, txt;
function block(selector) {
if (myself.hiddenPrimitives[selector]) {
@ -8989,7 +8993,9 @@ StageMorph.prototype.fancyThumbnail = function (
ctx.restore();
}
this.children.forEach(morph => {
if ((isSnapObject(morph) || !noWatchers) && morph.isVisible && (morph !== excludedSprite)) {
if ((isSnapObject(morph) || !noWatchers) &&
morph.isVisible && (morph !== excludedSprite)
) {
fb = morph.fullBounds();
fimg = morph.fullImage();
if (fimg.width && fimg.height) {
@ -9100,7 +9106,7 @@ StageMorph.prototype.setColorComponentHSVA = function (idx, num) {
idx = +idx;
if (idx < 0 || idx > 3) {return; }
if (idx == 0) {
if (idx === 0) {
if (n < 0 || n > 100) { // wrap the hue
n = (n < 0 ? 100 : 0) + n % 100;
}
@ -9156,11 +9162,21 @@ StageMorph.prototype.deleteVariable = SpriteMorph.prototype.deleteVariable;
StageMorph.prototype.makeBlock = SpriteMorph.prototype.makeBlock;
StageMorph.prototype.helpMenu = SpriteMorph.prototype.helpMenu;
StageMorph.prototype.makeBlockButton = SpriteMorph.prototype.makeBlockButton;
StageMorph.prototype.makeVariableButton = SpriteMorph.prototype.makeVariableButton;
StageMorph.prototype.makeVariableButton
= SpriteMorph.prototype.makeVariableButton;
StageMorph.prototype.devModeText = SpriteMorph.prototype.devModeText;
StageMorph.prototype.deleteVariableButton = SpriteMorph.prototype.deleteVariableButton;
StageMorph.prototype.customBlockTemplatesForCategory = SpriteMorph.prototype.customBlockTemplatesForCategory;
StageMorph.prototype.getPrimitiveTemplates = SpriteMorph.prototype.getPrimitiveTemplates;
StageMorph.prototype.deleteVariableButton
= SpriteMorph.prototype.deleteVariableButton;
StageMorph.prototype.customBlockTemplatesForCategory
= SpriteMorph.prototype.customBlockTemplatesForCategory;
StageMorph.prototype.getPrimitiveTemplates
= SpriteMorph.prototype.getPrimitiveTemplates;
StageMorph.prototype.palette = SpriteMorph.prototype.palette;
StageMorph.prototype.freshPalette = SpriteMorph.prototype.freshPalette;
StageMorph.prototype.blocksMatching = SpriteMorph.prototype.blocksMatching;

Wyświetl plik

@ -51,7 +51,7 @@
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List,
normalizeCanvas, SnapSerializer*/
modules.scenes = '2021-May-21';
modules.scenes = '2021-July-02';
// Projecct /////////////////////////////////////////////////////////

Wyświetl plik

@ -61,7 +61,7 @@ Project*/
// Global stuff ////////////////////////////////////////////////////////
modules.store = '2021-June-24';
modules.store = '2021-July-02';
// XML_Serializer ///////////////////////////////////////////////////////
/*