WebCola
Options
All
  • Public
  • Public/Protected
  • All
Menu

A D3 Zoom Behavior

The first generic refers to the type of reference element to which the zoom behavior is attached. The second generic refers to the type of the datum of the reference element.

Type parameters

Hierarchy

  • Function
    • ZoomBehavior

Callable

  • __call(selection: Selection<ZoomRefElement, Datum, any, any>, ...args: any[]): void
  • Applies this zoom behavior to the specified selection, binding the necessary event listeners to allow panning and zooming, and initializing the zoom transform on each selected element to the identity transform if not already defined. This function is typically not invoked directly, and is instead invoked via selection.call.

    For details see: https://github.com/d3/d3-zoom#_zoom

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • Rest ...args: any[]

      Optional arguments to be passed in.

    Returns void

Index

Properties

Function

Function: FunctionConstructor

arguments

arguments: any

caller

caller: Function

length

length: number

prototype

prototype: any

Methods

apply

  • apply(this: Function, thisArg: any, argArray?: any): any
  • Calls the function, substituting the specified object for the this value of the function, and the specified array for the arguments of the function.

    Parameters

    • this: Function
    • thisArg: any

      The object to be used as the this object.

    • Optional argArray: any

      A set of arguments to be passed to the function.

    Returns any

bind

  • bind(this: Function, thisArg: any, ...argArray: any[]): any
  • For a given function, creates a bound function that has the same body as the original function. The this object of the bound function is associated with the specified object, and has the specified initial parameters.

    Parameters

    • this: Function
    • thisArg: any

      An object to which the this keyword can refer inside the new function.

    • Rest ...argArray: any[]

      A list of arguments to be passed to the new function.

    Returns any

call

  • call(this: Function, thisArg: any, ...argArray: any[]): any
  • Calls a method of an object, substituting another object for the current object.

    Parameters

    • this: Function
    • thisArg: any

      The object to be used as the current object.

    • Rest ...argArray: any[]

      A list of arguments to be passed to the method.

    Returns any

duration

  • duration(): number
  • duration(duration: number)
  • Get the duration for zoom transitions on double-click and double-tap in milliseconds.

    Returns number

  • Set the duration for zoom transitions on double-click and double-tap to the specified number of milliseconds and returns the zoom behavior.

    To disable double-click and double-tap transitions, you can remove the zoom behavior’s dblclick event listener after applying the zoom behavior to the selection.

    Parameters

    • duration: number

extent

  • extent(): ValueFn
  • extent(extent: [[number, number], [number, number]])
  • extent(extent: ValueFn)
  • Return the current extent accessor, which defaults to [[0, 0], [width, height]] where width is the client width of the element and height is its client height; for SVG elements, the nearest ancestor SVG element’s width and height is used. In this case, the owner SVG element must have defined width and height attributes rather than (for example) relying on CSS properties or the viewBox attribute; SVG provides no programmatic method for retrieving the initial viewport size. Alternatively, consider using element.getBoundingClientRect. (In Firefox, element.clientWidth and element.clientHeight is zero for SVG elements!)

    Returns ValueFn

  • Set the viewport extent to the specified array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner of the viewport and [x1, y1] is the bottom-right corner of the viewport, and return this zoom behavior.

    The viewport extent affects several functions: the center of the viewport remains fixed during changes by zoom.scaleBy and zoom.scaleTo; the viewport center and dimensions affect the path chosen by d3.interpolateZoom; and the viewport extent is needed to enforce the optional translate extent.

    Parameters

    • extent: [[number, number], [number, number]]

      An extent specified as an array of two coordinates.

  • Set the viewport extent to the array of points [[x0, y0], [x1, y1]] returned by the extent accessor function, and return this zoom behavior. The extent accessor function is evaluated for each element.

    [x0, y0] is the top-left corner of the viewport and [x1, y1] is the bottom-right corner of the viewport.

    The viewport extent affects several functions: the center of the viewport remains fixed during changes by zoom.scaleBy and zoom.scaleTo; the viewport center and dimensions affect the path chosen by d3.interpolateZoom; and the viewport extent is needed to enforce the optional translate extent.

    The default is [[0, 0], [width, height]] where width is the client width of the element and height is its client height; for SVG elements, the nearest ancestor SVG element’s width and height is used. In this case, the owner SVG element must have defined width and height attributes rather than (for example) relying on CSS properties or the viewBox attribute; SVG provides no programmatic method for retrieving the initial viewport size. Alternatively, consider using element.getBoundingClientRect. (In Firefox, element.clientWidth and element.clientHeight is zero for SVG elements!)

    extent

    An extent accessor function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the extent array.

    Parameters

