# Generated by detroit
# See https://github.com/bourbonut/detroit/tree/main/api_maker

from functools import partial
from operator import is_not

class zoom:
    def __init__(self, content="zoom"):
        self.content = content

    def __repr__(self):
        return self.content

    def __str__(self):
        return self.content

    def __call__(self, *args):
        arguments = ", ".join(map(repr, args))
        return f"{self}({arguments})"

    def transform(self, selection=None, transform=None, point=None):
        """
        Source · If selection is a selection, sets the current zoom transform of the selected
        elements to the specified transform, instantaneously emitting start, zoom and end
        events.
        If selection is a transition, defines a “zoom” tween to the specified transform using
        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). The transition will attempt to minimize the visual movement around the
        specified point; if the point is not specified, it defaults to the center of the
        viewport extent.
        The transform may be specified either as a zoom transform or as a function that returns
        a zoom transform; similarly, the point may be specified either as a two-element array
        [x, y] or a function that returns such an array. If a function, it is invoked for each
        selected element, being passed the current event (event) and datum d, with the this
        context as the current DOM element.
        This function is typically not invoked directly, and is instead invoked via
        selection.call or transition.call. For example, to reset the zoom transform to the
        identity transform instantaneously:
        .. code:: javascript

            selection.call(zoom.transform, d3.zoomIdentity);

        To smoothly reset the zoom transform to the identity transform over 750 milliseconds:
        .. code:: javascript

            selection.transition().duration(750).call(zoom.transform, d3.zoomIdentity);

        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.

        See more informations `here <https://d3js.org/d3-zoom#zoom_transform>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (selection, transform, point))))
        return zoom(content=f"{self.content}.transform({arguments})")


    def translateBy(self, selection=None, x=None, y=None):
        """
        Source · If selection is a selection, translates the current zoom transform of the
        selected elements by x and y, such that the new tx1 = tx0 + kx and ty1 = ty0 + ky. If
        selection is a transition, defines a “zoom” tween translating the current transform.
        This method is a convenience method for zoom.transform. The x and y translation amounts
        may be specified either as numbers or as functions that return numbers. If a function,
        it is invoked for each selected element, being passed the current datum d and index i,
        with the this context as the current DOM element.

        See more informations `here <https://d3js.org/d3-zoom#zoom_translateBy>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (selection, x, y))))
        return zoom(content=f"{self.content}.translateBy({arguments})")


    def translateTo(self, selection=None, x=None, y=None, p=None):
        """
        Source · If selection is a selection, translates the current zoom transform of the
        selected elements such that the given position ⟨x,y⟩ appears at given point p. The new
        tx = px - kx and ty = py - ky. If p is not specified, it defaults to the center of the
        viewport extent. If selection is a transition, defines a “zoom” tween translating the
        current transform. This method is a convenience method for zoom.transform. The x and y
        coordinates may be specified either as numbers or as functions that returns numbers;
        similarly the p point may be specified either as a two-element array [px,py] or a
        function. If a function, it is invoked for each selected element, being passed the
        current datum d and index i, with the this context as the current DOM element.

        See more informations `here <https://d3js.org/d3-zoom#zoom_translateTo>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (selection, x, y, p))))
        return zoom(content=f"{self.content}.translateTo({arguments})")


    def scaleBy(self, selection=None, k=None, p=None):
        """
        Source · If selection is a selection, scales the current zoom transform of the selected
        elements by k, such that the new k₁ = k₀k. The reference point p does move. If p is not
        specified, it defaults to the center of the viewport extent. If selection is a
        transition, defines a “zoom” tween translating the current transform. This method is a
        convenience method for zoom.transform. The k scale factor may be specified either as a
        number or a function that returns a number; similarly the p point may be specified
        either as a two-element array [px,py] or a function. If a function, it is invoked for
        each selected element, being passed the current datum d and index i, with the this
        context as the current DOM element.

        See more informations `here <https://d3js.org/d3-zoom#zoom_scaleBy>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (selection, k, p))))
        return zoom(content=f"{self.content}.scaleBy({arguments})")


    def scaleTo(self, selection=None, k=None, p=None):
        """
        Source · If selection is a selection, scales the current zoom transform of the selected
        elements to k, such that the new k₁ = k. The reference point p does move. If p is not
        specified, it defaults to the center of the viewport extent. If selection is a
        transition, defines a “zoom” tween translating the current transform. This method is a
        convenience method for zoom.transform. The k scale factor may be specified either as a
        number or a function that returns a number; similarly the p point may be specified
        either as a two-element array [px,py] or a function. If a function, it is invoked for
        each selected element, being passed the current datum d and index i, with the this
        context as the current DOM element.

        See more informations `here <https://d3js.org/d3-zoom#zoom_scaleTo>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (selection, k, p))))
        return zoom(content=f"{self.content}.scaleTo({arguments})")


    def constrain(self, constrain=None):
        """
        Source · If constrain is specified, sets the transform constraint function to the
        specified function and returns the zoom behavior. If constrain is not specified,
        returns the current constraint function, which defaults to:
        .. code:: javascript

            function constrain(transform, extent, translateExtent) {
              var dx0 = transform.invertX(extent[0][0]) - translateExtent[0][0],
                  dx1 = transform.invertX(extent[1][0]) - translateExtent[1][0],
                  dy0 = transform.invertY(extent[0][1]) - translateExtent[0][1],
                  dy1 = transform.invertY(extent[1][1]) - translateExtent[1][1];
              return transform.translate(
                dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1),
                dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1)
              );
            }

        The constraint function must return a [transform]#zoomTransform) given the current
        transform, viewport extent and translate extent. The default implementation attempts to
        ensure that the viewport extent does not go outside the translate extent.

        See more informations `here <https://d3js.org/d3-zoom#zoom_constrain>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (constrain,))))
        return zoom(content=f"{self.content}.constrain({arguments})")


    def filter(self, filter=None):
        """
        Source · If filter is specified, sets the filter to the specified function and returns
        the zoom behavior. If filter is not specified, returns the current filter, which
        defaults to:
        .. code:: javascript

            function filter(event) {
              return (!event.ctrlKey || event.type === 'wheel') && !event.button;
            }

        The filter is passed the current event (event) and datum d, with the this context as
        the current DOM element. If the filter returns falsey, the initiating event is ignored
        and no zoom gestures are 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.

        See more informations `here <https://d3js.org/d3-zoom#zoom_filter>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (filter,))))
        return zoom(content=f"{self.content}.filter({arguments})")


    def touchable(self, touchable=None):
        """
        Source · If touchable is specified, sets the touch support detector to the specified
        function and returns the zoom behavior. If touchable is not specified, returns the
        current touch support detector, which defaults to:
        .. code:: javascript

            function touchable() {
              return navigator.maxTouchPoints || ("ontouchstart" in this);
            }

        Touch event listeners are only registered if the detector returns truthy for the
        corresponding element when the zoom behavior is applied. The default detector works
        well for most browsers that are capable of touch input, but not all; Chrome’s mobile
        device emulator, for example, fails detection.

        See more informations `here <https://d3js.org/d3-zoom#zoom_touchable>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (touchable,))))
        return zoom(content=f"{self.content}.touchable({arguments})")


    def wheelDelta(self, delta=None):
        """
        Source · If delta is specified, sets the wheel delta function to the specified function
        and returns the zoom behavior. If delta is not specified, returns the current wheel
        delta function, which defaults to:
        .. code:: javascript

            function wheelDelta(event) {
              return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002) * (event.ctrlKey ? 10 : 1);
            }

        The value Δ returned by the wheel delta function determines the amount of scaling
        applied in response to a WheelEvent. The scale factor transform.k is multiplied by 2Δ;
        for example, a Δ of +1 doubles the scale factor, Δ of -1 halves the scale factor.

        See more informations `here <https://d3js.org/d3-zoom#zoom_wheelDelta>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (delta,))))
        return zoom(content=f"{self.content}.wheelDelta({arguments})")


    def extent(self, extent=None):
        """
        Source · If extent is specified, sets 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 returns this zoom behavior.
        The extent may also be specified as a function which returns such an array; if a
        function, it is invoked for each selected element, being passed the current datum d,
        with the this context as the current DOM element.
        If extent is not specified, returns 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 viewBox, or width
        and height attributes, are used. Alternatively, consider using
        element.getBoundingClientRect.
        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 interpolateZoom; and the viewport extent is needed to enforce
        the optional translate extent.

        See more informations `here <https://d3js.org/d3-zoom#zoom_extent>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (extent,))))
        return zoom(content=f"{self.content}.extent({arguments})")


    def scaleExtent(self, extent=None):
        """
        Source · If extent is specified, sets 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 returns this zoom behavior. If extent is not specified,
        returns the current scale extent, which defaults to [0, ∞]. 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.
        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:
        .. code:: javascript

            selection
                .call(zoom)
                .on("wheel", event => event.preventDefault());


        See more informations `here <https://d3js.org/d3-zoom#zoom_scaleExtent>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (extent,))))
        return zoom(content=f"{self.content}.scaleExtent({arguments})")


    def translateExtent(self, extent=None):
        """
        Source · If extent is specified, sets 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 returns this zoom behavior. If
        extent is not specified, returns the current translate extent, which defaults to [[-∞,
        -∞], [+∞, +∞]]. 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.

        See more informations `here <https://d3js.org/d3-zoom#zoom_translateExtent>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (extent,))))
        return zoom(content=f"{self.content}.translateExtent({arguments})")


    def clickDistance(self, distance=None):
        """
        Source · If distance is specified, sets the maximum distance that the mouse can move
        between mousedown and mouseup that will trigger a subsequent click event. If at any
        point between mousedown and mouseup the mouse is greater than or equal to distance from
        its position on mousedown, the click event following mouseup will be suppressed. If
        distance is not specified, returns the current distance threshold, which defaults to
        zero. The distance threshold is measured in client coordinates (event.clientX and
        event.clientY).

        See more informations `here <https://d3js.org/d3-zoom#zoom_clickDistance>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (distance,))))
        return zoom(content=f"{self.content}.clickDistance({arguments})")


    def tapDistance(self, distance=None):
        """
        Source · If distance is specified, sets the maximum distance that a double-tap gesture
        can move between first touchstart and second touchend that will trigger a subsequent
        double-click event. If distance is not specified, returns the current distance
        threshold, which defaults to 10. The distance threshold is measured in client
        coordinates (event.clientX and event.clientY).

        See more informations `here <https://d3js.org/d3-zoom#zoom_tapDistance>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (distance,))))
        return zoom(content=f"{self.content}.tapDistance({arguments})")


    def duration(self, duration=None):
        """
        Source · If duration is specified, sets the duration for zoom transitions on
        double-click and double-tap to the specified number of milliseconds and returns the
        zoom behavior. If duration is not specified, returns the current duration, which
        defaults to 250 milliseconds. If the duration is not greater than zero, double-click
        and -tap trigger instantaneous changes to the zoom transform rather than initiating
        smooth transitions.
        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:
        .. code:: javascript

            selection
                .call(zoom)
                .on("dblclick.zoom", null);


        See more informations `here <https://d3js.org/d3-zoom#zoom_duration>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (duration,))))
        return zoom(content=f"{self.content}.duration({arguments})")


    def interpolate(self, interpolate=None):
        """
        Source · If interpolate is specified, sets the interpolation factory for zoom
        transitions to the specified function. If interpolate is not specified, returns the
        current interpolation factory, which defaults to interpolateZoom to implement smooth
        zooming. To apply direct interpolation between two views, try interpolate instead.

        See more informations `here <https://d3js.org/d3-zoom#zoom_interpolate>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (interpolate,))))
        return zoom(content=f"{self.content}.interpolate({arguments})")


    def on(self, typenames=None, listener=None):
        """
        Source · If listener is specified, sets the event listener for the specified typenames
        and returns 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. If
        listener is null, removes the current event listeners for the specified typenames, if
        any. If listener is not specified, returns the first currently-assigned listener
        matching the specified typenames, if any. When a specified event is dispatched, each
        listener will be invoked with the same context and arguments as selection.on listeners:
        the current event (event) and datum d, with the this context as the current DOM
        element.
        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 zoom.foo
        and zoom.bar; the name allows multiple listeners to be registered for the same type.
        The type must be one of the following:
        See dispatch.on for more.

        See more informations `here <https://d3js.org/d3-zoom#zoom_on>`_.
        """
        arguments = ", ".join(map(repr, filter(partial(is_not, None), (typenames, listener))))
        return zoom(content=f"{self.content}.on({arguments})")

