jspsych-tangram 0.0.16 → 0.0.18
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 +23 -5
- package/dist/construct/index.browser.js.map +1 -1
- package/dist/construct/index.browser.min.js +8 -8
- package/dist/construct/index.browser.min.js.map +1 -1
- package/dist/construct/index.cjs +23 -5
- package/dist/construct/index.cjs.map +1 -1
- package/dist/construct/index.js +23 -5
- package/dist/construct/index.js.map +1 -1
- package/dist/grid/index.browser.js +17855 -0
- package/dist/grid/index.browser.js.map +1 -0
- package/dist/grid/index.browser.min.js +47 -0
- package/dist/grid/index.browser.min.js.map +1 -0
- package/dist/grid/index.cjs +547 -0
- package/dist/grid/index.cjs.map +1 -0
- package/dist/grid/index.d.ts +174 -0
- package/dist/grid/index.js +545 -0
- package/dist/grid/index.js.map +1 -0
- package/dist/index.cjs +548 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +187 -16
- package/dist/index.js +549 -15
- package/dist/index.js.map +1 -1
- package/dist/prep/index.browser.js +23 -5
- package/dist/prep/index.browser.js.map +1 -1
- package/dist/prep/index.browser.min.js +6 -6
- package/dist/prep/index.browser.min.js.map +1 -1
- package/dist/prep/index.cjs +23 -5
- package/dist/prep/index.cjs.map +1 -1
- package/dist/prep/index.js +23 -5
- package/dist/prep/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/components/board/GameBoard.tsx +12 -0
- package/src/core/io/InteractionTracker.ts +19 -7
- package/src/core/io/data-tracking.ts +5 -0
- package/src/index.ts +2 -1
- package/src/plugins/tangram-grid/GridApp.tsx +522 -0
- package/src/plugins/tangram-grid/index.ts +154 -0
- package/tangram-construct.min.js +8 -8
- package/tangram-prep.min.js +6 -6
|
@@ -20018,7 +20018,9 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20018
20018
|
|
|
20019
20019
|
class InteractionTracker {
|
|
20020
20020
|
constructor(controller, callbacks, trialParams) {
|
|
20021
|
-
this.
|
|
20021
|
+
this.completionTimes = [];
|
|
20022
|
+
// Sector centers (set by GameBoard after layout computation)
|
|
20023
|
+
this.sectorCenters = {};
|
|
20022
20024
|
// Interaction state
|
|
20023
20025
|
this.interactionIndex = 0;
|
|
20024
20026
|
this.currentPickup = null;
|
|
@@ -20028,14 +20030,13 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20028
20030
|
this.mouseTracking = [];
|
|
20029
20031
|
// Interaction history (for TrialEndData)
|
|
20030
20032
|
this.interactions = [];
|
|
20031
|
-
// Construction-specific tracking
|
|
20032
|
-
this.completionTimes = [];
|
|
20033
20033
|
// Prep-specific tracking
|
|
20034
20034
|
this.createdMacros = [];
|
|
20035
20035
|
this.controller = controller;
|
|
20036
20036
|
this.callbacks = callbacks;
|
|
20037
20037
|
this.trialParams = trialParams;
|
|
20038
20038
|
this.trialStartTime = Date.now();
|
|
20039
|
+
this.gridStep = CONFIG.layout.grid.stepPx;
|
|
20039
20040
|
this.controller.setTrackingCallbacks({
|
|
20040
20041
|
onSectorCompleted: (sectorId) => this.recordSectorCompletion(sectorId)
|
|
20041
20042
|
});
|
|
@@ -20165,7 +20166,13 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20165
20166
|
});
|
|
20166
20167
|
}
|
|
20167
20168
|
/**
|
|
20168
|
-
*
|
|
20169
|
+
* Set sector centers (for anchor alignment)
|
|
20170
|
+
*/
|
|
20171
|
+
setSectorCenters(centers) {
|
|
20172
|
+
this.sectorCenters = centers;
|
|
20173
|
+
}
|
|
20174
|
+
/**
|
|
20175
|
+
* Record a sector completion event
|
|
20169
20176
|
*/
|
|
20170
20177
|
recordSectorCompletion(sectorId) {
|
|
20171
20178
|
this.completionTimes.push({
|
|
@@ -20342,7 +20349,8 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20342
20349
|
sectorId: sector.id,
|
|
20343
20350
|
completed,
|
|
20344
20351
|
pieceCount: pieces.length,
|
|
20345
|
-
pieces
|
|
20352
|
+
pieces,
|
|
20353
|
+
center: this.sectorCenters[sector.id] ? this.toAnchorPoint(this.sectorCenters[sector.id]) : void 0
|
|
20346
20354
|
};
|
|
20347
20355
|
if (sectorState?.completedAt !== void 0) {
|
|
20348
20356
|
snapshot.completedAt = sectorState.completedAt;
|
|
@@ -20570,6 +20578,16 @@ var TangramConstructPlugin = (function (jspsych) {
|
|
|
20570
20578
|
viewBox: { w: logicalBox.LOGICAL_W, h: logicalBox.LOGICAL_H }
|
|
20571
20579
|
};
|
|
20572
20580
|
}, [sectors, layoutMode, target, maxQuickstashSlots, primitives.length]);
|
|
20581
|
+
React.useEffect(() => {
|
|
20582
|
+
if (tracker && layout) {
|
|
20583
|
+
const centers = {};
|
|
20584
|
+
layout.sectors.forEach((s) => {
|
|
20585
|
+
const rect = rectForBand(layout, s, "silhouette", 1);
|
|
20586
|
+
centers[s.id] = { x: rect.cx, y: rect.cy };
|
|
20587
|
+
});
|
|
20588
|
+
tracker.setSectorCenters(centers);
|
|
20589
|
+
}
|
|
20590
|
+
}, [tracker, layout]);
|
|
20573
20591
|
const [, force] = React.useReducer((x) => x + 1, 0);
|
|
20574
20592
|
React.useEffect(() => {
|
|
20575
20593
|
if (onControllerReady) {
|