filter

  • Returns the current filter function.

    Returns ValueFn

  • Sets the filter to the specified filter function and returns the zoom behavior.

    If the filter returns falsey, the initiating event is ignored and no zoom gesture is started. Thus, the filter determines which input events are ignored. The default filter ignores mousedown events on secondary buttons, since those buttons are typically intended for other purposes, such as the context menu.

    Parameters

    • filterFn: ValueFn

      A filter function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a boolean value.

interpolate

  • interpolate<InterpolationFactory>(): InterpolationFactory
  • interpolate(interpolatorFactory: function)
  • Returns the current interpolation factory, which defaults to d3.interpolateZoom to implement smooth zooming.

    Type parameters

    • InterpolationFactory: function

    Returns InterpolationFactory

  • Sets the interpolation factory for zoom transitions to the specified function. Use the default d3.interpolateZoom to implement smooth zooming. To apply direct interpolation between two views, try d3.interpolate instead.

    Each view is defined as an array of three numbers: cx, cy and width. The first two coordinates cx, cy represent the center of the viewport; the last coordinate width represents the size of the viewport.

    Parameters

    • interpolatorFactory: function

      An interpolator factory to be used to generate interpolators beetween zooms for transitions.

on

  • on(typenames: string): ValueFn | undefined
  • on(typenames: string, listener: null)
  • on(typenames: string, listener: ValueFn)
  • Return the first currently-assigned listener matching the specified typenames, if any.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or end (after an active pointer becomes inactive [such as on mouseup].)

    Returns ValueFn | undefined

  • Remove the current event listeners for the specified typenames, if any, return the drag behavior.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or end (after an active pointer becomes inactive [such as on mouseup].)

    • listener: null

      Use null to remove the listener.

  • Set the event listener for the specified typenames and return the zoom behavior. If an event listener was already registered for the same type and name, the existing listener is removed before the new listener is added. When a specified event is dispatched, each listener will be invoked with the same context and arguments as selection.on listeners.

    Parameters

    • typenames: string

      The typenames is a string containing one or more typename separated by whitespace. Each typename is a type, optionally followed by a period (.) and a name, such as "drag.foo"" and "drag.bar"; the name allows multiple listeners to be registered for the same type. The type must be one of the following: start (after zooming begins [such as mousedown]), zoom (after a change to the zoom transform [such as mousemove], or end (after an active pointer becomes inactive [such as on mouseup].)

    • listener: ValueFn

      An event listener function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.

scaleBy

  • scaleBy(selection: Selection<ZoomRefElement, Datum, any, any>, k: number): void
  • scaleBy(selection: Selection<ZoomRefElement, Datum, any, any>, k: ValueFn): void
  • scaleBy(transition: TransitionLike<ZoomRefElement, Datum>, k: number): void
  • scaleBy(transition: TransitionLike<ZoomRefElement, Datum>, k: ValueFn): void
  • Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0) × k.

    k is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • k: number

      Scale factor.

    Returns void

  • Scales the current zoom transform of the selected elements by k, such that the new k(1) = k(0) × k.

    k is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • k: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the scale factor.

    Returns void

  • Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0) × k.

    k is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • k: number

      Scale factor.

    Returns void

  • Defines a “zoom” tween translating scaling the current transform of the selected elements by k, such that the new k(1) = k(0) × k.

    k is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • k: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the scale factor.

    Returns void

scaleExtent

  • scaleExtent(): [number, number]
  • scaleExtent(extent: [number, number])
  • Return the current scale extent.

    Returns [number, number]

  • Set the scale extent to the specified array of numbers [k0, k1] where k0 is the minimum allowed scale factor and k1 is the maximum allowed scale factor, and return this zoom behavior.

    The scale extent restricts zooming in and out. It is enforced on interaction and when using zoom.scaleBy, zoom.scaleTo and zoom.translateBy; however, it is not enforced when using zoom.transform to set the transform explicitly.

    The default scale extent is [0, infinity].

    If the user tries to zoom by wheeling when already at the corresponding limit of the scale extent, the wheel events will be ignored and not initiate a zoom gesture. This allows the user to scroll down past a zoomable area after zooming in, or to scroll up after zooming out. If you would prefer to always prevent scrolling on wheel input regardless of the scale extent, register a wheel event listener to prevent the browser default behavior

    Parameters

    • extent: [number, number]

      A scale extent array of two numbers representing the scale boundaries.

scaleTo

  • scaleTo(selection: Selection<ZoomRefElement, Datum, any, any>, k: number): void
  • scaleTo(selection: Selection<ZoomRefElement, Datum, any, any>, k: ValueFn): void
  • scaleTo(transition: TransitionLike<ZoomRefElement, Datum>, k: number): void
  • scaleTo(transition: TransitionLike<ZoomRefElement, Datum>, k: ValueFn): void
  • Scales the current zoom transform of the selected elements to k, such that the new k(1) = k.

    k is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • k: number

      New scale.

    Returns void

  • Scales the current zoom transform of the selected elements to k, such that the new k(1) = k.

    k is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • k: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the new scale.

    Returns void

  • Defines a “zoom” tween translating scaling the current transform of the selected elements to k, such that the new k(1) = k.

    k is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • k: number

      New scale.

    Returns void

  • Defines a “zoom” tween translating scaling the current transform of the selected elements to k, such that the new k(1) = k.

    k is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • k: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the new scale.

    Returns void

toString

  • toString(): string
  • Returns a string representation of a function.

    Returns string

transform

  • transform(selection: Selection<ZoomRefElement, Datum, any, any>, transform: ZoomTransform): void
  • transform(selection: Selection<ZoomRefElement, Datum, any, any>, transform: ValueFn): void
  • transform(transition: TransitionLike<ZoomRefElement, Datum>, transform: ZoomTransform): void
  • transform(transition: TransitionLike<ZoomRefElement, Datum>, transform: ValueFn): void
  • Sets the current zoom transform of the selected elements to the specified transform, instantaneously emitting start, zoom and end events.

    This method requires that you specify the new zoom transform completely, and does not enforce the defined scale extent and translate extent, if any. To derive a new transform from the existing transform, and to enforce the scale and translate extents, see the convenience methods zoom.translateBy, zoom.scaleBy and zoom.scaleTo.

    This function is typically not invoked directly, and is instead invoked via selection.call.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • transform: ZoomTransform

      A zoom transform object.

    Returns void

  • Sets the current zoom transform of the selected elements to the transform returned by the specified zoom transform factory function evaluated for each element, instantaneously emitting start, zoom and end events.

    This method requires that you specify the new zoom transform completely, and does not enforce the defined scale extent and translate extent, if any. To derive a new transform from the existing transform, and to enforce the scale and translate extents, see the convenience methods zoom.translateBy, zoom.scaleBy and zoom.scaleTo.

    This function is typically not invoked directly, and is instead invoked via selection.call.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • transform: ValueFn

      A zoom transform factory function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a zoom transform object.

    Returns void

  • Sets the current zoom transform of the transitioning elements to the specified transform. It defines a “zoom” tween to the specified transform using d3.interpolateZoom, emitting a start event when the transition starts, zoom events for each tick of the transition, and then an end event when the transition ends (or is interrupted).

    This method requires that you specify the new zoom transform completely, and does not enforce the defined scale extent and translate extent, if any. To derive a new transform from the existing transform, and to enforce the scale and translate extents, see the convenience methods zoom.translateBy, zoom.scaleBy and zoom.scaleTo.

    This function is typically not invoked directly, and is instead invoked via selection.call.

    Parameters

    Returns void

  • Sets the current zoom transform of the transitioning elements to the transform returned by the specified zoom transform factory function evaluated for each element. It defines a “zoom” tween to the specified transform using d3.interpolateZoom, emitting a start event when the transition starts, zoom events for each tick of the transition, and then an end event when the transition ends (or is interrupted).

    This method requires that you specify the new zoom transform completely, and does not enforce the defined scale extent and translate extent, if any. To derive a new transform from the existing transform, and to enforce the scale and translate extents, see the convenience methods zoom.translateBy, zoom.scaleBy and zoom.scaleTo.

    This function is typically not invoked directly, and is instead invoked via selection.call.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • transform: ValueFn

      A zoom transform factory function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element. The function returns a zoom transform object.

    Returns void

