Verbeter anatomie en plaatsing van avataraccessoires (v0.4.46-beta) #1

Open
bes-r wants to merge 192 commits from bes-r/avatar-realism into main AGit
7 changed files with 23 additions and 11 deletions
Showing only changes of commit 04e9bf3847 - Show all commits

View file

@ -1 +1 @@
0.3.09-beta
0.3.10-beta

View file

@ -33,11 +33,11 @@ const REGISTRY = [
{ id:"ball", cat:"taal", icon:"🎈", w:620, h:560, minW:480, minH:440, mount:mountBall },
{ id:"anchor", cat:"taal", icon:"⚓", w:680, h:500, minW:440, minH:340, mount:mountAnchor },
{ id:"sentence", cat:"taal", icon:"🧩", w:620, h:520, minW:400, minH:360, mount:mountSentence },
{ id:"madd", cat:"rekenen", icon:"", w:460, h:620, minW:380, minH:520, mount:(r,s)=>mountMath(r,s,"add") },
{ id:"msub", cat:"rekenen", icon:"", w:460, h:620, minW:380, minH:520, mount:(r,s)=>mountMath(r,s,"sub") },
{ id:"mmul", cat:"rekenen", icon:"✖️", w:460, h:620, minW:380, minH:520, mount:(r,s)=>mountMath(r,s,"mul") },
{ id:"mdiv", cat:"rekenen", icon:"➗", w:460, h:620, minW:380, minH:520, mount:(r,s)=>mountMath(r,s,"div") },
{ id:"mpct", cat:"rekenen", icon:"💯", w:480, h:620, minW:400, minH:520, mount:(r,s)=>mountMath(r,s,"pct") },
{ id:"madd", cat:"rekenen", icon:"", w:460, h:620, minW:380, minH:520, mount:(r,s,o)=>mountMath(r,s,"add",o) },
{ id:"msub", cat:"rekenen", icon:"", w:460, h:620, minW:380, minH:520, mount:(r,s,o)=>mountMath(r,s,"sub",o) },
{ id:"mmul", cat:"rekenen", icon:"✖️", w:460, h:620, minW:380, minH:520, mount:(r,s,o)=>mountMath(r,s,"mul",o) },
{ id:"mdiv", cat:"rekenen", icon:"➗", w:460, h:620, minW:380, minH:520, mount:(r,s,o)=>mountMath(r,s,"div",o) },
{ id:"mpct", cat:"rekenen", icon:"💯", w:480, h:620, minW:400, minH:520, mount:(r,s,o)=>mountMath(r,s,"pct",o) },
{ id:"numberline", cat:"rekenen", icon:"↔️", w:660, h:430, minW:420, minH:320, mount:mountNumberline },
{ id:"fractions", cat:"rekenen", icon:"🍫", w:600, h:480, minW:380, minH:320, mount:mountFractions },
{ id:"clock", cat:"rekenen", icon:"🕙", w:500, h:500, minW:340, minH:340, mount:mountClock },

View file

@ -2,7 +2,7 @@
"use strict";
/* version shown until /api/version resolves (or if the fetch fails, e.g. offline).
Kept in sync by hand with the VERSION file at the repo root on every release. */
const VERSION = "0.3.09-beta";
const VERSION = "0.3.10-beta";
(function(){
const tag = document.getElementById("verTag");
tag.textContent = "v"+VERSION;

View file

@ -25,7 +25,7 @@ function renderPupilWidgets(widgets){
pupilView.appendChild(hint);
return;
}
usable.forEach(({ w, def })=>{
usable.forEach(({ w, def }, idx)=>{
const card = document.createElement("div");
card.className = "widget pupil-card";
card.style.width = def.w + "px";
@ -34,7 +34,13 @@ function renderPupilWidgets(widgets){
body.className = "widget-body";
card.appendChild(body);
pupilView.appendChild(card);
def.mount(body, w.state || null, { readonly:true });
/* geen stabiel widget-instantie-id in het bord (alleen het widget-type in
w.id) - positie in de lijst is de fijnste identiteit die beschikbaar is,
stabiel zolang de leerkracht de widgets op het bord niet herschikt */
const widgetId = def.id + ":" + idx;
def.mount(body, w.state || null, { readonly:true, onProgress: (p)=>{
api("/my/progress", { method:"POST", body: { widgetId, widgetType: def.id, ...p } }).catch(()=>{});
}});
});
}

View file

@ -2,7 +2,8 @@
/* =========================================================
Balloon word widget guess before the balloons pop
==========================================================*/
function mountBall(root, initState){
function mountBall(root, initState, opts){
const onProgress = opts && opts.onProgress;
const S = { card:0, snd:true, lives:6, guessed:new Set(), over:false, order:[], idx:0, stars:0 };
if(initState){ S.card = initState.card ?? 0; S.snd = initState.snd !== false; }
const play = f=>{ if(S.snd) f(); };
@ -70,6 +71,7 @@ function mountBall(root, initState){
play(sndWin); confetti(el(".mt-card"));
nextBtn.classList.add("show");
scoreEl.textContent = S.stars+" ★";
if(onProgress) onProgress({ attempts: 1, correct: 1, stars: 1 });
}
}else{
S.lives--;

View file

@ -1,6 +1,7 @@
/* widget: Letterblokken (Ik leer lezen) */
function mountLetterGame(root, initState, opts){
const readonly = !!(opts && opts.readonly);
const onProgress = opts && opts.onProgress;
const S = { level:1, card:0, wordIdx:0, stars:0, lang:LANG, count:6, order:[], snd:true, amode:"blocks" };
if(initState){
S.level = initState.level||1;
@ -282,6 +283,7 @@ function mountLetterGame(root, initState, opts){
doneEl.querySelector(".dp").textContent = currentWord()[0];
doneEl.classList.add("show");
nextBtn.classList.add("show");
if(onProgress) onProgress({ attempts: 1, correct: 1, stars: 1 });
}
}
function showCardDone(){

View file

@ -2,8 +2,9 @@
/* =========================================================
Math practice engine add / sub / mul / div / percentages
==========================================================*/
function mountMath(root, initState, mode){
function mountMath(root, initState, mode, opts){
const ROUND = 10;
const onProgress = opts && opts.onProgress;
const S = { level:1, snd:true, amode:"blocks", q:null, tries:0, done:0, good:0, input:"", busy:false };
if(initState){
S.level = initState.level||1;
@ -199,6 +200,7 @@ function mountMath(root, initState, mode){
doneEl.querySelector(".dg").textContent = S.good>=8 ? "🌟" : S.good>=5 ? "👍" : "💪";
doneEl.classList.add("show");
if(S.good>=8) play(sndWin);
if(onProgress) onProgress({ attempts: ROUND, correct: S.good, stars: 0 });
}
function next(){
S.done++;