- enable input workaround for canvas

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8665 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 8b5ecd5a7d
commit 5f87f820c9
  1. 106
      sdk/jme3-core/src/com/jme3/gde/core/sceneviewer/SceneViewerTopComponent.java

@ -24,6 +24,7 @@
*/ */
package com.jme3.gde.core.sceneviewer; package com.jme3.gde.core.sceneviewer;
import com.jme3.gde.core.Installer;
import com.jme3.gde.core.filters.FilterExplorerTopComponent; import com.jme3.gde.core.filters.FilterExplorerTopComponent;
import com.jme3.gde.core.scene.SceneApplication; import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.SceneRequest; import com.jme3.gde.core.scene.SceneRequest;
@ -48,6 +49,7 @@ import org.openide.awt.UndoRedo;
import org.openide.util.Exceptions; import org.openide.util.Exceptions;
import org.openide.util.HelpCtx; import org.openide.util.HelpCtx;
import org.openide.util.Lookup; import org.openide.util.Lookup;
import org.openide.util.NbPreferences;
/** /**
* Top component which displays something. * Top component which displays something.
@ -90,57 +92,59 @@ public final class SceneViewerTopComponent extends TopComponent {
//We add a mouse wheel listener to the top conmponent in order to correctly dispatch the event ot the cam controller //We add a mouse wheel listener to the top conmponent in order to correctly dispatch the event ot the cam controller
//the oGLPanel may naver have the focus. //the oGLPanel may naver have the focus.
// addMouseWheelListener(new MouseWheelListener() { if ("true".equals(NbPreferences.forModule(Installer.class).get("use_lwjgl_canvas", "false"))) {
// addMouseWheelListener(new MouseWheelListener() {
// public void mouseWheelMoved(final MouseWheelEvent e) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() { public void mouseWheelMoved(final MouseWheelEvent e) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() {
// public Void call() throws Exception {
// String action = "MouseWheel-"; public Void call() throws Exception {
// if (e.getWheelRotation() < 0) { String action = "MouseWheel-";
// action = "MouseWheel"; if (e.getWheelRotation() < 0) {
// } action = "MouseWheel";
// app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0); }
// return null; app.getActiveCameraController().onAnalog(action, e.getWheelRotation(), 0);
// } return null;
// }); }
// } });
// }); }
// addKeyListener(new KeyListener() { });
// addKeyListener(new KeyListener() {
// public void keyTyped(KeyEvent evt) {
// } public void keyTyped(KeyEvent evt) {
// }
// public void keyPressed(final KeyEvent evt) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() { public void keyPressed(final KeyEvent evt) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() {
// public Void call() throws Exception {
// int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); public Void call() throws Exception {
// KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false); int code = AwtKeyInput.convertAwtKey(evt.getKeyCode());
// keyEvent.setTime(evt.getWhen()); KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false);
// if (app.getActiveCameraController() != null) { keyEvent.setTime(evt.getWhen());
// app.getActiveCameraController().onKeyEvent(keyEvent); if (app.getActiveCameraController() != null) {
// } app.getActiveCameraController().onKeyEvent(keyEvent);
// return null; }
// } return null;
// }); }
// } });
// }
// public void keyReleased(final KeyEvent evt) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() { public void keyReleased(final KeyEvent evt) {
// SceneApplication.getApplication().enqueue(new Callable<Void>() {
// public Void call() throws Exception {
// int code = AwtKeyInput.convertAwtKey(evt.getKeyCode()); public Void call() throws Exception {
// KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false); int code = AwtKeyInput.convertAwtKey(evt.getKeyCode());
// keyEvent.setTime(evt.getWhen()); KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), false, false);
// if (app.getActiveCameraController() != null) { keyEvent.setTime(evt.getWhen());
// app.getActiveCameraController().onKeyEvent(keyEvent); if (app.getActiveCameraController() != null) {
// } app.getActiveCameraController().onKeyEvent(keyEvent);
// return null; }
// } return null;
// }); }
// } });
// }); }
});
}
} }

Loading…
Cancel
Save