'Editor - is a B4XView panel container.
....
setHandler(Editor,"setOnScroll","scroll")
End Sub
Sub setHandler(ob As JavaObject,eventName As String,handlerName As String)
ob.RunMethod(eventName, Array(ob.CreateEventFromUI("javafx.event.EventHandler",handlerName,True)))
End Sub
Sub scroll_Event(MethodName As String, Args() As Object)
Dim jo As JavaObject
jo.InitializeStatic("javafx.scene.input.ScrollEvent")
jo = Args(0)
If jo.RunMethod("getDeltaY",Null) > 0 And scale <= 3 Then 'zoom in up to 3 times
scale = scale + 0.05
End If
If jo.RunMethod("getDeltaY",Null) < 0 And scale >= 0.2 Then 'zoom out up to 0.2 time
scale = scale - 0.05
End If
asJO(Editor).RunMethod("setScaleX",Array(scale))
asJO(Editor).RunMethod("setScaleY",Array(scale))
asJO(Editor).RunMethod("requestLayout",Null)
End Sub
Sub asJO(o As JavaObject) As JavaObject
Return o
End Sub