Allow lowering of outer zoom limit in the camera zoom plugin

This commit is contained in:
Twiglet1022
2018-12-08 23:29:24 +00:00
committed by Adam
parent 46e0ebe4f9
commit 346b5952bc
3 changed files with 15 additions and 5 deletions

View File

@@ -26,6 +26,7 @@ package net.runelite.client.plugins.config;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import com.google.common.primitives.Ints;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -350,6 +351,9 @@ public class ConfigPanel extends PluginPanel
max = range.max();
}
// Config may previously have been out of range
value = Ints.constrainToRange(value, min, max);
SpinnerModel model = new SpinnerNumberModel(value, min, max, 1);
JSpinner spinner = new JSpinner(model);
Component editor = spinner.getEditor();

View File

@@ -27,10 +27,14 @@ package net.runelite.client.plugins.zoom;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
@ConfigGroup("zoom")
public interface ZoomConfig extends Config
{
int OUTER_LIMIT_MIN = -400;
int OUTER_LIMIT_MAX = 400;
@ConfigItem(
keyName = "inner",
name = "Expand inner zoom limit",
@@ -42,10 +46,14 @@ public interface ZoomConfig extends Config
return false;
}
@Range(
min = OUTER_LIMIT_MIN,
max = OUTER_LIMIT_MAX
)
@ConfigItem(
keyName = "outerLimit",
name = "Expand outer zoom limit",
description = "Configures how much the outer zoom limit is increased, 0 is off",
description = "Configures how much the outer zoom limit is adjusted",
position = 2
)
default int outerLimit()

View File

@@ -25,6 +25,7 @@
*/
package net.runelite.client.plugins.zoom;
import com.google.common.primitives.Ints;
import com.google.inject.Inject;
import com.google.inject.Provides;
import java.awt.event.KeyEvent;
@@ -54,9 +55,6 @@ public class ZoomPlugin extends Plugin implements KeyListener
*/
private static final int INNER_ZOOM_LIMIT = 1004;
private static final int OUTER_CONFIG_ZOOM_LIMIT_MIN = 0;
private static final int OUTER_CONFIG_ZOOM_LIMIT_MAX = 400;
private boolean controlDown;
@Inject
@@ -100,7 +98,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
if ("outerZoomLimit".equals(event.getEventName()))
{
int outerLimit = Math.max(OUTER_CONFIG_ZOOM_LIMIT_MIN, Math.min(OUTER_CONFIG_ZOOM_LIMIT_MAX, zoomConfig.outerLimit()));
int outerLimit = Ints.constrainToRange(zoomConfig.outerLimit(), ZoomConfig.OUTER_LIMIT_MIN, ZoomConfig.OUTER_LIMIT_MAX);
int outerZoomLimit = 128 - outerLimit;
intStack[intStackSize - 1] = outerZoomLimit;
return;