From c53558ee2d6e37ba0b34020f8d5d2d9a5099525e Mon Sep 17 00:00:00 2001 From: Raaz Khoshnood Date: Mon, 1 Jun 2026 15:52:09 -0500 Subject: [PATCH 1/2] refactor: add timer to hybrid click Slight tweak to "Snap then cycle" Fixes #29 --- README.md | 8 +++++--- .../compassCameraControl/CompassCameraControlConfig.java | 4 ++-- .../compassCameraControl/CompassCameraControlPlugin.java | 8 +++++++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index e310367..9fd50ae 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,10 @@ Useful for spinning the camera manually, then aligning to the grid. When clicking the compass, the camera will snap to face the same direction as your character. ### Snap Then Cycle Mode -When clicking the compass, the camera will snap to the closest **allowed** direction (from cycle order field), and if you're already on an allowed direction, it will cycle through them. -For example, with cycle order "N,S": First click from South-East snaps to South. Next click cycles to North. Next click cycles back to South. +When clicking the compass, the camera will snap to the closest **allowed** direction (from cycle order field). +If you click again within 2 seconds while already on an allowed direction, it will cycle through allowed directions. +If you wait longer than 2 seconds, the next click re-snaps instead of cycling. +For example, with cycle order "N,S": First click from South-East snaps to South. A quick second click cycles to North. If you wait a few seconds, a click re-centers instead of cycling. ### Shift-Click Option You can configure how the plugin responds to clicks on the compass: @@ -37,7 +39,7 @@ You can set up shortcuts for quick camera control. To prevent shortcuts from app - **Snap to Facing**: Snap camera to your character's facing direction when pressed - **Snap to Closest**: Snap camera to the closest cardinal direction when pressed - **Cycle Cardinal**: Cycle through your custom cycle order of directions when pressed -- **Snap Then Cycle**: Snap to closest allowed direction; if snapped, cycle when pressed +- **Snap Then Cycle**: Snap to closest allowed direction; quick re-press (within 2 seconds) cycles - **Look North Key**: Face camera North when pressed - **Look South Key**: Face camera South when pressed - **Look East Key**: Face camera East when pressed diff --git a/src/main/java/com/compassCameraControl/CompassCameraControlConfig.java b/src/main/java/com/compassCameraControl/CompassCameraControlConfig.java index a5cac91..122e2f5 100644 --- a/src/main/java/com/compassCameraControl/CompassCameraControlConfig.java +++ b/src/main/java/com/compassCameraControl/CompassCameraControlConfig.java @@ -17,7 +17,7 @@ public interface CompassCameraControlConfig extends Config description = "Cycle: North -> South -> East -> West (default)
" + "Snap to Closest: Snaps the camera to the nearest cardinal direction
" + "Snap to Facing: Snaps the camera to the player's facing direction
" + - "Snap then Cycle: Snaps to cardinal within cycle order, then cycle" + "Snap then Cycle: Snaps to cardinal; re-click within 2 seconds to cycle" ) default ControlMode controlMode() { @@ -99,7 +99,7 @@ default Keybind cycleCardinalKey() { position = 8, section = cardinalKeybindingSnap, description = "Snap to the closest allowed direction (within cycle order)
" + - "Cycle if already on an allowed direction" + "Quick re-press within 2 seconds cycles if already on an allowed direction" ) default Keybind snapThenCycleKey() { return new Keybind(KeyEvent.VK_UNDEFINED, 0); diff --git a/src/main/java/com/compassCameraControl/CompassCameraControlPlugin.java b/src/main/java/com/compassCameraControl/CompassCameraControlPlugin.java index c13af3c..b61c092 100644 --- a/src/main/java/com/compassCameraControl/CompassCameraControlPlugin.java +++ b/src/main/java/com/compassCameraControl/CompassCameraControlPlugin.java @@ -53,6 +53,9 @@ public class CompassCameraControlPlugin extends Plugin private static final String SNAP_CARDINAL = "Snap Cardinal"; private static final String CYCLE_CARDINAL = "Cycle Cardinal"; private static final String SNAP_THEN_CYCLE = "Snap Then Cycle"; + private static final long HYBRID_CYCLE_TIMEOUT_MS = 2000L; + + private long lastHybridClickTimeMs; @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) @@ -199,6 +202,7 @@ private void alignYaw(int[] yaws) private void hybridSnapThenCycle() { + long nowMs = System.currentTimeMillis(); int currentYaw = client.getCameraYaw(); int[] allowedYaws = cycleOrderToYaws(); @@ -213,7 +217,7 @@ private void hybridSnapThenCycle() } } - if (isOnAllowedCardinal) + if (isOnAllowedCardinal && (nowMs - lastHybridClickTimeMs) <= HYBRID_CYCLE_TIMEOUT_MS) { cycleYaw(allowedYaws); } @@ -221,6 +225,8 @@ private void hybridSnapThenCycle() { alignYaw(allowedYaws); } + + lastHybridClickTimeMs = nowMs; } private void facingYaw() From a1c106b49e3ceba5ab3fe38dd115f26e69c16a35 Mon Sep 17 00:00:00 2001 From: Raaz Khoshnood Date: Mon, 1 Jun 2026 15:52:33 -0500 Subject: [PATCH 2/2] bump version --- build.gradle | 2 +- runelite-plugin.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index b7f8f78..345a50d 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ dependencies { } group = 'com.compassCameraControl' -version = '1.2.3' +version = '1.2.4' tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' diff --git a/runelite-plugin.properties b/runelite-plugin.properties index 24545ba..3767406 100644 --- a/runelite-plugin.properties +++ b/runelite-plugin.properties @@ -3,6 +3,6 @@ author=Raaz description=Expands compass functionality tags=camera, compass, control, navigation, usability, convenience plugins=com.compassCameraControl.CompassCameraControlPlugin -version=1.2.3 +version=1.2.4 build=standard support=https://github.com/RaazKH/CompassCameraControl \ No newline at end of file