added "gearPartial" icon

pull/95/head
jmoenig 2020-10-07 09:25:25 +02:00
rodzic c89578450b
commit 5e9f73fe51
3 zmienionych plików z 56 dodań i 2 usunięć

Wyświetl plik

@ -20,6 +20,7 @@
### 2020-10-07
* byob: added "settings" button to input slot dialog
* symbols: added "gearPartial" icon
### 2020-10-06
* blocks: disable blurred shadows inside input slots if the hidden "blurred shadows" setting is turned off

Wyświetl plik

@ -6,7 +6,7 @@
<title>Snap! 6.2.2 - dev - Build Your Own Blocks</title>
<link rel="icon" href="src/favicon.ico">
<script src="src/morphic.js?version=2020-09-12"></script>
<script src="src/symbols.js?version=2020-07-21"></script>
<script src="src/symbols.js?version=2020-10-07"></script>
<script src="src/widgets.js?version=2020-10-06"></script>
<script src="src/blocks.js?version=2020-10-06"></script>
<script src="src/threads.js?version=2020-10-05"></script>

Wyświetl plik

@ -41,7 +41,7 @@
// Global stuff ////////////////////////////////////////////////////////
modules.symbols = '2020-July-21';
modules.symbols = '2020-October-07';
var SymbolMorph;
@ -70,6 +70,7 @@ SymbolMorph.prototype.names = [
'pointRight',
'stepForward',
'gears',
'gearPartial',
'gearBig',
'file',
'fullScreen',
@ -255,6 +256,9 @@ SymbolMorph.prototype.renderShape = function (ctx, aColor) {
case 'gearBig':
this.renderSymbolGearBig(ctx, aColor);
break;
case 'gearPartial':
this.renderSymbolGearPartial(ctx, aColor);
break;
case 'file':
this.renderSymbolFile(ctx, aColor);
break;
@ -652,6 +656,55 @@ SymbolMorph.prototype.renderSymbolGearBig = function (ctx, color) {
ctx.fillRect(0, 0, w, w);
};
SymbolMorph.prototype.renderSymbolGearPartial = function (ctx, color) {
// draw gears
var w = this.symbolWidth(),
r = w * 0.75,
spikes = 8,
off = 8,
shift = 10,
angle, turn, i;
ctx.fillStyle = color.toString();
ctx.beginPath();
// draw the spiked outline
ctx.moveTo(w, r);
angle = 360 / spikes;
turn = angle * 0.5;
for (i = 0; i < spikes; i += 1) {
ctx.arc(
r,
r,
r,
radians(i * angle + turn),
radians(i * angle + off + turn)
);
ctx.arc(
r,
r,
r * 0.7,
radians(i * angle - shift + angle * 0.5 + turn),
radians(i * angle + shift + angle * 0.5 + turn)
);
ctx.arc(
r,
r,
r,
radians((i + 1) * angle - off + turn),
radians((i + 1) * angle + turn)
);
}
ctx.lineTo(w, r);
// draw the hole in the middle
ctx.arc(r, r, r * 0.3, radians(0), radians(360));
// fill
ctx.clip('evenodd');
ctx.fillRect(0, 0, w, w);
};
SymbolMorph.prototype.renderSymbolFile = function (ctx, color) {
// draw a page symbol
var height = this.size,