inventory grid: add delay before activating overlay

This commit is contained in:
Adam
2019-06-04 08:52:05 -04:00
parent c7357bcf29
commit 8806bba274
3 changed files with 11 additions and 1 deletions

View File

@@ -1360,6 +1360,13 @@ public interface Client extends GameEngine
*/
boolean isInInstancedRegion();
/**
* Get the number of client ticks an item has been pressed
*
* @return the number of client ticks an item has been pressed
*/
int getItemPressedDuration();
/**
* Sets whether the client is hiding entities.
* <p>

View File

@@ -45,6 +45,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
class InventoryGridOverlay extends Overlay
{
private static final int INVENTORY_SIZE = 28;
private static final int DRAG_DELAY = 5;
private static final Color HIGHLIGHT = new Color(0, 255, 0, 45);
private static final Color GRID = new Color(255, 255, 255, 45);
@@ -70,7 +71,8 @@ class InventoryGridOverlay extends Overlay
final Widget if1DraggingWidget = client.getIf1DraggedWidget();
final Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY);
if (if1DraggingWidget == null || if1DraggingWidget != inventoryWidget)
if (if1DraggingWidget == null || if1DraggingWidget != inventoryWidget
|| client.getItemPressedDuration() < DRAG_DELAY)
{
return null;
}

View File

@@ -777,6 +777,7 @@ public interface RSClient extends RSGameEngine, Client
boolean isInInstancedRegion();
@Import("itemPressedDuration")
@Override
int getItemPressedDuration();
@Import("itemPressedDuration")