psychojs icon indicating copy to clipboard operation
psychojs copied to clipboard

[Bug]:Textbox2 unexpectedly reset its text in the center in PsychJS (fine in PsychoPy)

Open junfang219 opened this issue 1 year ago • 0 comments

PsychoPy Version

2023.2.3

What OS are your PsychoPy running on?

macOS Silicon

Bug Description

The textbox border and text changed the color when I have the below code in EACH FRAME, but the text itself was replaced to the center, which is unexpected.

if (textbox.contains(mouse)) { textbox.color = "red"; textbox.borderColor = "red"; } else { textbox.color = "black"; textbox.borderColor = "black"; }

The detailed description is posted in the forum, please see https://discourse.psychopy.org/t/textbox2-unexpectedly-reset-its-text-in-the-center-in-psychjs-fine-in-psychopy/37700/1

Expected Behaviour

The text won't change its position when textbox.color and textbox.borderColor gets assigned a new color.

Steps to Reproduce

  1. creat a textbox with text in it and set it to a new position (e.g., not (0,0)).
  2. in each frame, let the textbox watch for mouse hover. The textbox.color = red when the mouse is over it
  3. the text color changed but the text in the box will be replaced to the center. ...

Additional context

No response

junfang219 avatar Nov 27 '23 18:11 junfang219