jspsych-tangram 0.0.5 → 0.0.7

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.
@@ -8,26 +8,27 @@ var uuid = require('uuid');
8
8
  const CONFIG = {
9
9
  color: {
10
10
  bands: {
11
- silhouette: { fillEven: "#eef2ff", fillOdd: "#f6f7fb", stroke: "#c7d2fe" },
12
- workspace: { fillEven: "#f3f4f6", fillOdd: "#f9fafb", stroke: "#e5e7eb" }
11
+ silhouette: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" },
12
+ workspace: { fillEven: "#fff2ccff", fillOdd: "#fff2ccff", stroke: "#b1b1b1" }
13
13
  },
14
- completion: { fill: "#dcfce7", stroke: "#86efac" },
15
- silhouetteMask: "#94a3b8",
14
+ completion: { fill: "#ccfff2", stroke: "#13da57" },
15
+ silhouetteMask: "#374151",
16
16
  anchors: { invalid: "#7dd3fc", valid: "#475569" },
17
- piece: { draggingFill: "#1d4ed8", validFill: "#60a5fa", invalidFill: "#ef4444", invalidStroke: "#dc2626", selectedStroke: "#111827", allGreenStroke: "#86efac", borderStroke: "#374151" },
17
+ piece: { draggingFill: "#8e7cc3ff", validFill: "#8e7cc3ff", invalidFill: "#ef4444", invalidStroke: "#dc2626", selectedStroke: "#674ea7", allGreenStroke: "#86efac", borderStroke: "#674ea7" },
18
18
  ui: { light: "#60a5fa", dark: "#1d4ed8" },
19
- blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#eef2ff", labelFill: "#374151" }
19
+ blueprint: { fill: "#374151", selectedStroke: "#111827", badgeFill: "#000000", labelFill: "#ffffff" }
20
20
  },
21
21
  opacity: {
22
- blueprint: 0.95,
23
- silhouetteMask: 0.45,
24
- anchors: { valid: 0.8, invalid: 0.5 },
25
- piece: { invalid: 0.35, dragging: 0.6, locked: 0.7, normal: 0.95 }
22
+ blueprint: 0.4,
23
+ silhouetteMask: 0.25,
24
+ //anchors: { valid: 0.80, invalid: 0.50 },
25
+ anchors: { invalid: 0, valid: 0 },
26
+ piece: { invalid: 0.35, dragging: 0.75, locked: 1, normal: 1 }
26
27
  },
27
28
  size: {
28
- stroke: { bandPx: 1, pieceSelectedPx: 1.5, allGreenStrokePx: 6, pieceBorderPx: 1 },
29
+ stroke: { bandPx: 5, pieceSelectedPx: 3, allGreenStrokePx: 10, pieceBorderPx: 2 },
29
30
  anchorRadiusPx: { valid: 1, invalid: 1 },
30
- badgeFontPx: 12,
31
+ badgeFontPx: 16,
31
32
  centerBadge: { fractionOfOuterR: 0.15, minPx: 20, marginPx: 4 }
32
33
  },
33
34
  layout: {
@@ -3549,6 +3550,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
3549
3550
  "medtriangle",
3550
3551
  "largetriangle"
3551
3552
  ]);
3553
+ const PRIMITIVE_BLUEPRINTS_ORDERED = [...PRIMITIVE_BLUEPRINTS].sort((a, b) => params.primitiveOrder.indexOf(a.kind) - params.primitiveOrder.indexOf(b.kind));
3552
3554
  const sectors = params.tangrams.map((tangramSpec, index) => {
3553
3555
  const filteredTans = tangramSpec.solutionTans.filter((tan) => {
3554
3556
  const tanName = tan.name ?? tan.kind;
@@ -3575,7 +3577,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
3575
3577
  const firstMacro = params.quickstash_macros[0];
3576
3578
  if (firstMacro && "parts" in firstMacro && firstMacro.parts && firstMacro.parts[0] && "anchorOffset" in firstMacro.parts[0]) {
3577
3579
  const primsByKind = /* @__PURE__ */ new Map();
3578
- PRIMITIVE_BLUEPRINTS.forEach((p) => primsByKind.set(p.kind, p));
3580
+ PRIMITIVE_BLUEPRINTS_ORDERED.forEach((p) => primsByKind.set(p.kind, p));
3579
3581
  quickstash = params.quickstash_macros.map(
3580
3582
  (anchorComposite) => convertAnchorCompositeToPixels(anchorComposite, primsByKind, CONFIG.layout.grid.stepPx)
3581
3583
  // Use current CONFIG grid step
@@ -3587,7 +3589,7 @@ function startConstructionTrial(display_element, params, _jsPsych) {
3587
3589
  const gameBoardProps = {
3588
3590
  sectors,
3589
3591
  quickstash,
3590
- primitives: PRIMITIVE_BLUEPRINTS,
3592
+ primitives: PRIMITIVE_BLUEPRINTS_ORDERED,
3591
3593
  layout: params.layout,
3592
3594
  target: params.target,
3593
3595
  input: params.input,
@@ -3618,6 +3620,12 @@ const info = {
3618
3620
  default: [],
3619
3621
  description: "Array of MacroSpec objects created in prep trial"
3620
3622
  },
3623
+ /** Array of primitive names in the order they should be displayed */
3624
+ primitive_order: {
3625
+ type: jspsych.ParameterType.OBJECT,
3626
+ default: ["square", "smalltriangle", "parallelogram", "medtriangle", "largetriangle"],
3627
+ description: "Array of primitive names in the order they should be displayed"
3628
+ },
3621
3629
  /** Whether to place pieces in workspace or directly on silhouette */
3622
3630
  target: {
3623
3631
  type: jspsych.ParameterType.SELECT,
@@ -3719,6 +3727,7 @@ class TangramConstructPlugin {
3719
3727
  const params = {
3720
3728
  tangrams: trial.tangrams,
3721
3729
  quickstash_macros: trial.quickstash_macros,
3730
+ primitiveOrder: trial.primitive_order,
3722
3731
  target: trial.target,
3723
3732
  input: trial.input,
3724
3733
  layout: trial.layout,