Be able to show/hide shapes

  • 7 January 2024
  • 3 replies
  • 48 views

Badge +1

Hello,

I would like to have a way to hide and show shapes. This will allow to write an app for something like layering.

 

I tried moving a shape into x=Number.maxNumber, which was good, as it was off the visible board, but then I get an error when I try to set it X value back to its original value. Something like it has no parent.

Any other ideas on how to do this? 

 

Thanks.


3 replies

Userlevel 3
Badge +1

Hey @noam.arbel 

Maybe just using z index would be enough? Create a square that has the same color about your frame’s background, then move items around in your z-space using the `bringToFront`, `sendToFront` and `bringInFrontOf` methods that pretty much all board items have? I.e. here’s the docs for text->bringToFront() https://developers.miro.com/docs/websdk-reference-text#bringtofront

Hope this helps,

Cheers,
Mettin

Badge +1

Yup, that is what I started to do. Not ideal but will do for now.

Userlevel 3
Badge +1

Cool! If you’re building something like the photoshop layers panel you could also look into grouping things so you can .map over the items. Good luck!

https://developers.miro.com/docs/websdk-reference-group

Reply