From 50b59fd0120f1d533a5d6d4e60970c7723724f6c Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 22 Mar 2015 23:51:26 +0000 Subject: [PATCH] Add California tartan --- tartans/index.mdwn | 3 ++- tartans/presets.js | 4 ++++ tartans/weave.js | 11 ++++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/tartans/index.mdwn b/tartans/index.mdwn index 6cc6979..7f733a3 100644 --- a/tartans/index.mdwn +++ b/tartans/index.mdwn @@ -4,13 +4,14 @@ Header: Sorry, you need HTML5 and JavaScript for this. +
-Zoom: +Zoom:
diff --git a/tartans/presets.js b/tartans/presets.js index 5d17037..45a13ca 100644 --- a/tartans/presets.js +++ b/tartans/presets.js @@ -19,6 +19,10 @@ var tartans = { "sett": "Y8 BK2 Y8 BK2 B6 BK2 G8 B4 G8 BK2 B6 BK2 LR10 W2 LR10 BK2 B6 BK2 .", "description": "I typed in this one as an example of an asymmetric sett." }, + "California": { + "sett": "Y8 K2 G20 R4 G20 R8 G20 K32 B56 K2 LB8 K2 B56 K32 G20 R4 G20 K2 Y8", + "description": "Contributed by the illustrious Sam Phillips" + }, "Colorado": { "sett": "Y4 R6 (669)34 K40 G4 W6 LV6 W6 G22", "description": "Wikipedia lists the sett as [Y/6] R4 MB26 K32 G4 W4 Lv4 W4 [G/44]. I'm not familiar with the [Color/Count] notation, the count appears to be doubled, possibly to indicate the total count of that thread in the mirror section.\n\nColorado house joint resolution 97-1016 makes this official but doesnt provide a thread count. It speaks of \"cerulean blue\" which I approximate with the unique (669) color." diff --git a/tartans/weave.js b/tartans/weave.js index d5f98d0..3f7c811 100644 --- a/tartans/weave.js +++ b/tartans/weave.js @@ -54,6 +54,11 @@ function Loom(ctx, warp, threadwidth) { ctx.lineWidth = Number(threadwidth || 2); + // Avoid infinite loop + if (warp.length == 0) { + return; + } + // Draw the weft for (var x = 0; x < width; ) { for (var i in warp) { @@ -238,7 +243,11 @@ function init() { presetInput.appendChild(opt); } - preset(); + if (presetName) { + preset(); + } else { + update(); + } } window.addEventListener("load", init);