Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

how to check if a node is a graphicNode

Explorer ,
Nov 29, 2022 Nov 29, 2022

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

325
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 29, 2022 Nov 29, 2022

I assume this is related to plugin development? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 29, 2022 Nov 29, 2022
LATEST

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines