Skip to content

Commit

Permalink
Merge branch 'refs/heads/master' into plugin-new-component
Browse files Browse the repository at this point in the history
  • Loading branch information
Dgzt committed Jul 31, 2024
2 parents 29cef6d + 15f4204 commit 690644e
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions editor/src/main/com/mbrlabs/mundus/editor/tools/ScaleTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.badlogic.gdx.scenes.scene2d.utils.Drawable;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.mbrlabs.mundus.commons.scene3d.GameObject;
import com.mbrlabs.mundus.commons.scene3d.components.Component;
import com.mbrlabs.mundus.editor.Mundus;
import com.mbrlabs.mundus.editor.core.project.ProjectContext;
import com.mbrlabs.mundus.editor.core.project.ProjectManager;
Expand Down Expand Up @@ -176,13 +175,9 @@ public void render() {
public void act() {
super.act();
ProjectContext projectContext = getProjectManager().current();

final GameObject selection = projectContext.currScene.currentSelection;
if(!isScalable(selection)) {
return;
}

if (selection!= null) {
if (selection != null) {
translateHandles();
scaleHandles();

Expand Down Expand Up @@ -249,12 +244,7 @@ public boolean touchDown(int screenX, int screenY, int pointer, int button) {
super.touchDown(screenX, screenY, pointer, button);
}

if(!isScalable(selection)) {
super.touchDown(screenX, screenY, pointer, button);
return false;
}

if (button == Input.Buttons.LEFT && projectContext.currScene.currentSelection != null) {
if (button == Input.Buttons.LEFT && selection != null) {
ScaleHandle handle = (ScaleHandle) handlePicker.pick(handles, projectContext.currScene, screenX, screenY);
if (handle == null) {
state = TransformState.IDLE;
Expand Down Expand Up @@ -334,10 +324,6 @@ public void gameObjectSelected(GameObject selection) {
translateHandles();
}

private boolean isScalable(GameObject go) {
return go == null || go.findComponentByType(Component.Type.TERRAIN) == null;
}

@Override
protected void rotateHandles() {
// not needed
Expand Down

0 comments on commit 690644e

Please sign in to comment.