Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Hohenheimsenberg committed May 1, 2015
2 parents 3bd630f + ba3f8b7 commit b1c49e9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
3 changes: 2 additions & 1 deletion src/com/uwsoft/editor/data/manager/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.tools.texturepacker.TexturePacker;
import com.badlogic.gdx.tools.texturepacker.TexturePacker.Settings;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.Json;
import com.kotcrab.vis.ui.util.dialog.DialogUtils;
import com.uwsoft.editor.controlles.ResolutionManager;
Expand Down Expand Up @@ -447,7 +448,7 @@ public File importExternalAnimationIntoProject(File animationFileSource) {
FileUtils.forceMkdir(new File(targetPath));
File jsonFileTarget = new File(targetPath + File.separator + fileNameWithOutExt + ".json");
File atlasFileTarget = new File(targetPath + File.separator + fileNameWithOutExt + ".atlas");
ArrayList<File> imageFiles = getImageListFromAtlas(atlasFileSource);
ArrayList<File> imageFiles = getAtlasPages(atlasFileSource);

FileUtils.copyFile(animationFileSource, jsonFileTarget);
FileUtils.copyFile(atlasFileSource, atlasFileTarget);
Expand Down
4 changes: 4 additions & 0 deletions src/com/uwsoft/editor/gdx/sandbox/ItemSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ public void removeCurrentSelectedItems() {
}

public void alignSelectionsByX(SelectionRectangle relativeTo, boolean toHighestX) {
if (relativeTo == null) return;

final float relativeToX = (toHighestX)? relativeTo.getVisualRightX() : relativeTo.getVisualX();

for (SelectionRectangle value : currentSelection.values()) {
Expand All @@ -298,6 +300,8 @@ public void alignSelectionsByX(SelectionRectangle relativeTo, boolean toHighestX
}

public void alignSelectionsByY(SelectionRectangle relativeTo, boolean toHighestY) {
if (relativeTo == null) return;

final float relativeToY = (toHighestY)? relativeTo.getVisualTopY() : relativeTo.getVisualY();

for (SelectionRectangle value : currentSelection.values()) {
Expand Down
51 changes: 28 additions & 23 deletions src/com/uwsoft/editor/gdx/ui/UIToolBox.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.badlogic.gdx.scenes.scene2d.utils.Align;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import com.badlogic.gdx.scenes.scene2d.utils.TextureRegionDrawable;
import com.kotcrab.vis.ui.widget.Tooltip;
import com.uwsoft.editor.gdx.sandbox.EditingMode;
import com.uwsoft.editor.gdx.stage.SandboxStage;
import com.uwsoft.editor.gdx.stage.UIStage;
Expand All @@ -48,48 +49,48 @@ public UIToolBox(UIStage s) {
btnGroup.setMaxCheckCount(1);
btnGroup.setMinCheckCount(1);

Button mainIcon = addButton("mainIcon", true);
Button resizeIcon = addButton("resizeIcon", true);
Button mainIcon = addButton("mainIcon", "Select tool", true);
Button resizeIcon = addButton("resizeIcon", "Transform tool", true);
//
Button topIcon = addButton("alignIconL", false);
Button topIcon = addButton("alignIconL", "Align top", false);
topIcon.setTransform(true);
topIcon.setRotation(-90);
Button leftIcon = addButton("alignIconL", false);
Button leftIcon = addButton("alignIconL", "Align left", false);
leftIcon.setTransform(true);
Button bottomIcon = addButton("alignIconL", false);
Button bottomIcon = addButton("alignIconL", "Align bottom", false);
bottomIcon.setTransform(true);
bottomIcon.setRotation(90);
Button rightIcon = addButton("alignIconL", false);
Button rightIcon = addButton("alignIconL", "Align right", false);
rightIcon.setTransform(true);
rightIcon.setRotation(180);

Button hCenterIcon = addButton("alignIconCH", false);
Button vCenterIcon = addButton("alignIconCV", false);
Button hCenterIcon = addButton("alignIconCH", "Align horizontally center", false);
Button vCenterIcon = addButton("alignIconCV", "Align vertically center", false);

//TODO: replace textures
Button leftEdgeIcon = addButton("AlignEdge", false);
Button topEdgeIcon = addButton("AlignEdge", false);
Button leftEdgeIcon = addButton("AlignEdge", "Align right edge", false);
Button topEdgeIcon = addButton("AlignEdge", "Align bottom edge", false);
topEdgeIcon.setTransform(true);
topEdgeIcon.setRotation(270f);
Button rightEdgeIcon = addButton("AlignEdge", false);
rightEdgeIcon.setTransform(true);
rightEdgeIcon.setScaleX(-1);
//rightEdgeIcon.setRotation(180f);
Button bottomEdgeIcon = addButton("AlignEdge", false);
bottomEdgeIcon.setTransform(true);
bottomEdgeIcon.setScaleX(-1);
bottomEdgeIcon.setRotation(270f);
topEdgeIcon.setRotation(270f);
Button rightEdgeIcon = addButton("AlignEdge", "Align left edge", false);
rightEdgeIcon.setTransform(true);
rightEdgeIcon.setScaleX(-1);
//rightEdgeIcon.setRotation(180f);
Button bottomEdgeIcon = addButton("AlignEdge", "Align top edge", false);
bottomEdgeIcon.setTransform(true);
bottomEdgeIcon.setScaleX(-1);
bottomEdgeIcon.setRotation(270f);

topIcon.addListener(new ClickListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
stage.getSandbox().getSelector().alignSelections(Align.top);
stage.getSandbox().getSelector().alignSelections(Align.top);
return super.touchDown(event, x, y, pointer, button);
}
});

leftIcon.addListener(new ClickListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
stage.getSandbox().getSelector().alignSelections(Align.left);
stage.getSandbox().getSelector().alignSelections(Align.left);
return super.touchDown(event, x, y, pointer, button);
}
});
Expand Down Expand Up @@ -160,12 +161,16 @@ public boolean touchDown(InputEvent event, float x, float y, int pointer, int bu
}

private Button addButton(String img, boolean isCheckButton) {
ButtonStyle btnStl = new ButtonStyle();
return addButton(img, null, isCheckButton);
}

private Button addButton(String img, String tooltipText, boolean isCheckButton) {
ButtonStyle btnStl = new ButtonStyle();
btnStl.up = new TextureRegionDrawable(stage.textureManager.getEditorAsset(img));
btnStl.down = new TextureRegionDrawable(stage.textureManager.getEditorAsset(img + "Checked"));


Button btn = new Button(btnStl);
if (tooltipText != null) new Tooltip(btn, tooltipText);

btn.setX(10 + currCol * (btn.getWidth() + 5));
btn.setY(getHeight() - (currRow + 1) * (btn.getHeight() + 3) - 17);
Expand Down

0 comments on commit b1c49e9

Please sign in to comment.