kopia lustrzana https://github.com/backface/turtlestitch
				
				
				
			added "turn around" symbol
							rodzic
							
								
									6a2c823ed6
								
							
						
					
					
						commit
						300ef8fdff
					
				|  | @ -86,6 +86,7 @@ SymbolMorph.prototype.names = [ | ||||||
|     'cloudOutline', |     'cloudOutline', | ||||||
|     'turnRight', |     'turnRight', | ||||||
|     'turnLeft', |     'turnLeft', | ||||||
|  |     'turnAround', | ||||||
|     'storage', |     'storage', | ||||||
|     'poster', |     'poster', | ||||||
|     'flash', |     'flash', | ||||||
|  | @ -284,6 +285,9 @@ SymbolMorph.prototype.renderShape = function (ctx, aColor) { | ||||||
|     case 'turnLeft': |     case 'turnLeft': | ||||||
|         this.renderSymbolTurnLeft(ctx, aColor); |         this.renderSymbolTurnLeft(ctx, aColor); | ||||||
|         break; |         break; | ||||||
|  |     case 'turnAround': | ||||||
|  |         this.renderSymbolTurnAround(ctx, aColor); | ||||||
|  |         break; | ||||||
|     case 'storage': |     case 'storage': | ||||||
|         this.renderSymbolStorage(ctx, aColor); |         this.renderSymbolStorage(ctx, aColor); | ||||||
|         break; |         break; | ||||||
|  | @ -862,6 +866,26 @@ SymbolMorph.prototype.renderSymbolTurnLeft = function (ctx, color) { | ||||||
|     ctx.fill(); |     ctx.fill(); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  | SymbolMorph.prototype.renderSymbolTurnAround = function (ctx, color) { | ||||||
|  |     // draw a right-around-turning arrow
 | ||||||
|  |     var w = this.symbolWidth(), | ||||||
|  |         l = Math.max(w / 10, 1), | ||||||
|  |         r = w / 2; | ||||||
|  | 
 | ||||||
|  |     ctx.lineWidth = l; | ||||||
|  |     ctx.strokeStyle = color.toString(); | ||||||
|  |     ctx.beginPath(); | ||||||
|  |     ctx.arc(r, r, r - l / 2, radians(-45), radians(225), false); | ||||||
|  |     ctx.stroke(); | ||||||
|  |     ctx.fillStyle = color.toString(); | ||||||
|  |     ctx.beginPath(); | ||||||
|  |     ctx.moveTo(0, r * 0.1); | ||||||
|  |     ctx.lineTo(r * 0.8, 0); | ||||||
|  |     ctx.lineTo(r * 0.7, r * 0.7); | ||||||
|  |     ctx.closePath(); | ||||||
|  |     ctx.fill(); | ||||||
|  | }; | ||||||
|  | 
 | ||||||
| SymbolMorph.prototype.renderSymbolStorage = function (ctx, color) { | SymbolMorph.prototype.renderSymbolStorage = function (ctx, color) { | ||||||
|     // draw a stack of three disks
 |     // draw a stack of three disks
 | ||||||
|     var w = this.symbolWidth(), |     var w = this.symbolWidth(), | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 jmoenig
						jmoenig