Page tree

Have questions? Stuck? Please check our FAQ for some common questions and answers.

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

This page is a work in progress.

ZoomService

ZoomService is an Angular Factory in the SVG module with the name zoom.js. It creates an API (based on user settings) that allows the SVG Topology View layer (managed by d3) to zoom in and out. To use this API, see the documentation on injecting Angular services.

NameSummary
createZoomerCreates the ability to zoom on the given SVG layer and returns an API to control the zoom.

Function Descriptions

createZoomer

Creates the ability to zoom on the given SVG layer and returns an API to control the zoom.

Example UsageArgumentsReturn Value
var zoomer = zs.createZoomer(opts);

opts - an object containing:

svg: <d3 selection of svg element>

zoomLayer: <d3 selection of g element, child of svg element>

zoomEnabled: (optional) function reference that returns truthy values when zoom should be enabled and falsy values otherwise

zoomCallback: (optional) function reference to be called when the layer is zoomed

an object containing an API, see below
Returned API Example UsageArgumentsReturn Value
zoomer.panZoom(translate, scale);

translate - an array which is the zoom translation vector that you want to translate to

scale - a Number which is the scale that you want to zoom in to

none, but the view will be zoomed
zoomer.reset();nonenone, but resets the pan and zoom levels back to default
zoomer.translate();nonethe current translation vector
zoomer.scale();nonethe current zoom scale
zoomer.scaleExtent();nonethe current zoom scale's range
  • No labels