toggle macro work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
9aa7cfe048
commit
14f4607c47
@ -11,11 +11,11 @@ import electrosphere.renderer.ui.elements.Button;
|
|||||||
import electrosphere.renderer.ui.elements.FormElement;
|
import electrosphere.renderer.ui.elements.FormElement;
|
||||||
import electrosphere.renderer.ui.elements.Label;
|
import electrosphere.renderer.ui.elements.Label;
|
||||||
import electrosphere.renderer.ui.elements.Slider;
|
import electrosphere.renderer.ui.elements.Slider;
|
||||||
import electrosphere.renderer.ui.elements.ToggleInput;
|
|
||||||
import electrosphere.renderer.ui.elements.VirtualScrollable;
|
import electrosphere.renderer.ui.elements.VirtualScrollable;
|
||||||
import electrosphere.renderer.ui.elementtypes.Element;
|
import electrosphere.renderer.ui.elementtypes.Element;
|
||||||
import electrosphere.renderer.ui.elementtypes.ValueElement;
|
import electrosphere.renderer.ui.elementtypes.ValueElement;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
|
import electrosphere.renderer.ui.macros.InputMacros;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Menu generators for creating test visualizations for ui elements
|
* Menu generators for creating test visualizations for ui elements
|
||||||
@ -36,8 +36,7 @@ public class MenuGeneratorsUITesting {
|
|||||||
rVal.addChild(backButton);
|
rVal.addChild(backButton);
|
||||||
|
|
||||||
//toggle input
|
//toggle input
|
||||||
ToggleInput toggleInput = ToggleInput.createToggleInput();
|
rVal.addChild(InputMacros.createToggle("Test Toggle", false, null));
|
||||||
rVal.addChild(toggleInput);
|
|
||||||
|
|
||||||
//actor panel
|
//actor panel
|
||||||
ActorPanel actorPanel = new ActorPanel(Globals.renderingEngine.getOpenGLState(), 500, 100, 500, 500, ActorUtils.createActorFromModelPath("Models/creatures/animals/deer1.fbx"));
|
ActorPanel actorPanel = new ActorPanel(Globals.renderingEngine.getOpenGLState(), 500, 100, 500, 500, ActorUtils.createActorFromModelPath("Models/creatures/animals/deer1.fbx"));
|
||||||
|
|||||||
@ -47,7 +47,7 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
|||||||
/**
|
/**
|
||||||
* The offset from the center of the bar to place the circle
|
* The offset from the center of the bar to place the circle
|
||||||
*/
|
*/
|
||||||
private static final float CIRCLE_OFFSET_FROM_CENTER = 0.3f;
|
private static final float CIRCLE_OFFSET_FROM_CENTER = 0.25f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the circle
|
* The color of the circle
|
||||||
@ -62,7 +62,7 @@ public class ToggleInput extends StandardDrawableElement implements ClickableEle
|
|||||||
/**
|
/**
|
||||||
* The height of the bar relative to the total drawable height
|
* The height of the bar relative to the total drawable height
|
||||||
*/
|
*/
|
||||||
private static final float BAR_HEIGHT = 0.5f;
|
private static final float BAR_HEIGHT = 0.6f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The color of the bar
|
* The color of the bar
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import electrosphere.renderer.ui.elements.Slider;
|
|||||||
import electrosphere.renderer.ui.elements.TextInput;
|
import electrosphere.renderer.ui.elements.TextInput;
|
||||||
import electrosphere.renderer.ui.elements.ToggleInput;
|
import electrosphere.renderer.ui.elements.ToggleInput;
|
||||||
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
import electrosphere.renderer.ui.events.ValueChangeEvent;
|
||||||
|
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaAlignment;
|
||||||
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaFlexDirection;
|
import electrosphere.renderer.ui.elementtypes.ContainerElement.YogaFlexDirection;
|
||||||
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
import electrosphere.renderer.ui.elementtypes.ValueElement.ValueChangeEventCallback;
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ public class InputMacros {
|
|||||||
public static Div createToggle(String label, boolean defaultValue, Consumer<ValueChangeEvent> onChange){
|
public static Div createToggle(String label, boolean defaultValue, Consumer<ValueChangeEvent> onChange){
|
||||||
Div rVal = Div.createDiv();
|
Div rVal = Div.createDiv();
|
||||||
rVal.setFlexDirection(YogaFlexDirection.Row);
|
rVal.setFlexDirection(YogaFlexDirection.Row);
|
||||||
|
rVal.setAlignItems(YogaAlignment.Center);
|
||||||
|
|
||||||
//the label
|
//the label
|
||||||
Label labelEl = Label.createLabel(label);
|
Label labelEl = Label.createLabel(label);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user