Skip to content

MouseScroll ​

com.jsmacrosce.jsmacros.client.api.event.impl.EventMouseScroll

Since1.9.0Cancellable

Fires before the game handles a scroll input, only when no screen or overlay is open, a player is present, and at least one raw offset is nonzero. The offsets have not yet been scaled by mouse wheel sensitivity or converted by the discrete-scroll setting. Cancelling prevents the game's scroll handling, including its input notification and gameplay effects.

js
JsMacros.on("MouseScroll", JavaWrapper.methodToJava(function (event) {
 if (event.deltaY > 0.0) {
   // positive is up, negative is down
   Chat.log(`scrolled up by ${event.deltaY}`);  
   event.cancel();  
 }
}))

Constructors ​

new EventMouseScroll ​

new EventMouseScroll(double deltaX, double deltaY)#
Initializes the event with the supplied raw scroll offsets; construction does not dispatch it.

Parameters:

  • deltaX: the horizontal scroll offset, stored unchanged
  • deltaY: the vertical scroll offset, stored unchanged

Fields ​

deltaX ​

deltaX: doubleread-only#
Raw horizontal scroll offset from the windowing library, before game sensitivity or discrete- scroll processing.

deltaY ​

deltaY: doubleread-only#
Raw vertical scroll offset from the windowing library, before game sensitivity or discrete- scroll processing.

Methods ​

toString ​

toString(): String#
Returns a diagnostic string containing the event name and both scroll offsets. The result uses the format %s:{"deltaX": %s, "deltaY": %s}; it is not JSON, and the offsets use Double string formatting without finite-value validation.
Returns: the event name and horizontal and vertical offsets in diagnostic form