kopia lustrzana https://github.com/backface/turtlestitch
added "checked box" symbol
rodzic
bcb88fd156
commit
a4a0ca5e83
|
@ -5,7 +5,7 @@
|
|||
<title>Snap! Build Your Own Blocks 6.0.0 - beta -</title>
|
||||
<link rel="shortcut icon" href="src/favicon.ico">
|
||||
<script type="text/javascript" src="src/morphic.js?version=2020-05-19"></script>
|
||||
<script type="text/javascript" src="src/symbols.js?version=2020-05-27"></script>
|
||||
<script type="text/javascript" src="src/symbols.js?version=2020-05-28"></script>
|
||||
<script type="text/javascript" src="src/widgets.js?version=2020-05-06"></script>
|
||||
<script type="text/javascript" src="src/blocks.js?version=2020-05-25"></script>
|
||||
<script type="text/javascript" src="src/threads.js?version=2020-05-27"></script>
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
// Global stuff ////////////////////////////////////////////////////////
|
||||
|
||||
modules.symbols = '2020-May-27';
|
||||
modules.symbols = '2020-May-28';
|
||||
|
||||
var SymbolMorph;
|
||||
|
||||
|
@ -92,6 +92,7 @@ SymbolMorph.prototype.names = [
|
|||
'flash',
|
||||
'brush',
|
||||
'rectangle',
|
||||
'checkedBox',
|
||||
'rectangleSolid',
|
||||
'circle',
|
||||
'circleSolid',
|
||||
|
@ -303,6 +304,9 @@ SymbolMorph.prototype.renderShape = function (ctx, aColor) {
|
|||
case 'rectangle':
|
||||
this.renderSymbolRectangle(ctx, aColor);
|
||||
break;
|
||||
case 'checkedBox':
|
||||
this.renderSymbolCheckedBox(ctx, aColor);
|
||||
break;
|
||||
case 'rectangleSolid':
|
||||
this.renderSymbolRectangleSolid(ctx, aColor);
|
||||
break;
|
||||
|
@ -1045,6 +1049,23 @@ SymbolMorph.prototype.renderSymbolRectangle = function (ctx, color) {
|
|||
ctx.stroke();
|
||||
};
|
||||
|
||||
SymbolMorph.prototype.renderSymbolCheckedBox = function (ctx, color) {
|
||||
// draw a rectangle with a check mark
|
||||
var w = this.symbolWidth(),
|
||||
h = this.size,
|
||||
l = Math.max(w / 20, 0.5);
|
||||
|
||||
this.renderSymbolRectangle(ctx, color);
|
||||
ctx.fillStyle = color.toString();
|
||||
ctx.beginPath();
|
||||
ctx.moveTo(l, h * 0.4);
|
||||
ctx.lineTo(w * 0.5, h - l);
|
||||
ctx.lineTo(w - l, l);
|
||||
ctx.lineTo(w * 0.5, h * 0.65);
|
||||
ctx.closePath();
|
||||
ctx.fill();
|
||||
};
|
||||
|
||||
SymbolMorph.prototype.renderSymbolRectangleSolid = function (ctx, color) {
|
||||
// draw a solid rectangle
|
||||
var w = this.symbolWidth(),
|
||||
|
|
Ładowanie…
Reference in New Issue