Merge pull request #6591 from MagicfTail/zoom-outer-limit

camera plugin: add expand outer zoom limit option
This commit is contained in:
Adam
2018-11-24 10:30:37 -05:00
committed by GitHub
6 changed files with 48 additions and 2 deletions

View File

@@ -42,11 +42,22 @@ public interface ZoomConfig extends Config
return false;
}
@ConfigItem(
keyName = "outerLimit",
name = "Expand outer zoom limit",
description = "Configures how much the outer zoom limit is increased, 0 is off",
position = 2
)
default int outerLimit()
{
return 0;
}
@ConfigItem(
keyName = "relaxCameraPitch",
name = "Vertical camera",
description = "Relax the camera's upper pitch limit",
position = 2
position = 3
)
default boolean relaxCameraPitch()
{
@@ -57,7 +68,7 @@ public interface ZoomConfig extends Config
keyName = "requireControlDown",
name = "Require control down",
description = "Configures if holding control is required for zooming",
position = 3
position = 4
)
default boolean requireControlDown()
{

View File

@@ -54,6 +54,9 @@ 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
@@ -95,6 +98,14 @@ public class ZoomPlugin extends Plugin implements KeyListener
return;
}
if ("outerZoomLimit".equals(event.getEventName()))
{
int outerLimit = Math.max(OUTER_CONFIG_ZOOM_LIMIT_MIN, Math.min(OUTER_CONFIG_ZOOM_LIMIT_MAX, zoomConfig.outerLimit()));
int outerZoomLimit = 128 - outerLimit;
intStack[intStackSize - 1] = outerZoomLimit;
return;
}
if (zoomConfig.innerLimit())
{
// This lets the options panel's slider have an exponential rate