Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » [GEF4] ZoomEvent listener
[GEF4] ZoomEvent listener [message #1699355] Tue, 23 June 2015 14:44 Go to next message
Sylvain Bi is currently offline Sylvain BiFriend
Messages: 10
Registered: May 2015
Junior Member
I am trying to catch the zoom event on my FXView (to later set a stroke width more fin on hight zoom level)

here it's my code :

import org.eclipse.gef4.mvc.fx.ui.parts.FXView;

import javafx.scene.input.ZoomEvent;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;

...

public class MyView extends FXView {

	...
	
	@Override
	public void createPartControl(Composite parent) {
		super.createPartControl(parent);

		getViewer().getScene().addEventHandler(ZoomEvent.ZOOM, new EventHandler<ZoomEvent>() {

			@Override
			public void handle(ZoomEvent event) {
				System.out.println("zoom zoom zoom");
			}
		});
	}
}


I saw that fire event are thrown in GEF4 code, but I don't have any event caught with my code. Some ideas?
Re: [GEF4] ZoomEvent listener [message #1699372 is a reply to message #1699355] Tue, 23 June 2015 18:45 Go to previous messageGo to next message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
There are actually three zoom events of relevance and they may simply be consumed by using our FXPinchSpreadGesture (you can see its usage within FXPinchSpreadTool). Please note that these zoom events are actually pinch/spread gesture events, so they are only created when you are working on a device that supports touch. You can simply test whether these events are actually raised on your system by trying out the https://wiki.eclipse.org/GEF/GEF4/FX/Examples#SwtToFXGestureConversionDemo.

Independent of the event handler problem, zoom may result not only result from pinch/spread gesture events but also from others (if you e.g. have an FXZoomOnScrollPolicy registered). To support your use case I would that recommend not to register a zoom event handler, but to rather bind a specialized FXChangeViewportPolicy, which will be notified about zoom changes (and is the right place to react to them as you describe).
Re: [GEF4] ZoomEvent listener [message #1699500 is a reply to message #1699372] Wed, 24 June 2015 15:27 Go to previous message
Sylvain Bi is currently offline Sylvain BiFriend
Messages: 10
Registered: May 2015
Junior Member
Ok the zoom listener works thanks to the zoom policy. thank you!

[Updated on: Thu, 22 October 2015 09:10]

Report message to a moderator

Previous Topic:HorizontalTreeLayoutAlgorithm displays disconnected graphs over each other
Next Topic:Auto-exposure/Auto-Scroll - snapping back (GEF 3.8.2)
Goto Forum:
  


Current Time: Tue Mar 19 09:50:07 GMT 2024

Powered by FUDForum. Page generated in 0.02586 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top