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.
- package/dist/construct/index.browser.js +10 -2
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +11 -11
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +10 -2
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.d.ts +12 -0
- package/dist/construct/index.js +10 -2
- package/dist/construct/index.js.map +1 -1
- package/dist/index.cjs +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +24 -0
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +11 -2
- package/dist/prep/index.browser.js.map +1 -1
- package/dist/prep/index.browser.min.js +11 -11
- package/dist/prep/index.browser.min.js.map +1 -1
- package/dist/prep/index.cjs +11 -2
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.d.ts +12 -0
- package/dist/prep/index.js +11 -2
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/tangram-construct/ConstructionApp.tsx +6 -2
- package/src/plugins/tangram-construct/index.ts +7 -0
- package/src/plugins/tangram-prep/PrepApp.tsx +8 -2
- package/src/plugins/tangram-prep/index.ts +7 -0
- package/tangram-construct.min.js +11 -11
- package/tangram-prep.min.js +11 -11
|
@@ -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
|
-
|
|
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:
|
|
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,
|