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.cjs
CHANGED
|
@@ -2928,8 +2928,7 @@ class InteractionTracker {
|
|
|
2928
2928
|
}
|
|
2929
2929
|
const sectorTangramMap = this.controller.state.cfg.sectors.map((s) => ({
|
|
2930
2930
|
sectorId: s.id,
|
|
2931
|
-
tangramId: s.
|
|
2932
|
-
// In our system, sector ID == tangram ID
|
|
2931
|
+
tangramId: s.tangramId
|
|
2933
2932
|
}));
|
|
2934
2933
|
const blueprintOrder = {
|
|
2935
2934
|
primitives: this.controller.state.primitives.map((bp) => bp.id),
|
|
@@ -3434,10 +3433,10 @@ function constructFromSpec(sideLens, angles, firstEdgeUnits) {
|
|
|
3434
3433
|
return pts;
|
|
3435
3434
|
}
|
|
3436
3435
|
const FIRST_EDGES_UNITS = {
|
|
3437
|
-
"
|
|
3436
|
+
"smalltriangle": [P(0, 0), P(0.5, 0.5)],
|
|
3438
3437
|
"parallelogram": [P(0, 0), P(0.5, 0)],
|
|
3439
|
-
"
|
|
3440
|
-
"
|
|
3438
|
+
"largetriangle": [P(0, 0), P(0.5, -0.5)],
|
|
3439
|
+
"medtriangle": [P(0, 0), P(0.5, 0)],
|
|
3441
3440
|
"square": [P(0, 0), P(0.5, 0)]
|
|
3442
3441
|
};
|
|
3443
3442
|
const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
@@ -3450,8 +3449,8 @@ const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
|
3450
3449
|
color: "#f43f5e"
|
|
3451
3450
|
},
|
|
3452
3451
|
{
|
|
3453
|
-
id: "prim:
|
|
3454
|
-
kind: "
|
|
3452
|
+
id: "prim:smalltriangle",
|
|
3453
|
+
kind: "smalltriangle",
|
|
3455
3454
|
sideLens: [HALFDIAGONAL, HALFDIAGONAL, HALFUNIT, HALFUNIT, HALFUNIT, HALFUNIT],
|
|
3456
3455
|
angles: [180, 45, 180, 90, 180, 45],
|
|
3457
3456
|
color: "#f59e0b"
|
|
@@ -3464,15 +3463,15 @@ const PRIMITIVE_BLUEPRINTS_CACHE = (() => {
|
|
|
3464
3463
|
color: "#10b981"
|
|
3465
3464
|
},
|
|
3466
3465
|
{
|
|
3467
|
-
id: "prim:
|
|
3468
|
-
kind: "
|
|
3466
|
+
id: "prim:medtriangle",
|
|
3467
|
+
kind: "medtriangle",
|
|
3469
3468
|
sideLens: [HALFUNIT, HALFUNIT, HALFUNIT, HALFUNIT, HALFDIAGONAL, HALFDIAGONAL, HALFDIAGONAL, HALFDIAGONAL],
|
|
3470
3469
|
angles: [180, 180, 180, 45, 180, 90, 180, 45],
|
|
3471
3470
|
color: "#3b82f6"
|
|
3472
3471
|
},
|
|
3473
3472
|
{
|
|
3474
|
-
id: "prim:
|
|
3475
|
-
kind: "
|
|
3473
|
+
id: "prim:largetriangle",
|
|
3474
|
+
kind: "largetriangle",
|
|
3476
3475
|
sideLens: [
|
|
3477
3476
|
HALFDIAGONAL,
|
|
3478
3477
|
HALFDIAGONAL,
|
|
@@ -3544,12 +3543,11 @@ function convertAnchorCompositeToPixels(anchorComposite, primsByKind, gridStepPx
|
|
|
3544
3543
|
function startConstructionTrial(display_element, params, _jsPsych) {
|
|
3545
3544
|
const CANON = /* @__PURE__ */ new Set([
|
|
3546
3545
|
"square",
|
|
3547
|
-
"
|
|
3546
|
+
"smalltriangle",
|
|
3548
3547
|
"parallelogram",
|
|
3549
|
-
"
|
|
3550
|
-
"
|
|
3548
|
+
"medtriangle",
|
|
3549
|
+
"largetriangle"
|
|
3551
3550
|
]);
|
|
3552
|
-
const SECTOR_IDS = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"];
|
|
3553
3551
|
console.log("[ConstructionApp] Starting tangram conversion...");
|
|
3554
3552
|
console.log("[ConstructionApp] Received tangrams:", params.tangrams);
|
|
3555
3553
|
console.log("[ConstructionApp] Number of tangrams:", params.tangrams.length);
|
|
@@ -3574,11 +3572,12 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3574
3572
|
console.log(`[ConstructionApp] First vertex: [${tan.vertices[0]?.[0]}, ${tan.vertices[0]?.[1]}] -> {x: ${polygon[0]?.x}, y: ${polygon[0]?.y}}`);
|
|
3575
3573
|
return polygon;
|
|
3576
3574
|
});
|
|
3577
|
-
const sectorId =
|
|
3575
|
+
const sectorId = `sector${index}`;
|
|
3578
3576
|
console.log(`[ConstructionApp] Assigned sector ID: ${sectorId}`);
|
|
3579
3577
|
console.log(`[ConstructionApp] Final mask has ${mask.length} polygons`);
|
|
3580
3578
|
const sector = {
|
|
3581
3579
|
id: sectorId,
|
|
3580
|
+
tangramId: tangramSpec.tangramID,
|
|
3582
3581
|
silhouette: {
|
|
3583
3582
|
id: sectorId,
|
|
3584
3583
|
mask
|