1
0
mirror of https://github.com/Pomax/BezierInfo-2.git synced 2025-09-27 08:39:00 +02:00

error-only for http-server, better parameter parsing for sketch markup

This commit is contained in:
Pomax
2020-08-27 11:36:17 -07:00
parent 46f94282e1
commit b2314a4f87
47 changed files with 130 additions and 293 deletions

View File

@@ -1,5 +1,3 @@
import { hatch } from "./util/hatchery.js";
/**
* The base API class, responsible for such things as setting up canvas event
* handling, method accumulation, custom element binding, etc. etc.
@@ -65,7 +63,17 @@ class BaseAPI {
this.dataset = {};
}
}
this.HATCHING = hatch(canvasBuildFunction);
this.parameters = Object.fromEntries(
Object.entries(this.dataset)
.map((pair) => {
let v = pair[1];
if (v === `null` || v === `undefined`) return [];
let d = parseFloat(v);
// evaluate "string is number" using == rather than ===
return [pair[0], v == d ? d : v];
})
.filter((v) => v.length)
);
this.addListeners();
this.setSize(width, height);
this.currentPoint = false;