"instanceof Text" always returns false [solved]


selection.items[0] instanceof Text always return false, even if a a text object is selected

Expected Behavior

it should return true if a text object is selected

Actual Behavior

returns false


(selection.items[0] + "").startsWith("Text"); will return the correct value

did you try selection.items[0].constructor.name == "Text"?

1 Like

that works too.
i was using instanceof, because the start plugin example uses instanceof Rectangle

1 Like

Can you share how you were requiring Text from the scenegraph?

oh it seems like i forgot to do that. thanks!