Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions jme3-core/src/main/java/com/jme3/input/FlyByCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,9 @@ public void setDragToRotate(boolean dragToRotate) {
*/
public void registerWithInput(InputManager inputManager) {
this.inputManager = inputManager;
// Keep cursor visibility under application control when the camera is disabled.
if (enabled) {
registerInputMappings();
} else {
inputManager.setCursorVisible(true);
}
inputManager.addJoystickConnectionListener(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.jme3.app.state.ScreenshotAppState;
import com.jme3.asset.AssetManager;
import com.jme3.asset.DesktopAssetManager;
import com.jme3.input.FlyByCamera;
import com.jme3.input.InputManager;
import com.jme3.input.KeyInput;
import com.jme3.input.RawInputListener;
Expand Down Expand Up @@ -142,6 +143,29 @@ public void testIssue1138() {
}
}

/**
* Test case for JME issue #1219: Registering a disabled FlyByCamera preserves cursor visibility.
*/
@Test
public void testIssue1219() {
DummyMouseInput mouse = new DummyMouseInput();
mouse.initialize();
DummyKeyInput keys = new DummyKeyInput();
keys.initialize();
InputManager inputManager = new InputManager(mouse, keys, null, null);
FlyByCamera flyCam = new FlyByCamera(new Camera(1, 1));

flyCam.setEnabled(false);
inputManager.setCursorVisible(false);
flyCam.registerWithInput(inputManager);

assertFalse(inputManager.isCursorVisible());

flyCam.setEnabled(true);
flyCam.setEnabled(false);
assertTrue(inputManager.isCursorVisible());
}

@Test
public void testDeletedMappingClearsPressedKeyState() {
TestKeyInput keys = new TestKeyInput();
Expand Down