Skip to main content
davidc88034496
Known Participant
November 29, 2022
Question

how to check if a node is a graphicNode

  • November 29, 2022
  • 1 reply
  • 341 views

Hi sorry for my noob question, i need to check if a node is a shape aka graphicNode.. graphic node such as rectangle, ellipse, polygon etc. 

 

I can program it this way..
if (node instanceof Ellipse && node instanceof rectangle && .. )
but wondering if theres something like if (node.isGraphicNode()) or if (node.constructor.superclass) etc.

 

any help would be great. thank you

    This topic has been closed for replies.

    1 reply

    Chris W. Griffith
    Community Expert
    Community Expert
    November 29, 2022

    I assume this is related to plugin development? 

    davidc88034496
    Known Participant
    November 29, 2022

    Yes for plugin development.. perhaps i am in the wrong thread?
    If not,
    I found that i could find the answer to my question using this:

    Object.getPrototypeOf(Object.getPrototypeOf(node)).constructor.name

    but did want to know if perhaps there was a better way