# Using the Template Canvas as a work-around for Zoom

**URL:** <https://forum.inductiveautomation.com/t/using-the-template-canvas-as-a-work-around-for-zoom/42774>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [January 29, 2021, 10:55pm UTC](https://forum.inductiveautomation.com/t/using-the-template-canvas-as-a-work-around-for-zoom/42774 "2021-01-29T22:55:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![pdc5067](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@pdc5067](https://forum.inductiveautomation.com/u/pdc5067)\
**Post date:** [February 1, 2021, 11:13pm UTC](https://forum.inductiveautomation.com/t/using-the-template-canvas-as-a-work-around-for-zoom/42774/2 "2021-02-01T23:13:55Z")

</div>

I have noticed several forum posts on similar topics:

> [@Template Canvas set scrollbar position?](http://forum.inductiveautomation.com/t/template-canvas-set-scrollbar-position/15752):
>
> I have a number of templates in a template canvas, and depending on the active process I want to “jump” to the position of a specific template in the canvas when the window is opened. If you navigate away from a window that has the canvas, and back again the canvas scrollbar resets back to a 0 reference, trying to prevent the need for an operator to scroll through the canvas should they navigate to another screen. I’d like something like this on a window opened script: if template1 active: …

> [@Template Canvas Help](http://forum.inductiveautomation.com/t/template-canvas-help/30671):
>
> 7.8.5 Reaching out to anyone that might shed some light on my project. I currently have a custom SVG of a map that is set on a Template Canvas in which I am changing the map dimensions by way of a mouse scroll using the MouseWheelListener() in the event handler of the main screen using the internalFrameActivated. from javax.swing import SwingUtilities from javax.swing import JScrollPane from java.awt.event import MouseWheelEvent from java.awt.event import MouseWheelListener class DebugMouseWh…

> [@Scroll bar is slow](http://forum.inductiveautomation.com/t/scroll-bar-is-slow/5043):
>
> I have noticed if I make window’s height very tall so there is a scroll bar on the right when a user uses the mouse wheel to scroll the scroll bar barely moves. Is there a way to speed up the mouse wheel scroll on tall windows? Thank you,

> [@Scroll bar is slow for repeaters](http://forum.inductiveautomation.com/t/scroll-bar-is-slow-for-repeaters/9724):
>
> So there’s a post from 2012 regarding this exact issue. But here I am in 2015 with the same issue but for the scrollbar on my template repeater. The final suggestion was: [code] #increases scroll bar speed from javax.swing import SwingUtilities from javax.swing import JScrollPane scrollPane = SwingUtilities.getAncestorOfClass(JScrollPane, event.source) scrollPane.getVerticalScrollBar().setUnitIncrement(10)[/code] and my implementation: [code]#increases scroll bar speed from javax.swin…

But there has only been solutions to scrollbar incrementing. This is my solution to the "focus" or "Jump-to" issue....

```python
from java.awt import Point
def TemplateCanvas_Focus():
	canvas = event.source.parent.parent.getComponent("Template Canvas")
	#### this is the java JScrollPane class... we can use any methods associated with JScrollPane here####
	scrollPane = canvas.getComponents()[2]
	####this is the java JSViewport class... we can use any methods associated with JViewport here####
	viewPort = scrollPane.getViewport()	
	
	if event.source.parent.getComponent('Dropdown for Zoom').selectedLabel == 'Full Screen':
		setViewPositionX = 0
		setViewPositionY = 0
	elif event.source.parent.getComponent('Dropdown for Zoom').selectedLabel == '75%':
		setViewPositionX = 0
		setViewPositionY = 350
	elif event.source.parent.getComponent('Dropdown for Zoom').selectedLabel == '100%':
		setViewPositionX = 250
		setViewPositionY = 500
	elif event.source.parent.getComponent('Dropdown for Zoom').selectedLabel == '200%':
		setViewPositionX = 1000
		setViewPositionY = 1000
	elif event.source.parent.getComponent('Dropdown for Zoom').selectedLabel == 'Max Zoom':
		setViewPositionX = 1500
		setViewPositionY = 1500
	
	
	viewPort.setViewPosition(Point(setViewPositionX,setViewPositionY))

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/using-the-template-canvas-as-a-work-around-for-zoom/42774)._