translateBy

  • translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: number): void
  • translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn, y: number): void
  • translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: number, y: ValueFn): void
  • translateBy(selection: Selection<ZoomRefElement, Datum, any, any>, x: ValueFn, y: ValueFn): void
  • translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: number): void
  • translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn, y: number): void
  • translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: number, y: ValueFn): void
  • translateBy(transition: TransitionLike<ZoomRefElement, Datum>, x: ValueFn, y: ValueFn): void
  • Translates the current zoom transform of the selected elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided as a constant for all elements. y is provided as a constant for all elements.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • x: number

      Amount of translation in x-direction.

    • y: number

      Amount of translation in y-direction.

    Returns void

  • Translates the current zoom transform of the selected elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided by a value function evaluated for each element in the selection. y is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • x: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in x-direction.

    • y: number

      Amount of translation in y-direction.

    Returns void

  • Translates the current zoom transform of the selected elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided as a constant for all elements. y is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • x: number

      Amount of translation in x-direction.

    • y: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in y-direction.

    Returns void

  • Translates the current zoom transform of the selected elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided by a value function evaluated for each element in the selection. y is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • selection: Selection<ZoomRefElement, Datum, any, any>

      A D3 selection of elements.

    • x: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in x-direction.

    • y: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in y-direction.

    Returns void

  • Defines a “zoom” tween translating the current transform for the transitioning elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided as a constant for all elements. y is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • x: number

      Amount of translation in x-direction.

    • y: number

      Amount of translation in y-direction.

    Returns void

  • Defines a “zoom” tween translating the current transform for the transitioning elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided by a value function evaluated for each element in the selection. y is provided as a constant for all elements.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • x: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in x-direction.

    • y: number

      Amount of translation in y-direction.

    Returns void

  • Defines a “zoom” tween translating the current transform for the transitioning elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided as a constant for all elements. y is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • x: number

      Amount of translation in x-direction.

    • y: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in y-direction.

    Returns void

  • Defines a “zoom” tween translating the current transform for the transitioning elements by x and y, such that the new t(x1) = t(x0) + k × x and t(y1) = t(y0) + k × y.

    x is provided by a value function evaluated for each element in the selection. y is provided by a value function evaluated for each element in the selection.

    This method is a convenience method for zoom.transform. In contrast to zoom.transform, however, it is subject to the constraints imposed by zoom.extent, zoom.scaleExten, and zoom.translateExtent.

    Parameters

    • transition: TransitionLike<ZoomRefElement, Datum>

      A D3 transition on elements.

    • x: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in x-direction.

    • y: ValueFn

      A value function which is evaluated for each selected element, in order, being passed the current datum (d), the current index (i), and the current group (nodes), with this as the current DOM element.The function returns the amount of translation in y-direction.

    Returns void

translateExtent

  • translateExtent(): [[number, number], [number, number]]
  • translateExtent(extent: [[number, number], [number, number]])
  • Return the current translate extent.

    Returns [[number, number], [number, number]]

  • Set the translate extent to the specified array of points [[x0, y0], [x1, y1]], where [x0, y0] is the top-left corner of the world and [x1, y1] is the bottom-right corner of the world, and return this zoom behavior.

    The translate extent restricts panning, and may cause translation on zoom out. It is enforced on interaction and when using zoom.scaleBy, zoom.scaleTo and zoom.translateBy; however, it is not enforced when using zoom.transform to set the transform explicitly.

    The default scale extent is [[-infinity, infinity], [-infinity, infinity]].

    Parameters

    • extent: [[number, number], [number, number]]

      A translate extent array, i.e. an array of two arrays, each representing a point.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc