Navigation
You can navigate through the following ways:- Mouse Scroll
- Pan
- Zoom
Mouse Scroll
The dafault mouseScrool(mousescroll event) option is zoom.To disable zoom, you need to set another option.
Vertical and Horizontal scroll
Set mouseScrool option to FamilyTree.action.scroll and you will be able to navigate with the mouse:
- Scroll up/down
- Press Shift key to sroll left/right
- On Apple Magic Mouse or Logitech G502 you can scroll left/right/up/down without pressing the Shift key
Add scroll bars with the options showXScroll: FamilyTree.scroll.visible and showYScroll: FamilyTree.scroll.visible
Horizontal scroll only
In order to enable horizontal scroll bar set showXScroll to FamilyTree.scroll.visible. Aslo you have an option to use the mouse scroll set mouseScrool to FamilyTree.action.xScroll. Here is an example:
Vertical scroll only
Now set the showYScroll to FamilyTree.scroll.visible and chage mouseScrool to FamilyTree.action.yScroll
Scroll sensitivity
To increase or decrease sroll sensitivity change FamilyTree.scroll.smooth and FamilyTree.scroll.speed constants, the default values are:
FamilyTree.scroll.smooth = 12; FamilyTree.scroll.speed = 12;Also you can change the sroll sensitivity for a specific browser. For example:
FamilyTree.scroll.safari = { smooth: 12, speed: 500 }; FamilyTree.scroll.ie = { smooth: 12, speed: 200 }; FamilyTree.scroll.edge = { smooth: 12, speed: 200 }; FamilyTree.scroll.chrome = { smooth: 12, speed: 200 }; FamilyTree.scroll.firefox = { smooth: 12, speed: 200 }; FamilyTree.scroll.opera = { smooth: 12, speed: 200 };
Pan
Pan/move, left-click and hold mouse button in the FamilyTree JS and drag the mouse in any direction. You cannot disable the Pan navigation.
Zoom
Chage mouseScrool to FamilyTree.action.zoom. Here is the result:
Ctrl + Zoom
Chage mouseScrool to FamilyTree.action.ctrlZoom. Here is the result:
Toolbar
You can use the Toolbar buttons to change the zoom:
Mini map
Show mini map over the tree.
Set miniMap option to true.Mini map properties
You have several properties for the mini map, that you can set:
- colors - array of colors that are set for the different subtree levels
- selectorBackgroundColor - the "background" color in the mini map
- focusStroke - the color of the focus rectangle stroke
- opacity - number from 0 to 1 - the opacity of the "background"
- border - the CSS bodred definition of the mini map
- width - width in pixels
- height - height in pixels
- padding - padding of the mini map in pixels
- position - object with top, left, right and bottom properties to position the mini map. You can use 'padding', undefined or pixels
- draggable - boolean - the default value is true
Moving the tree programmatically
You can move the tree programmatically using the methods moveStart and moveEnd
Here is how you can move it holding a button down:
Here is how you can move it by starting and stopping the function:
Moving nodes to the visible area
You can use the moveNodesToVisibleArea method to move array of nodes to the visible area.
Here is a code demo, where we move nodes with ids 10 and 12 in the visible area: