1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2025-01-20 19:47:38 +00:00

Now using hbox to more easily append unit label

This commit is contained in:
Jenny Crowe 2024-01-26 18:30:41 -07:00
parent 8b19a7511c
commit 4f7c2cd511

View file

@ -18,6 +18,7 @@ import haxe.ui.core.Component;
import funkin.data.event.SongEventRegistry; import funkin.data.event.SongEventRegistry;
import haxe.ui.components.TextField; import haxe.ui.components.TextField;
import haxe.ui.containers.Box; import haxe.ui.containers.Box;
import haxe.ui.containers.HBox;
import haxe.ui.containers.Frame; import haxe.ui.containers.Frame;
import haxe.ui.events.UIEvent; import haxe.ui.events.UIEvent;
import haxe.ui.data.ArrayDataSource; import haxe.ui.data.ArrayDataSource;
@ -214,18 +215,21 @@ class ChartEditorEventDataToolbox extends ChartEditorBaseToolbox
input.text = field.type; input.text = field.type;
} }
target.addComponent(input); // Putting in a box so we can add a unit label easily if there is one.
var inputBox:HBox = new HBox();
inputBox.addComponent(input);
// Add a unit label if applicable.
if (field.units != null && field.units != "") if (field.units != null && field.units != "")
{ {
var units:Label = new Label(); var units:Label = new Label();
units.text = field.units; units.text = field.units;
units.verticalAlign = "center"; units.verticalAlign = "center";
units.left = 85; inputBox.addComponent(units);
units.top = 4;
input.addComponent(units);
} }
target.addComponent(inputBox);
// Update the value of the event data. // Update the value of the event data.
input.onChange = function(event:UIEvent) { input.onChange = function(event:UIEvent) {
var value = event.target.value; var value = event.target.value;