client: rename zoom plugin to camera plugin

This commit is contained in:
Adam
2019-12-01 14:02:54 -05:00
committed by Adam
parent d2ef3b16dc
commit 22b8c77fca
3 changed files with 22 additions and 22 deletions

View File

@@ -22,15 +22,15 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.plugins.zoom; package net.runelite.client.plugins.camera;
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; import net.runelite.client.config.Range;
@ConfigGroup("zoom") @ConfigGroup("zoom") // using the old plugin's group name
public interface ZoomConfig extends Config public interface CameraConfig extends Config
{ {
int OUTER_LIMIT_MIN = -400; int OUTER_LIMIT_MIN = -400;
int OUTER_LIMIT_MAX = 400; int OUTER_LIMIT_MAX = 400;

View File

@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.plugins.zoom; package net.runelite.client.plugins.camera;
import com.google.common.primitives.Ints; import com.google.common.primitives.Ints;
import com.google.inject.Inject; import com.google.inject.Inject;
@@ -43,12 +43,12 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@PluginDescriptor( @PluginDescriptor(
name = "Camera Zoom", name = "Camera",
description = "Expand zoom limit and/or enable vertical camera", description = "Expand zoom limit and/or enable vertical camera",
tags = {"limit", "vertical"}, tags = {"zoom", "limit", "vertical"},
enabledByDefault = false enabledByDefault = false
) )
public class ZoomPlugin extends Plugin implements KeyListener public class CameraPlugin extends Plugin implements KeyListener
{ {
private static final int DEFAULT_ZOOM_INCREMENT = 25; private static final int DEFAULT_ZOOM_INCREMENT = 25;
@@ -61,15 +61,15 @@ public class ZoomPlugin extends Plugin implements KeyListener
private ClientThread clientThread; private ClientThread clientThread;
@Inject @Inject
private ZoomConfig zoomConfig; private CameraConfig config;
@Inject @Inject
private KeyManager keyManager; private KeyManager keyManager;
@Provides @Provides
ZoomConfig getConfig(ConfigManager configManager) CameraConfig getConfig(ConfigManager configManager)
{ {
return configManager.getConfig(ZoomConfig.class); return configManager.getConfig(CameraConfig.class);
} }
@Subscribe @Subscribe
@@ -85,32 +85,32 @@ public class ZoomPlugin extends Plugin implements KeyListener
int[] intStack = client.getIntStack(); int[] intStack = client.getIntStack();
int intStackSize = client.getIntStackSize(); int intStackSize = client.getIntStackSize();
if (!controlDown && "scrollWheelZoom".equals(event.getEventName()) && zoomConfig.controlFunction() == ControlFunction.CONTROL_TO_ZOOM) if (!controlDown && "scrollWheelZoom".equals(event.getEventName()) && config.controlFunction() == ControlFunction.CONTROL_TO_ZOOM)
{ {
intStack[intStackSize - 1] = 1; intStack[intStackSize - 1] = 1;
} }
if ("innerZoomLimit".equals(event.getEventName()) && zoomConfig.innerLimit()) if ("innerZoomLimit".equals(event.getEventName()) && config.innerLimit())
{ {
intStack[intStackSize - 1] = ZoomConfig.INNER_ZOOM_LIMIT; intStack[intStackSize - 1] = CameraConfig.INNER_ZOOM_LIMIT;
return; return;
} }
if ("outerZoomLimit".equals(event.getEventName())) if ("outerZoomLimit".equals(event.getEventName()))
{ {
int outerLimit = Ints.constrainToRange(zoomConfig.outerLimit(), ZoomConfig.OUTER_LIMIT_MIN, ZoomConfig.OUTER_LIMIT_MAX); int outerLimit = Ints.constrainToRange(config.outerLimit(), CameraConfig.OUTER_LIMIT_MIN, CameraConfig.OUTER_LIMIT_MAX);
int outerZoomLimit = 128 - outerLimit; int outerZoomLimit = 128 - outerLimit;
intStack[intStackSize - 1] = outerZoomLimit; intStack[intStackSize - 1] = outerZoomLimit;
return; return;
} }
if ("scrollWheelZoomIncrement".equals(event.getEventName()) && zoomConfig.zoomIncrement() != DEFAULT_ZOOM_INCREMENT) if ("scrollWheelZoomIncrement".equals(event.getEventName()) && config.zoomIncrement() != DEFAULT_ZOOM_INCREMENT)
{ {
intStack[intStackSize - 1] = zoomConfig.zoomIncrement(); intStack[intStackSize - 1] = config.zoomIncrement();
return; return;
} }
if (zoomConfig.innerLimit()) if (config.innerLimit())
{ {
// This lets the options panel's slider have an exponential rate // This lets the options panel's slider have an exponential rate
final double exponent = 2.d; final double exponent = 2.d;
@@ -148,7 +148,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
@Override @Override
protected void startUp() protected void startUp()
{ {
client.setCameraPitchRelaxerEnabled(zoomConfig.relaxCameraPitch()); client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
keyManager.registerKeyListener(this); keyManager.registerKeyListener(this);
} }
@@ -163,7 +163,7 @@ public class ZoomPlugin extends Plugin implements KeyListener
@Subscribe @Subscribe
public void onConfigChanged(ConfigChanged ev) public void onConfigChanged(ConfigChanged ev)
{ {
client.setCameraPitchRelaxerEnabled(zoomConfig.relaxCameraPitch()); client.setCameraPitchRelaxerEnabled(config.relaxCameraPitch());
} }
@Override @Override
@@ -187,9 +187,9 @@ public class ZoomPlugin extends Plugin implements KeyListener
{ {
controlDown = false; controlDown = false;
if (zoomConfig.controlFunction() == ControlFunction.CONTROL_TO_RESET) if (config.controlFunction() == ControlFunction.CONTROL_TO_RESET)
{ {
final int zoomValue = Ints.constrainToRange(zoomConfig.ctrlZoomValue(), ZoomConfig.OUTER_LIMIT_MIN, ZoomConfig.INNER_ZOOM_LIMIT); final int zoomValue = Ints.constrainToRange(config.ctrlZoomValue(), CameraConfig.OUTER_LIMIT_MIN, CameraConfig.INNER_ZOOM_LIMIT);
clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue)); clientThread.invokeLater(() -> client.runScript(ScriptID.CAMERA_DO_ZOOM, zoomValue, zoomValue));
} }
} }

View File

@@ -23,7 +23,7 @@
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package net.runelite.client.plugins.zoom; package net.runelite.client.plugins.camera;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Getter; import lombok.Getter;