jspsych-tangram 0.0.21 → 0.0.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jspsych-tangram",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "description": "Tangram tasks for jsPsych: prep and construct.",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -261,17 +261,19 @@ function PrepWTargetsApp({ params, jsPsych }: { params: StartPrepWTargetsTrialPa
261
261
 
262
262
  sector.pieces.forEach(piece => {
263
263
  if (piece.vertices && piece.vertices.length > 0) {
264
- // Vertices are already in anchor coordinates - use directly!
265
- const poly = piece.vertices[0].map(([x, y]) => ({ x, y }));
266
- reconPolys!.push(poly);
267
-
268
264
  const color = getPieceColorFromId(
269
265
  piece.blueprintId,
270
266
  usePrimitiveColorsReconstructions || false,
271
267
  CONFIG.color.piece.validFill,
272
268
  primitiveColorIndices || [0, 1, 2, 3, 4]
273
269
  );
274
- reconColors!.push(color);
270
+
271
+ // Handle both primitive (single poly) and composite (multiple polys) pieces
272
+ piece.vertices.forEach(polyArr => {
273
+ const poly = polyArr.map(([x, y]) => ({ x, y }));
274
+ reconPolys!.push(poly);
275
+ reconColors!.push(color);
276
+ });
275
277
  }
276
278
  });
277
279