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
package/dist/construct/index.cjs
CHANGED
|
@@ -3549,6 +3549,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3549
3549
|
"medtriangle",
|
|
3550
3550
|
"largetriangle"
|
|
3551
3551
|
]);
|
|
3552
|
+
const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => params.primitiveOrder.indexOf(a.kind) - params.primitiveOrder.indexOf(b.kind));
|
|
3552
3553
|
const sectors = params.tangrams.map((tangramSpec, index) => {
|
|
3553
3554
|
const filteredTans = tangramSpec.solutionTans.filter((tan) => {
|
|
3554
3555
|
const tanName = tan.name ?? tan.kind;
|
|
@@ -3575,7 +3576,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3575
3576
|
const firstMacro = params.quickstash_macros[0];
|
|
3576
3577
|
if (firstMacro && "parts" in firstMacro && firstMacro.parts && firstMacro.parts[0] && "anchorOffset" in firstMacro.parts[0]) {
|
|
3577
3578
|
const primsByKind = /* @__PURE__ */ new Map();
|
|
3578
|
-
|
|
3579
|
+
PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
|
|
3579
3580
|
quickstash = params.quickstash_macros.map(
|
|
3580
3581
|
(anchorComposite) => convertAnchorCompositeToPixels(anchorComposite, primsByKind, CONFIG.layout.grid.stepPx)
|
|
3581
3582
|
// Use current CONFIG grid step
|
|
@@ -3587,7 +3588,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
|
|
|
3587
3588
|
const gameBoardProps = {
|
|
3588
3589
|
sectors,
|
|
3589
3590
|
quickstash,
|
|
3590
|
-
primitives:
|
|
3591
|
+
primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
|
|
3591
3592
|
layout: params.layout,
|
|
3592
3593
|
target: params.target,
|
|
3593
3594
|
input: params.input,
|
|
@@ -3618,6 +3619,12 @@ const info = {
|
|
|
3618
3619
|
default: [],
|
|
3619
3620
|
description: "Array of MacroSpec objects created in prep trial"
|
|
3620
3621
|
},
|
|
3622
|
+
/** Array of primitive names in the order they should be displayed */
|
|
3623
|
+
primitive_order: {
|
|
3624
|
+
type: jspsych.ParameterType.OBJECT,
|
|
3625
|
+
default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
|
|
3626
|
+
description: "Array of primitive names in the order they should be displayed"
|
|
3627
|
+
},
|
|
3621
3628
|
/** Whether to place pieces in workspace or directly on silhouette */
|
|
3622
3629
|
target: {
|
|
3623
3630
|
type: jspsych.ParameterType.SELECT,
|
|
@@ -3719,6 +3726,7 @@ class TangramConstructPlugin {
|
|
|
3719
3726
|
const params = {
|
|
3720
3727
|
tangrams: trial.tangrams,
|
|
3721
3728
|
quickstash_macros: trial.quickstash_macros,
|
|
3729
|
+
primitiveOrder: trial.primitive_order,
|
|
3722
3730
|
target: trial.target,
|
|
3723
3731
|
input: trial.input,
|
|
3724
3732
|
layout: trial.layout,
|