jspsych-tangram 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/construct/index.browser.js +15 -16
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +13 -13
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +15 -16
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.js +15 -16
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +17 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -16
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +12 -11
- package/dist/prep/index.browser.js.map +1 -1
- package/dist/prep/index.browser.min.js +1 -1
- package/dist/prep/index.browser.min.js.map +1 -1
- package/dist/prep/index.cjs +12 -11
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.js +12 -11
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/domain/primitives.ts +9 -10
- package/src/core/domain/types.ts +4 -3
- package/src/core/io/InteractionTracker.ts +1 -1
- package/src/core/io/quickstash.ts +3 -29
- package/src/core/types/plugin-interfaces.ts +1 -1
- package/src/plugins/tangram-construct/ConstructionApp.tsx +6 -7
- package/src/plugins/tangram-prep/PrepApp.tsx +1 -0
- package/tangram-construct.min.js +13 -13
- package/tangram-prep.min.js +1 -1
- package/src/core/io/stims.ts +0 -107
package/dist/construct/index.js
CHANGED
|
@@ -2926,8 +2926,7 @@ class InteractionTracker {
|
|
|
2926
2926
|
}
|
|
2927
2927
|
const sectorTangramMap = this.controller.state.cfg.sectors.map((s) => ({
|
|
2928
2928
|
sectorId: s.id,
|
|
2929
|
-
tangramId: s.
|
|
2930
|
-
// In our system, sector ID == tangram ID
|
|
2929
|
+
tangramId: s.tangramId
|
|
2931
2930
|
}));
|
|
2932
2931
|
const blueprintOrder = {
|
|
2933
2932
|
primitives: this.controller.state.primitives.map((bp) => bp.id),
|
|
@@ -3432,10 +3431,10 @@ function constructFromSpec(sideLens, angles, firstEdgeUnits) {
|
|
|
3432
3431
|
return pts;
|
|
3433
3432
|
}
|
|
3434
3433
|
const FIRST_EDGES_UNITS = {
|
|
3435
|
-
"
|
|
3434
|
+
"smalltriangle": [P(0, 0), P(0.5, 0.5)],
|
|
3436
3435
|
"parallelogram": [P(0, 0), P(0.5, 0)],
|
|
3437
|
-
"
|
|
3438
|
-
"
|
|
3436
|
+
"largetriangle": [P(0, 0), P(0.5, -0.5)],
|
|
3437
|
+
"medtriangle": [P(0, 0), P(0.5, 0)],
|
|
3439
3438
|
"square": [P(0, 0), P(0.5, 0)]
|
|
3440
3439
|
};
|
|
3441
3440
|
const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
@@ -3448,8 +3447,8 @@ const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
|
3448
3447
|
color: "#f43f5e"
|
|
3449
3448
|
},
|
|
3450
3449
|
{
|
|
3451
|
-
id: "prim:
|
|
3452
|
-
kind: "
|
|
3450
|
+
id: "prim:smalltriangle",
|
|
3451
|
+
kind: "smalltriangle",
|
|
3453
3452
|
sideLens: [HALFDIAGONAL, HALFDIAGONAL, HALFUNIT, HALFUNIT, HALFUNIT, HALFUNIT],
|
|
3454
3453
|
angles: [180, 45, 180, 90, 180, 45],
|
|
3455
3454
|
color: "#f59e0b"
|
|
@@ -3462,15 +3461,15 @@ const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
|
3462
3461
|
color: "#10b981"
|
|
3463
3462
|
},
|
|
3464
3463
|
{
|
|
3465
|
-
id: "prim:
|
|
3466
|
-
kind: "
|
|
3464
|
+
id: "prim:medtriangle",
|
|
3465
|
+
kind: "medtriangle",
|
|
3467
3466
|
sideLens: [HALFUNIT, HALFUNIT, HALFUNIT, HALFUNIT, HALFDIAGONAL, HALFDIAGONAL, HALFDIAGONAL, HALFDIAGONAL],
|
|
3468
3467
|
angles: [180, 180, 180, 45, 180, 90, 180, 45],
|
|
3469
3468
|
color: "#3b82f6"
|
|
3470
3469
|
},
|
|
3471
3470
|
{
|
|
3472
|
-
id: "prim:
|
|
3473
|
-
kind: "
|
|
3471
|
+
id: "prim:largetriangle",
|
|
3472
|
+
kind: "largetriangle",
|
|
3474
3473
|
sideLens: [
|
|
3475
3474
|
HALFDIAGONAL,
|
|
3476
3475
|
HALFDIAGONAL,
|
|
@@ -3542,12 +3541,11 @@ function convertAnchorCompositeToPixels(anchorComposite, primsByKind, gridStepPx
|
|
|
3542
3541
|
function startConstructionTrial(display_element, params, _jsPsych) {
|
|
3543
3542
|
const CANON = /* @__PURE__ */ new Set([
|
|
3544
3543
|
"square",
|
|
3545
|
-
"
|
|
3544
|
+
"smalltriangle",
|
|
3546
3545
|
"parallelogram",
|
|
3547
|
-
"
|
|
3548
|
-
"
|
|
3546
|
+
"medtriangle",
|
|
3547
|
+
"largetriangle"
|
|
3549
3548
|
]);
|
|
3550
|
-
const SECTOR_IDS = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"];
|
|
3551
3549
|
console.log("[ConstructionApp] Starting tangram conversion...");
|
|
3552
3550
|
console.log("[ConstructionApp] Received tangrams:", params.tangrams);
|
|
3553
3551
|
console.log("[ConstructionApp] Number of tangrams:", params.tangrams.length);
|
|
@@ -3572,11 +3570,12 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3572
3570
|
console.log(`[ConstructionApp] First vertex: [${tan.vertices[0]?.[0]}, ${tan.vertices[0]?.[1]}] -> {x: ${polygon[0]?.x}, y: ${polygon[0]?.y}}`);
|
|
3573
3571
|
return polygon;
|
|
3574
3572
|
});
|
|
3575
|
-
const sectorId =
|
|
3573
|
+
const sectorId = `sector${index}`;
|
|
3576
3574
|
console.log(`[ConstructionApp] Assigned sector ID: ${sectorId}`);
|
|
3577
3575
|
console.log(`[ConstructionApp] Final mask has ${mask.length} polygons`);
|
|
3578
3576
|
const sector = {
|
|
3579
3577
|
id: sectorId,
|
|
3578
|
+
tangramId: tangramSpec.tangramID,
|
|
3580
3579
|
silhouette: {
|
|
3581
3580
|
id: sectorId,
|
|
3582
3581
|
mask
|