Skip to main content
Solved

programmatic way of knowing when the shape selection has changed?


Forum|alt.badge.img+4

Hello,

Is there a programmatic way of knowing when the shape selection has changed?

I have a right context in my package and custom shapes.  My custom shapes have a  custom data property on it called q_type.  What I want to do is:

  1. Click open the right click context panel.  Keep it open.
  2. Select Shape1 which has a custom data property “q_type” value of “foo”.  Show the “foo” form in the right click panel.  
  3. User now selects Shape2 which has a custom data property “q_type” value of “bar”.  Show the “bar” form.

In my extension app, can I register a method to a on selection changed event?

Thanks, Dan

Best answer by Michael B

Take a look at https://developer.lucid.co/extension-sdk/#classes_ui_viewport-Viewport_hookselection.  I think that gives you what you need.

View original
Did this topic help you find an answer to your question?

Michael B
Forum|alt.badge.img+4
  • Lucid product team
  • July 31, 2024

Hello PromitaDan,

 

We are reviewing your question now and will be in touch with something soon.


Michael B
Forum|alt.badge.img+4
  • Lucid product team
  • August 1, 2024

Take a look at https://developer.lucid.co/extension-sdk/#classes_ui_viewport-Viewport_hookselection.  I think that gives you what you need.


Forum|alt.badge.img+4

This is exactly what I need.  I actually read the documentation for viewport and missed this method.

I added it to my extension.ts file.  do i need to unhook it and if so, what is the approach?


Michael B
Forum|alt.badge.img+4
  • Lucid product team
  • August 5, 2024

Hello again,

You do not need to unhook the selection as the extension framework handles disposing it for you.  However, if you no longer needed the functionality and wanted to remove it yourself, you could via https://developer.lucid.co/extension-sdk/#classes_ui_viewport-Viewport_unhookselection


Reply