Skip to content

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

@junfang219

Description

@junfang219

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions