MouseScroll
com.jsmacrosce.jsmacros.client.api.event.impl.EventMouseScroll
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 unchangeddeltaY: the vertical scroll offset, stored unchanged
Fields
deltaX
Raw horizontal scroll offset from the windowing library, before game sensitivity or discrete- scroll processing.
deltaY
Raw vertical scroll offset from the windowing library, before game sensitivity or discrete- scroll processing.
Methods
toString
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