// SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
// For more information, please refer to <https://unlicense.org/>
// SPDX-License-Identifier: Unlicense
// dam-plus-widgets-0.2.js and semicircle-jam.js should be loaded before this.
// After this is loaded, call launch() to start the gewgaw.
function launch(config) {
var div=DAM.maker('div'), button=DAM.maker('button'), canvas=DAM.maker('canvas');
var gewgaw = new SemicircleJam();
var can = canvas({ width: 800, height: 800 });
config.container.appendChild(can);
var controlPanel = div(
div(
DAM.makeDownloadImageButton({
canvas: can,
basename: "semicircle-jam"
})
),
div(
DAM.makeCheckbox(
{
onchange: function(b) { gewgaw.setExclusiveSlots(b); },
checkboxAttrs: { "checked": true }
},
"exclusive slots"
),
),
div(
DAM.makeCheckbox(
{
onchange: function(b) { gewgaw.setCloseLoopAtEnd(b); },
checkboxAttrs: { "checked": true }
},
"close loop at end"
),
),
div(
button("Restart", {
onclick: function() {
gewgaw.reset();
}
}),
button("Carry on", {
onclick: function() {
gewgaw.go();
}
}),
button("Close loop", {
onclick: function() {
gewgaw.closeLoop();
}
})
)
);
config.container.appendChild(controlPanel);
gewgaw.init({
'canvas': can
});
}