camera: add zoom slider tooltip when dragging
Co-authored-by: superiorser9 <superiorser9@gmail.com>
This commit is contained in:
@@ -351,4 +351,16 @@ public final class ScriptID
|
||||
*/
|
||||
@ScriptArguments(integer = 14, string = 3)
|
||||
public static final int CHATBOX_BUILD_LINE_WITH_CLAN = 4483;
|
||||
|
||||
/**
|
||||
* Drag callback for the camera zoom slider in the options side panel.
|
||||
*/
|
||||
@ScriptArguments(integer = 3)
|
||||
public static final int ZOOM_SLIDER_ONDRAG = 833;
|
||||
|
||||
/**
|
||||
* Drag callback for the camera zoom slider in the settings.
|
||||
*/
|
||||
@ScriptArguments(integer = 6)
|
||||
public static final int SETTINGS_ZOOM_SLIDER_ONDRAG = 3896;
|
||||
}
|
||||
@@ -367,15 +367,23 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
@Subscribe
|
||||
private void onScriptPreFired(ScriptPreFired ev)
|
||||
{
|
||||
if (ev.getScriptId() == ScriptID.SETTINGS_SLIDER_CHOOSE_ONOP)
|
||||
switch (ev.getScriptId())
|
||||
{
|
||||
int arg = client.getIntStackSize() - 7;
|
||||
int[] is = client.getIntStack();
|
||||
|
||||
if (is[arg] == SettingID.CAMERA_ZOOM)
|
||||
case ScriptID.SETTINGS_SLIDER_CHOOSE_ONOP:
|
||||
{
|
||||
addZoomTooltip(client.getScriptActiveWidget());
|
||||
int arg = client.getIntStackSize() - 7;
|
||||
int[] is = client.getIntStack();
|
||||
|
||||
if (is[arg] == SettingID.CAMERA_ZOOM)
|
||||
{
|
||||
addZoomTooltip(client.getScriptActiveWidget());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ScriptID.ZOOM_SLIDER_ONDRAG:
|
||||
case ScriptID.SETTINGS_ZOOM_SLIDER_ONDRAG:
|
||||
sliderTooltip = makeSliderTooltip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,12 +398,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
|
||||
|
||||
private void addZoomTooltip(Widget w)
|
||||
{
|
||||
w.setOnMouseRepeatListener((JavaScriptCallback) ev ->
|
||||
{
|
||||
int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT);
|
||||
int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT;
|
||||
sliderTooltip = new Tooltip("Camera Zoom: " + value + " / " + max);
|
||||
});
|
||||
w.setOnMouseRepeatListener((JavaScriptCallback) ev -> sliderTooltip = makeSliderTooltip());
|
||||
}
|
||||
|
||||
private Tooltip makeSliderTooltip()
|
||||
{
|
||||
int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT);
|
||||
int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT;
|
||||
return new Tooltip("Camera Zoom: " + value + " / " + max);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
Reference in New Issue
Block a user