From 46fd00600e39bfd6f03f6f87f43ad18ef26bfbf9 Mon Sep 17 00:00:00 2001
From: Mike Lynch <m.lynch@sydney.edu.au>
Date: Sun, 6 Apr 2025 16:47:16 +1000
Subject: [PATCH] Adjustable cell size

---
 src/components/dots.js |  2 +-
 src/index.md           | 21 ++++++++++++---------
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/src/components/dots.js b/src/components/dots.js
index 6966370..b34cd15 100644
--- a/src/components/dots.js
+++ b/src/components/dots.js
@@ -99,7 +99,7 @@ class DotMaker {
 
 	      	// case "hyper-out":
 	      	// 	return 2 * maxr * Math.abs(d.x - this.cx) (d.y - this.cy)) / this.width;
-	      	// case "hyoer-in":
+	      	// case "hyper-in":
 	      	// 	return 2 * maxr * (0.5 * this.width - distance((d.x - this.cx), (d.y - this.cy))) / this.width;
 
 	      	case "noise":
diff --git a/src/index.md b/src/index.md
index e058b36..a9d97ae 100644
--- a/src/index.md
+++ b/src/index.md
@@ -24,15 +24,15 @@ import random from "npm:random";
 
 import * as resvg from 'npm:@resvg/resvg-wasm';
 
-const CELL = 10;
 const MAG = 2;
-const WIDTH = 20;
-const HEIGHT = WIDTH;
+const WIDTH = 200;
+const HEIGHT = 200;
 
-const cell = view(Inputs.range([1,20], {value: 10, step:1, label: "Cell size"}));
-const mag = view(Inputs.range([1,5], {value: 2, step:1, label: "Magnificaton"}));
-const width = view(Inputs.range([1,40], {value: 20, step:1, label: "Width"}));
-const height = view(Inputs.range([1,40], {value: 20, step:1, label: "Height"}));
+const cell = view(Inputs.range([10,60], {value: 10,  label: "Cell size"}));
+//const width = view(Inputs.range([1,40], {value: 20, label: "Width"}));
+//const height = view(Inputs.range([1,40], {value: 20, label: "Height"}));
+
+//const aspect = view(Inputs.select())
 
 
 ```
@@ -127,6 +127,9 @@ if( palette_fn ) {
 
 ```js
 
+const width = WIDTH / cell;
+const height = HEIGHT / cell;
+
 const dm = new DotMaker(width, height);
 
 const dots1 = dm.dots(1 / m1, n1, false);
@@ -140,8 +143,8 @@ const dots2 = dm.dots(1 / m2, n2, false);
 
 
 const svg = d3.create("svg")
-  .attr("width", width * cell * mag)
-  .attr("height", height * cell * mag)
+  .attr("width", width * cell * MAG)
+  .attr("height", height * cell * MAG)
   .attr("viewBox", [ 0, 0, width, height ]);