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

how to check if a node is a graphicNode

Explorer ,
Nov 29, 2022 Nov 29, 2022

Copy link to clipboard

Copied

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

Views

220

Translate

Translate

Report

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

Copy link to clipboard

Copied

I assume this is related to plugin development? 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

 

Votes

Translate

Translate

Report

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