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: 24
Registered: April 2012
Junior 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: 35
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: 35
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: 235
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: Sat Sep 22 10:43:09 GMT 2018

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

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

Back to the top