diff --git a/HISTORY.md b/HISTORY.md index af080aae..f350e335 100755 --- a/HISTORY.md +++ b/HISTORY.md @@ -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 diff --git a/snap.html b/snap.html index b550d7bc..12fcfb80 100755 --- a/snap.html +++ b/snap.html @@ -6,7 +6,7 @@ Snap! 6.2.2 - dev - Build Your Own Blocks - + diff --git a/src/symbols.js b/src/symbols.js index 05d70958..1e41a7a4 100644 --- a/src/symbols.js +++ b/src/symbols.js @@ -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,