lukflug / PanelStudio

An extensible and customizable GUI API/library to create ClickGUIs, HUDEditors and TabGUIs designed for use in Minecraft utility mods.
https://lukflug.github.io/panelstudio.html
MIT License
309 stars 23 forks source link

Non-draggable? (Feature request) #31

Closed CjPhoenix closed 2 years ago

CjPhoenix commented 2 years ago

I am not aware of any way to modify the panels so that they aren't draggable... any chance you could add this functionality? If not, how would I go about doing this myself?

lukflug commented 2 years ago

There is a way to make them not Draggable. Which is through modifying the IComponentAdder instance. I assume you're using the PanelAdder, in which case you can override a method:

@Override
public <S extends IComponent,T extends IComponent> void addComponent (S title, T content, ThemeTuple theme, Point position, int width, Supplier<Animation> animation) {
    AnimatedToggleable toggle=new AnimatedToggleable(new SimpleToggleable(open),animation.get());
    RendererTuple<Void> renderer=new RendererTuple<Void>(Void.class,theme);
    IResizable size=getResizable(width);
    ClosableComponent<S,ScrollBarComponent<Supplier<Void>,T>> panel=ClosableComponent.createScrollableComponent(title,content,()->null,toggle,renderer,getScrollSize(size),false);
    container.addComponent(new FixedComponent(panel,position,width,panel.getCollapsible().getToggle(),true,configName.apply(content.getTitle()));,isVisible);
}

I hope I didn't make any typing mistake