Label fixes

This commit is contained in:
fgnm
2020-06-27 00:42:17 +02:00
parent cc18e2c5e4
commit 227207acbd
5 changed files with 28 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
{"lastOpenedSystemPath":"/home/kalculon/Documents/HyperLap2D/Test5","lastImportedSystemPath":"/mnt/Data/Red&Black/graphics/rolly-monkey-graphics"}
{"lastOpenedSystemPath":"/home/kalculon/Documents/HyperLap2D/Test6","lastImportedSystemPath":"/home/kalculon"}
@@ -68,7 +68,7 @@ public class UpdateLabelDataCommand extends EntityModifyRevertableCommand {
labelComponent.setStyle(getNewStyle(labelComponent.fontName, labelComponent.fontSize));
labelComponent.setWrap((Boolean) payload[6]);
facade.sendNotification(MsgAPI.ITEM_PROPERTY_DATA_FINISHED_MODIFYING, entity);
facade.sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity);
}
private Label.LabelStyle getNewStyle(String fontName, int fontSize) {
@@ -94,5 +94,7 @@ public class UpdateLabelDataCommand extends EntityModifyRevertableCommand {
labelComponent.setText(prevText);
labelComponent.setStyle(prevStyle);
labelComponent.setWrap(prevWrap);
facade.sendNotification(MsgAPI.ITEM_DATA_UPDATED, entity);
}
}
@@ -19,10 +19,12 @@
package games.rednblack.editor.utils;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
import com.badlogic.gdx.scenes.scene2d.ui.TextTooltip;
import com.badlogic.gdx.scenes.scene2d.ui.TooltipManager;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.utils.Align;
import com.kotcrab.vis.ui.VisUI;
import com.kotcrab.vis.ui.util.InputValidator;
@@ -155,7 +157,23 @@ public class StandardWidgetsFactory {
public static <T> VisSelectBox<T> createSelectBox(String style, Class<T> type) {
VisSelectBox<T> visSelectBox = new VisSelectBox<T>(style);
visSelectBox.clearListeners();
visSelectBox.addListener(new CursorListener(CursorManager.FINGER));
visSelectBox.addListener(new ClickListener() {
public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
if (pointer == 0 && button != 0) return false;
if (visSelectBox.isDisabled()) return false;
if (visSelectBox.getScrollPane().hasParent()) {
visSelectBox.hideList();
} else {
visSelectBox.showList();
if (visSelectBox.getScrollPane().getWidth() > visSelectBox.getWidth()) {
visSelectBox.getScrollPane().setX(visSelectBox.getScrollPane().getX() + (visSelectBox.getWidth() - visSelectBox.getScrollPane().getWidth()));
}
}
return true;
}
});
return visSelectBox;
}
@@ -43,8 +43,8 @@ public class UILabelItemProperties extends UIItemCollapsibleProperties {
alignSelectBox = StandardWidgetsFactory.createSelectBox(String.class);
boldCheckBox = StandardWidgetsFactory.createCheckBox();
italicCheckBox = StandardWidgetsFactory.createCheckBox();
wrapCheckBox = StandardWidgetsFactory.createCheckBox();
fontSizeField = StandardWidgetsFactory.createNumberSelector(12, 0, 100);
wrapCheckBox = StandardWidgetsFactory.createCheckBox("Wrap");
fontSizeField = StandardWidgetsFactory.createNumberSelector(12, 1, 500);
fontFamilySelectBox.setMaxListCount(10);
alignSelectBox.setMaxListCount(10);
@@ -71,8 +71,7 @@ public class UILabelItemProperties extends UIItemCollapsibleProperties {
mainTable.row().padTop(5);
mainTable.add(textEditTable).colspan(2).width(200);
mainTable.row().padTop(5);
mainTable.add(StandardWidgetsFactory.createLabel("Wrap", Align.right)).padRight(5).width(90).left();
mainTable.add(wrapCheckBox).width(55).padRight(5);
mainTable.add(wrapCheckBox).padRight(5);
mainTable.row().padTop(5);
textEditTable.add(textArea).width(200).height(65);
@@ -3,6 +3,8 @@ package games.rednblack.editor.view.ui.widget;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane;
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox;
public class ScrollFocusListener extends InputListener {
private Actor listenerActor;
@@ -16,7 +18,7 @@ public class ScrollFocusListener extends InputListener {
@Override
public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
if (toActor != listenerActor) {
event.getStage().setScrollFocus(null);
event.getStage().setScrollFocus(toActor);
}
}
}