added 'keyboard' and 'keyboardFilled' icons

upd4.1
Jens Mönig 2017-09-26 09:03:33 +02:00
rodzic 94fc0c25fa
commit 573d421d02
2 zmienionych plików z 66 dodań i 5 usunięć

Wyświetl plik

@ -3653,6 +3653,10 @@ Fixes:
* Objects: added "Make a block" button to every category * Objects: added "Make a block" button to every category
* Symbols, Objects: new "floating" make-a-block button in the palette * Symbols, Objects: new "floating" make-a-block button in the palette
170926
------
* Symbols: added 'keyboard' and 'keyboardFilled' icons
v4.1 Features: v4.1 Features:
* polymorphic sprite-local custom blocks * polymorphic sprite-local custom blocks
@ -3671,7 +3675,7 @@ v4.1 Features:
* spritess rotation centers can be adjusted onstage * spritess rotation centers can be adjusted onstage
* clones share their original sprites scripts, not a shallow-copy of them * clones share their original sprites scripts, not a shallow-copy of them
* a highlight-colored balloon indicates the number of active processes per shared script * a highlight-colored balloon indicates the number of active processes per shared script
* new musical “notes”, "location", "footprints" and "cross" symbols * new musical “notes”, "location", "footprints", "cross" and "keyboard" symbols
* new “visible stepping” toggle button in the control bar * new “visible stepping” toggle button in the control bar
* turn on the “Inheritance support” setting per default * turn on the “Inheritance support” setting per default
* Assert data types to list operations for more meaningful error messages * Assert data types to list operations for more meaningful error messages

Wyświetl plik

@ -41,7 +41,7 @@
// Global stuff //////////////////////////////////////////////////////// // Global stuff ////////////////////////////////////////////////////////
modules.symbols = '2017-September-25'; modules.symbols = '2017-September-26';
var SymbolMorph; var SymbolMorph;
@ -51,8 +51,8 @@ WorldMorph.prototype.customMorphs = function () {
return [ return [
new SymbolMorph( new SymbolMorph(
'footprints', 'keyboardFilled',
18, 50,
new Color(250, 250, 250), new Color(250, 250, 250),
new Point(-1, -1), new Point(-1, -1),
new Color(20, 20, 20) new Color(20, 20, 20)
@ -134,7 +134,9 @@ SymbolMorph.prototype.names = [
'notes', 'notes',
'camera', 'camera',
'location', 'location',
'footprints' 'footprints',
'keyboard',
'keyboardFilled'
]; ];
// SymbolMorph instance creation: // SymbolMorph instance creation:
@ -318,6 +320,10 @@ SymbolMorph.prototype.symbolCanvasColored = function (aColor) {
return this.drawSymbolLocation(canvas, aColor); return this.drawSymbolLocation(canvas, aColor);
case 'footprints': case 'footprints':
return this.drawSymbolFootprints(canvas, aColor); return this.drawSymbolFootprints(canvas, aColor);
case 'keyboard':
return this.drawSymbolKeyboard(canvas, aColor);
case 'keyboardFilled':
return this.drawSymbolKeyboardFilled(canvas, aColor);
default: default:
return canvas; return canvas;
} }
@ -350,6 +356,8 @@ SymbolMorph.prototype.symbolWidth = function () {
case 'cloudOutline': case 'cloudOutline':
case 'turnBack': case 'turnBack':
case 'turnForward': case 'turnForward':
case 'keyboard':
case 'keyboardFilled':
return size * 1.6; return size * 1.6;
case 'turnRight': case 'turnRight':
case 'turnLeft': case 'turnLeft':
@ -1676,3 +1684,52 @@ SymbolMorph.prototype.drawSymbolFootprints = function (canvas, color) {
ctx.fill(); ctx.fill();
return canvas; return canvas;
}; };
SymbolMorph.prototype.drawSymbolKeyboard = function (canvas, color) {
// answer a canvas showing a typing keyboard
var ctx = canvas.getContext('2d'),
h = canvas.height,
u = h / 10,
k = h / 5,
row, col;
ctx.fillStyle = color.toString();
for (row = 0; row < 2; row += 1) {
for (col = 0; col < 5; col += 1) {
ctx.fillRect(
((u + k) * col) + u,
((u + k) * row) + u,
k,
k
);
}
}
ctx.fillRect(u * 4, u * 7, k * 4, k);
return canvas;
};
SymbolMorph.prototype.drawSymbolKeyboardFilled = function (canvas, color) {
// answer a canvas showing a typing keyboard
var ctx = canvas.getContext('2d'),
w = canvas.width,
h = canvas.height,
u = h / 10,
k = h / 5,
row, col;
ctx.fillStyle = color.toString();
ctx.fillRect(0, 0, w, h);
ctx.globalCompositeOperation = 'destination-out';
for (row = 0; row < 2; row += 1) {
for (col = 0; col < 5; col += 1) {
ctx.fillRect(
((u + k) * col) + u,
((u + k) * row) + u,
k,
k
);
}
}
ctx.fillRect(u * 4, u * 7, k * 4, k);
return canvas;
};