From 7e0bd4a385f9c9c975096167271c7b6d10daf3a4 Mon Sep 17 00:00:00 2001 From: Dokthar Date: Sun, 6 Sep 2015 13:07:55 +0200 Subject: [PATCH] SDK scenecomposer : fix issue #332 cursor doesn't move the position of the cursor wasn't updated, now it's work fine --- .../gde/scenecomposer/tools/SelectTool.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java index 87f3c283f..013cfb492 100644 --- a/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java +++ b/sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/tools/SelectTool.java @@ -10,6 +10,7 @@ import com.jme3.gde.core.sceneexplorer.nodes.JmeSpatial; import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent; import com.jme3.gde.scenecomposer.SceneEditTool; import com.jme3.math.Vector2f; +import com.jme3.math.Vector3f; import com.jme3.scene.Node; import com.jme3.scene.Spatial; import com.jme3.terrain.Terrain; @@ -33,7 +34,7 @@ import org.openide.loaders.DataObject; */ public class SelectTool extends SceneEditTool { - private boolean wasDraggingR = false; + private boolean wasDraggingR, wasDraggingL = false; private boolean wasDownR = false; /** @@ -52,13 +53,24 @@ public class SelectTool extends SceneEditTool { */ @Override public void actionPrimary(Vector2f screenCoord, boolean pressed, final JmeNode rootNode, DataObject dataObject) { - + if (!pressed){ + if (!wasDraggingL) { + Vector3f result = pickWorldLocation(getCamera(), screenCoord, rootNode); + if (result != null) { + if (toolController.isSnapToGrid()) { + result.set(Math.round(result.x), result.y, Math.round(result.z)); + } + toolController.doSetCursorLocation(result); + } + } + wasDraggingL = false; + } } @Override public void actionSecondary(final Vector2f screenCoord, boolean pressed, final JmeNode rootNode, DataObject dataObject) { if (pressed) { - Spatial selected = toolController.getSelectedSpatial(); + Spatial selected;// = toolController.getSelectedSpatial(); // mouse down if (!wasDraggingR && !wasDownR) { // wasn't dragging and was not down already @@ -137,6 +149,7 @@ public class SelectTool extends SceneEditTool { @Override public void draggedPrimary(Vector2f screenCoord, boolean pressed, JmeNode rootNode, DataObject currentDataObject) { + wasDraggingL = pressed; } @Override