From c7799f15ae455d36670f2684b92ba173dc3138c3 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Fri, 8 Apr 2022 13:14:51 -0400 Subject: [PATCH] make card image optional --- docs/plugins/virtual-chinrest.md | 2 +- examples/jspsych-virtual-chinrest.html | 3 ++- packages/plugin-virtual-chinrest/src/index.ts | 9 ++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/plugins/virtual-chinrest.md b/docs/plugins/virtual-chinrest.md index fe5c0e1d..1ac64de9 100644 --- a/docs/plugins/virtual-chinrest.md +++ b/docs/plugins/virtual-chinrest.md @@ -21,7 +21,7 @@ Parameters can be left unspecified if the default value is acceptable. | pixels_per_unit | numeric | 100 | After the scaling factor is applied, this many pixels will equal one unit of measurement, where the units are indicated by `resize_units`. This is only used when resizing is done after the trial ends (i.e. the `resize_units` parameter is not "none"). | | adjustment_prompt | HTML string | "Click and drag the lower right corner of the image until it is the same size as a credit card held up to the screen. You can use any card that is the same size as a credit card, like a membership card or driver's license. If you do not have access to a real card you can use a ruler to measure the image width to 3.37 inches or 85.6 mm." | This string can contain HTML markup. Any content here will be displayed **below the card stimulus** during the resizing phase. | | adjustment_button_prompt | HTML string | "Click here when the image is the correct size" | Content of the button displayed below the card stimulus during the resizing phase. | -| item_path | string | "img/card.png" | Path of the item to be presented in the card stimulus during the resizing phase. _The default image is available in `/examples/img/card.png`_ | +| item_path | string | null | Path of the item to be presented in the card stimulus during the resizing phase. If `null` then no image is shown, and a solid color background is used instead. _An example image is available in `/examples/img/card.png`_ | | item_height_mm | numeric | 53.98 | The known height of the physical item (e.g. credit card) to be measured, in mm. | | item_width_mm | numeric | 85.6 | The known width of the physical item (e.g. credit card) to be measured, in mm. | | item_init_size | numeric | 250 | The initial size of the card stimulus, in pixels, along its largest dimension. | diff --git a/examples/jspsych-virtual-chinrest.html b/examples/jspsych-virtual-chinrest.html index a801b2a5..73185dbf 100644 --- a/examples/jspsych-virtual-chinrest.html +++ b/examples/jspsych-virtual-chinrest.html @@ -25,7 +25,8 @@ type: jsPsychVirtualChinrest, blindspot_reps: 2, resize_units: "cm", - pixels_per_unit: 50 + pixels_per_unit: 50, + item_path: 'img/card.png', }; // one blindspot estimate diff --git a/packages/plugin-virtual-chinrest/src/index.ts b/packages/plugin-virtual-chinrest/src/index.ts index 619ab3fb..c29cfe05 100644 --- a/packages/plugin-virtual-chinrest/src/index.ts +++ b/packages/plugin-virtual-chinrest/src/index.ts @@ -42,8 +42,7 @@ const info = { item_path: { type: ParameterType.IMAGE, pretty_name: "Item path", - default: "img/card.png", - // TO DO: I think the background image should be optional, in which case we don't want to try to auto-preload this parameter? + default: null, preload: false, }, /** The height of the item to be measured, in mm. */ @@ -191,7 +190,11 @@ class VirtualChinrestPlugin implements JsPsychPlugin { /** create content for first screen, resizing card */ let pagesize_content = `
-
+