0

Is it possible to create a Modifier or StateModifier that effectively removes all it's children from the DOM or make them into display: none;/ pointer-events:none?

I've tried with a Modifier and do setOpacity(0); but I want to prevent all the surfaces below from receiving click events too.

Thanks!

Alex
  • 1,689
  • 18
  • 27

1 Answers1

3

It is currently not possible to propagate CSS properties from modifiers down to Surfaces.

These are your options:

  • Use opacity 0 and translate with Z-index to far far behind, or translate far off screen.

  • Use a ContainerSurface - this deepens the DOM, but you can manipulate a containing DIV with display: none.

  • Check out the Fader modifier. Is has a cull option. When true, it removes node from rendering tree.

  • Show/hide the node - but this can be a performance penalty. See discussion here or grab the show modifier here.

See also this Stack Overflow question about removing rendernodes.

Community
  • 1
  • 1
markmarijnissen
  • 5,569
  • 2
  • 28
  • 34