jspsych-tangram 0.0.5 → 0.0.6

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.
@@ -20258,6 +20258,7 @@ var TangramConstructPlugin = (function (jspsych) {
20258
20258
  "medtriangle",
20259
20259
  "largetriangle"
20260
20260
  ]);
20261
+ const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => params.primitiveOrder.indexOf(a.kind) - params.primitiveOrder.indexOf(b.kind));
20261
20262
  const sectors = params.tangrams.map((tangramSpec, index) => {
20262
20263
  const filteredTans = tangramSpec.solutionTans.filter((tan) => {
20263
20264
  const tanName = tan.name ?? tan.kind;
@@ -20284,7 +20285,7 @@ var TangramConstructPlugin = (function (jspsych) {
20284
20285
  const firstMacro = params.quickstash_macros[0];
20285
20286
  if (firstMacro && "parts" in firstMacro && firstMacro.parts && firstMacro.parts[0] && "anchorOffset" in firstMacro.parts[0]) {
20286
20287
  const primsByKind = /* @__PURE__ */ new Map();
20287
- PRIMITIVE_BLUEPRINTS.forEach((p) => primsByKind.set(p.kind, p));
20288
+ PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
20288
20289
  quickstash = params.quickstash_macros.map(
20289
20290
  (anchorComposite) => convertAnchorCompositeToPixels(anchorComposite, primsByKind, CONFIG.layout.grid.stepPx)
20290
20291
  // Use current CONFIG grid step
@@ -20296,7 +20297,7 @@ var TangramConstructPlugin = (function (jspsych) {
20296
20297
  const gameBoardProps = {
20297
20298
  sectors,
20298
20299
  quickstash,
20299
- primitives: PRIMITIVE_BLUEPRINTS,
20300
+ primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
20300
20301
  layout: params.layout,
20301
20302
  target: params.target,
20302
20303
  input: params.input,
@@ -20327,6 +20328,12 @@ var TangramConstructPlugin = (function (jspsych) {
20327
20328
  default: [],
20328
20329
  description: "Array of MacroSpec objects created in prep trial"
20329
20330
  },
20331
+ /** Array of primitive names in the order they should be displayed */
20332
+ primitive_order: {
20333
+ type: jspsych.ParameterType.OBJECT,
20334
+ default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
20335
+ description: "Array of primitive names in the order they should be displayed"
20336
+ },
20330
20337
  /** Whether to place pieces in workspace or directly on silhouette */
20331
20338
  target: {
20332
20339
  type: jspsych.ParameterType.SELECT,
@@ -20428,6 +20435,7 @@ var TangramConstructPlugin = (function (jspsych) {
20428
20435
  const params = {
20429
20436
  tangrams: trial.tangrams,
20430
20437
  quickstash_macros: trial.quickstash_macros,
20438
+ primitiveOrder: trial.primitive_order,
20431
20439
  target: trial.target,
20432
20440
  input: trial.input,
20433
20441
  layout: trial.layout,