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.
Name | Summary |
---|---|
createZoomer | Creates 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 Usage | Arguments | Return Value |
---|---|---|
var zoomer = zs.createZoomer(opts ); |
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 Usage | Arguments | Return Value |
zoomer.panZoom(translate , scale ); |
| none, but the view will be zoomed |
zoomer.reset(); | none | none, but resets the pan and zoom levels back to default |
zoomer.translate(); | none | the current translation vector |
zoomer.scale(); | none | the current zoom scale |
zoomer.scaleExtent(); | none | the current zoom scale's range |