Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to pan an FXCanvas
How to pan an FXCanvas [message #1774047] Mon, 09 October 2017 18:15 Go to next message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 41
Registered: April 2012
Member
I have an FXCanvas object and I want to tell it to pan right 30 pixels. How can I do that?

Thanks,
Ken
Re: How to pan an FXCanvas [message #1774123 is a reply to message #1774047] Tue, 10 October 2017 18:44 Go to previous messageGo to next message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 38
Registered: September 2009
Member
I should have mentioned that I thought this would do the trick, but it does not seem to update the position of the canvas at all:

Rectangle rect = canvas.getClientArea();
canvas.scroll(30, 0, 0, 0, rect.width, rect.height, false);
Re: How to pan an FXCanvas [message #1774318 is a reply to message #1774123] Thu, 12 October 2017 18:56 Go to previous messageGo to next message
Ken Keefe is currently offline Ken KeefeFriend
Messages: 38
Registered: September 2009
Member
I found how to scroll. Here's a snippet that shows what I wanted to do:

		infiniteCanvasViewer = (InfiniteCanvasViewer)domain.getAdapter(AdapterKey.get(IViewer.class, IDomain.CONTENT_VIEWER_ROLE));
		
		// query ViewportPolicy
		ViewportPolicy viewportPolicy = infiniteCanvasViewer.getRootPart()
				.getAdapter(ViewportPolicy.class);

		viewportPolicy.init();
		viewportPolicy.scroll(false, changeInX, 0);
		viewportPolicy.commit();
Re: How to pan an FXCanvas [message #1775361 is a reply to message #1774318] Sat, 28 October 2017 11:12 Go to previous message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 244
Registered: July 2009
Location: Lünen
Senior Member
Take a look into the ViewPortPolicy and the related handlers, e.g. PanOrZoomOnScrollHandler. It provides examples for how scrolling can be performed using an InfiniteCanvasViewer.

[Updated on: Sat, 28 October 2017 11:13]

Report message to a moderator

Previous Topic:GEF Context Menu Caching Language Preference
Next Topic:Do you have plans when support DOT Graph view display?
Goto Forum:
  


Current Time: Thu Mar 28 21:43:54 GMT 2024

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

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

Back to the top