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.
@@ -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.id
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
- "small-triangle": [P(0, 0), P(0.5, 0.5)],
3434
+ "smalltriangle": [P(0, 0), P(0.5, 0.5)],
3436
3435
  "parallelogram": [P(0, 0), P(0.5, 0)],
3437
- "large-triangle": [P(0, 0), P(0.5, -0.5)],
3438
- "med-triangle": [P(0, 0), P(0.5, 0)],
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:small",
3452
- kind: "small-triangle",
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:med",
3466
- kind: "med-triangle",
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:large",
3473
- kind: "large-triangle",
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
- "small-triangle",
3544
+ "smalltriangle",
3546
3545
  "parallelogram",
3547
- "med-triangle",
3548
- "large-triangle"
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 = SECTOR_IDS[index] ?? `S${index}`;
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