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

datasets for sketches

This commit is contained in:
Pomax
2020-08-24 23:20:25 -07:00
parent 4f823cf856
commit 22ffc4b6c2
107 changed files with 5474 additions and 23516 deletions

View File

@@ -38,10 +38,17 @@ class BaseAPI {
/**
*
*/
constructor(uid, width = 200, height = 200, canvasBuildFunction) {
constructor(
uid,
width = 200,
height = 200,
canvasBuildFunction, // Only used during image generation, not used in the browser
customDataSet // " "
) {
if (uid) {
this.element = window[uid];
delete window[uid];
this.dataset = this.element.dataset;
}
if (canvasBuildFunction) {
const { canvas, ctx } = canvasBuildFunction(width, height);
@@ -51,6 +58,13 @@ class BaseAPI {
} else {
this.canvas = document.createElement(`canvas`);
}
if (!this.dataset) {
if (customDataSet) {
this.dataset = customDataSet;
} else {
this.dataset = {};
}
}
this.HATCHING = hatch(canvasBuildFunction);
this.addListeners();
this.setSize(width, height);