phetsims / scenery-phet

Reusable components based on Scenery that are specific to PhET simulations.
MIT License
8 stars 6 forks source link

Drawer should be resizable #779

Open jonathanolson opened 1 year ago

jonathanolson commented 1 year ago

It looks like it's based on static content size. Should be similar to how Panel/ButtonNode was made sizable based on its content.

jonathanolson commented 2 months ago

@pixelzoom, I'm curious about the purpose and status of Drawer, and whether this is suitable.

It looks like Drawer duplicates a lot of what Panel does (it provides a background/foreground split with a stroke in front), but I'm curious if that is necessary (I see cases where e.g. an EquationDrawer is passed an EquationPanel, where it seems like the Panel-like qualities of Drawer are redundant). Drawer also doesn't support changing the background color.

Thoughts on if Drawer was changed so that it only placed content and handled the translation/clipping? (a bit out of scope for this issue).

It also supports a size option where the content is "sized to fit in container", which seems like it would turn more into an AlignBox (but I don't see preferred sizes set, or options for alignment). If we just take arbitrary content (without styling this), presumably this wouldn't be needed?

I think I might remove this from the dynamic layout board, as my preferred way to add dynamic layout to Drawer would be to remove a lot of functionality, and have it be a very lightweight container with a DrawerHandle type that implements the handle. Let me know your thoughts?

pixelzoom commented 2 months ago

@jonathanolson and I talked about Drawer. Since it's only used by function-builder, I think it would be low risk to change the implementation proactively, and low cost to test. But if it were me, I would defer this issue, and address it if needed when function-builder is someday republished with dynamic layout.