diff --git a/art/textures/expandable-properties-active-bg.9.png b/art/textures/expandable-properties-active-bg.9.png index 684f11ac..d254c758 100644 Binary files a/art/textures/expandable-properties-active-bg.9.png and b/art/textures/expandable-properties-active-bg.9.png differ diff --git a/assets/style/uiskin.json b/assets/style/uiskin.json index 79dba15a..5cb9a27c 100644 --- a/assets/style/uiskin.json +++ b/assets/style/uiskin.json @@ -447,6 +447,9 @@ up: button-panel-bg, imageUp: icon-close-white }, + close-properties: { + imageUp: icon-close-white + }, trash-button: { imageDown: icon-trash-disabled, imageOver: icon-trash-over, diff --git a/assets/style/uiskin.png b/assets/style/uiskin.png index 9601fc04..9ca86b4e 100644 Binary files a/assets/style/uiskin.png and b/assets/style/uiskin.png differ diff --git a/src/main/java/games/rednblack/editor/utils/StandardWidgetsFactory.java b/src/main/java/games/rednblack/editor/utils/StandardWidgetsFactory.java index f66d2605..3d021be2 100644 --- a/src/main/java/games/rednblack/editor/utils/StandardWidgetsFactory.java +++ b/src/main/java/games/rednblack/editor/utils/StandardWidgetsFactory.java @@ -221,4 +221,10 @@ public class StandardWidgetsFactory { button.addListener(new CursorListener(CursorManager.FINGER)); return button; } + + public static VisImageButton createImageButton(String style) { + VisImageButton button = new VisImageButton(style); + button.addListener(new CursorListener(CursorManager.FINGER)); + return button; + } } diff --git a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java index 2f5b70f1..2154e9b9 100644 --- a/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java +++ b/src/main/java/games/rednblack/editor/view/ui/box/UILayerBoxMediator.java @@ -150,7 +150,7 @@ public class UILayerBoxMediator extends PanelMediator { if(deletingLayerIndex != -1) { String layerName = layers.get(deletingLayerIndex).layerName; Dialogs.showConfirmDialog(sandbox.getUIStage(), - "Delete Layer", "Do you realy want to delete '" + layerName + "' layer?", + "Delete Layer", "Do you really want to delete '" + layerName + "' layer?", new String[]{"Cancel", "Delete"}, new Integer[]{0, 1}, r -> { if (r == 1) { facade.sendNotification(MsgAPI.ACTION_DELETE_LAYER, layerName); diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/UIItemCollapsibleProperties.java b/src/main/java/games/rednblack/editor/view/ui/properties/UIItemCollapsibleProperties.java index 46d756fb..7667d61f 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/UIItemCollapsibleProperties.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/UIItemCollapsibleProperties.java @@ -49,8 +49,8 @@ public abstract class UIItemCollapsibleProperties extends UIItemProperties { header = new VisTable(); header.setBackground(VisUI.getSkin().getDrawable("expandable-properties-active-bg")); header.add(StandardWidgetsFactory.createLabel(title)).right().expandX().padRight(6); - VisImageButton button = new VisImageButton("expandable-properties-button"); - header.add(button).padRight(3); + VisImageButton button = StandardWidgetsFactory.createImageButton("expandable-properties-button"); + header.add(button).padRight(8); header.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/UIRemovableProperties.java b/src/main/java/games/rednblack/editor/view/ui/properties/UIRemovableProperties.java index 8176752c..12d6a6bb 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/UIRemovableProperties.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/UIRemovableProperties.java @@ -4,9 +4,12 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.ui.Table; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.kotcrab.vis.ui.VisUI; +import com.kotcrab.vis.ui.util.dialog.Dialogs; import com.kotcrab.vis.ui.widget.VisImageButton; import com.kotcrab.vis.ui.widget.VisTable; import games.rednblack.editor.utils.StandardWidgetsFactory; +import games.rednblack.editor.view.stage.Sandbox; +import games.rednblack.h2d.common.MsgAPI; /** * Created by CyberJoe on 7/2/2015. @@ -21,11 +24,11 @@ public abstract class UIRemovableProperties extends UIItemCollapsibleProperties public Table crateHeaderTable() { VisTable header = new VisTable(); header.setBackground(VisUI.getSkin().getDrawable("expandable-properties-active-bg")); - VisImageButton collapseButton = new VisImageButton("expandable-properties-button"); - VisImageButton closeButton = new VisImageButton("close-panel"); + VisImageButton collapseButton = StandardWidgetsFactory.createImageButton("expandable-properties-button"); + VisImageButton closeButton = StandardWidgetsFactory.createImageButton("close-properties"); header.add(closeButton).left().padLeft(2); header.add(StandardWidgetsFactory.createLabel(title)).left().expandX().padLeft(6); - header.add(collapseButton).right().padRight(3); + header.add(collapseButton).right().padRight(8); header.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { @@ -38,8 +41,14 @@ public abstract class UIRemovableProperties extends UIItemCollapsibleProperties @Override public void clicked(InputEvent event, float x, float y) { super.clicked(event, x, y); - onRemove(); - remove(); + Dialogs.showConfirmDialog(Sandbox.getInstance().getUIStage(), + "Delete Component", "Do you want to delete this component?", + new String[]{"Cancel", "Delete"}, new Integer[]{0, 1}, r -> { + if (r == 1) { + onRemove(); + remove(); + } + }).padBottom(20).pack(); } }); return header; diff --git a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UIPhysicsProperties.java b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UIPhysicsProperties.java index cc70a04d..f52950b6 100644 --- a/src/main/java/games/rednblack/editor/view/ui/properties/panels/UIPhysicsProperties.java +++ b/src/main/java/games/rednblack/editor/view/ui/properties/panels/UIPhysicsProperties.java @@ -21,7 +21,7 @@ public class UIPhysicsProperties extends UIRemovableProperties { public static final String prefix = "games.rednblack.editor.view.ui.properties.panels.UIPhysicsProperties"; public static final String CLOSE_CLICKED = prefix + ".CLOSE_CLICKED"; - private HashMap bodyTypes = new HashMap<>(); + private final HashMap bodyTypes = new HashMap<>(); private VisSelectBox bodyTypeBox; private VisValidatableTextField massField;