added new "footprints" symbol

upd4.1
Jens Mönig 2017-09-25 07:40:16 +02:00
rodzic 7aef56dbe9
commit 49cf6d7eac
1 zmienionych plików z 47 dodań i 5 usunięć

Wyświetl plik

@ -41,7 +41,7 @@
// Global stuff ////////////////////////////////////////////////////////
modules.symbols = '2017-September-19';
modules.symbols = '2017-September-25';
var SymbolMorph;
@ -51,8 +51,8 @@ WorldMorph.prototype.customMorphs = function () {
return [
new SymbolMorph(
'location',
50,
'footprints',
18,
new Color(250, 250, 250),
new Point(-1, -1),
new Color(20, 20, 20)
@ -132,7 +132,8 @@ SymbolMorph.prototype.names = [
'magnifierOutline',
'notes',
'camera',
'location'
'location',
'footprints'
];
// SymbolMorph instance creation:
@ -312,6 +313,8 @@ SymbolMorph.prototype.symbolCanvasColored = function (aColor) {
return this.drawSymbolCamera(canvas, aColor);
case 'location':
return this.drawSymbolLocation(canvas, aColor);
case 'footprints':
return this.drawSymbolFootprints(canvas, aColor);
default:
return canvas;
}
@ -1590,7 +1593,7 @@ SymbolMorph.prototype.drawSymbolCamera = function (canvas, color) {
};
SymbolMorph.prototype.drawSymbolLocation = function (canvas, color) {
// answer a canvas showing a camera
// answer a canvas showing a map pin
var ctx = canvas.getContext('2d'),
w = canvas.width,
h = canvas.height,
@ -1613,3 +1616,42 @@ SymbolMorph.prototype.drawSymbolLocation = function (canvas, color) {
return canvas;
};
SymbolMorph.prototype.drawSymbolFootprints = function (canvas, color) {
// answer a canvas showing a pair of (shoe) footprints
var ctx = canvas.getContext('2d'),
w = canvas.width,
u = w / 10,
r = u * 1.5;
ctx.fillStyle = color.toString();
// left shoe
// tip
ctx.beginPath();
ctx.arc(r, r, r, radians(-200), radians(0), false);
ctx.lineTo(r * 2, u * 5.5);
ctx.lineTo(u, u * 6);
ctx.closePath();
ctx.fill();
// heel
ctx.beginPath();
ctx.arc(u * 2.25, u * 6.75, u , radians(-40), radians(-170), false);
ctx.closePath();
ctx.fill();
// right shoe
// tip
ctx.beginPath();
ctx.arc(w - r, u * 4.5, r, radians(-180), radians(20), false);
ctx.lineTo(w - u, u * 8.5);
ctx.lineTo(w - (r * 2), u * 8);
ctx.closePath();
ctx.fill();
// heel
ctx.beginPath();
ctx.arc(w - (u * 2.25), u * 9, u, radians(0), radians(-150), false);
ctx.closePath();
ctx.fill();
return canvas;
};