Allow lowering of outer zoom limit in the camera zoom plugin
This commit is contained in:
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.config;
|
|||||||
|
|
||||||
import com.google.common.base.Splitter;
|
import com.google.common.base.Splitter;
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
@@ -350,6 +351,9 @@ public class ConfigPanel extends PluginPanel
|
|||||||
max = range.max();
|
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);
|
SpinnerModel model = new SpinnerNumberModel(value, min, max, 1);
|
||||||
JSpinner spinner = new JSpinner(model);
|
JSpinner spinner = new JSpinner(model);
|
||||||
Component editor = spinner.getEditor();
|
Component editor = spinner.getEditor();
|
||||||
|
|||||||
@@ -27,10 +27,14 @@ package net.runelite.client.plugins.zoom;
|
|||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
import net.runelite.client.config.Range;
|
||||||
|
|
||||||
@ConfigGroup("zoom")
|
@ConfigGroup("zoom")
|
||||||
public interface ZoomConfig extends Config
|
public interface ZoomConfig extends Config
|
||||||
{
|
{
|
||||||
|
int OUTER_LIMIT_MIN = -400;
|
||||||
|
int OUTER_LIMIT_MAX = 400;
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "inner",
|
keyName = "inner",
|
||||||
name = "Expand inner zoom limit",
|
name = "Expand inner zoom limit",
|
||||||
@@ -42,10 +46,14 @@ public interface ZoomConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Range(
|
||||||
|
min = OUTER_LIMIT_MIN,
|
||||||
|
max = OUTER_LIMIT_MAX
|
||||||
|
)
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "outerLimit",
|
keyName = "outerLimit",
|
||||||
name = "Expand outer zoom limit",
|
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
|
position = 2
|
||||||
)
|
)
|
||||||
default int outerLimit()
|
default int outerLimit()
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.zoom;
|
package net.runelite.client.plugins.zoom;
|
||||||
|
|
||||||
|
import com.google.common.primitives.Ints;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.event.KeyEvent;
|
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 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;
|
private boolean controlDown;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@@ -100,7 +98,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
|
|||||||
|
|
||||||
if ("outerZoomLimit".equals(event.getEventName()))
|
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;
|
int outerZoomLimit = 128 - outerLimit;
|
||||||
intStack[intStackSize - 1] = outerZoomLimit;
|
intStack[intStackSize - 1] = outerZoomLimit;
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user