Class Zoomist

java.lang.Object
com.vaadin.flow.component.Component
com.flowingcode.vaadin.addons.zoomist.Zoomist
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

@NpmPackage(value="zoomist",version="1.1.1") @NpmPackage(value="sass",version="1.66.1") @JsModule("./zoomist/fc-zoomist.ts") @Tag("fc-zoomist") public class Zoomist extends com.vaadin.flow.component.Component
This component is a wrapper for Zoomist Component (https://npm.io/package/zoomist)
Author:
Felipe Lang / Flowing Code
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance of Zoomist for the specified source url.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.vaadin.flow.shared.Registration
    addDragEndListener(com.vaadin.flow.component.ComponentEventListener<DragEndEvent> listener)
    Adds a DragEndEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addDragListener(com.vaadin.flow.component.ComponentEventListener<DragEvent> listener)
    Adds a DragEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addDragStartListener(com.vaadin.flow.component.ComponentEventListener<DragStartEvent> listener)
    Adds a DragStartEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addPinchEndListener(com.vaadin.flow.component.ComponentEventListener<PinchEndEvent> listener)
    Adds a PinchEndEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addPinchListener(com.vaadin.flow.component.ComponentEventListener<PinchEvent> listener)
    Adds a PinchEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addPinchStartListener(com.vaadin.flow.component.ComponentEventListener<PinchStartEvent> listener)
    Adds a PinchStartEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addReadyListener(com.vaadin.flow.component.ComponentEventListener<ReadyEvent> listener)
    Adds a ReadyEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addResizeListener(com.vaadin.flow.component.ComponentEventListener<ResizeEvent> listener)
    Adds a ResizeEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addSlideEndListener(com.vaadin.flow.component.ComponentEventListener<SlideEndEvent> listener)
    Adds a SlideEndEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addSlideListener(com.vaadin.flow.component.ComponentEventListener<SlideEvent> listener)
    Adds a SlideEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addSlideStartListener(com.vaadin.flow.component.ComponentEventListener<SlideStartEvent> listener)
    Adds a SlideStartEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addWheelListener(com.vaadin.flow.component.ComponentEventListener<WheelEvent> listener)
    Adds a WheelEvent listener to zoomist.
    com.vaadin.flow.shared.Registration
    addZoomListener(com.vaadin.flow.component.ComponentEventListener<ZoomEvent> listener)
    Adds a ZoomEvent listener to zoomist.
    void
    getContainerData(com.vaadin.flow.function.SerializableConsumer<ContainerData> consumer)
    Gets the width, height and aspectRatio of the container.
    com.flowingcode.vaadin.addons.zoomist.Zoomist.Fill
    Returns the image fill type.
    Returns the height of the container.
    double
    Returns the max ratio of the image.
    double
    Returns the ratio of a zoom.
    boolean
    Returnd if image can be drag out of bounds or not.
    boolean
    Returns if image is draggable or not.
    boolean
    Returns if image is pinchable or not.
    boolean
    Returns if slider is visible
    boolean
    Returns if image is wheelable or not.
    boolean
    Returns if zoomer is visible
    void
    move(double x, double y)
    Moves the image with a relative position.
    void
    moveTo(double x, double y)
    Moves the image with a absolute position.
    void
    Resets the image to initial state.
    void
    setBounds(boolean bounds)
    Sets whether image can be drag out of bounds or not.
    void
    setDraggable(boolean draggable)
    Set if image is draggable or not
    void
    setFill(com.flowingcode.vaadin.addons.zoomist.Zoomist.Fill fill)
    Sets the image fill type.
    void
    Sets the height of the container.
    void
    setMaxRatio(double value)
    Sets the max ratio of the image.
    void
    setPinchable(boolean pinchable)
    Sets whether image is pinchable when pinching.
    void
    setSlider(boolean visible)
    Sets whether slider is visible or not.
    void
    setSlider(String el, com.flowingcode.vaadin.addons.zoomist.Zoomist.Direction direction, Double maxRatio)
    Sets slider's options.
    void
    Sets the source url of image.
    void
    setWheelable(boolean wheelable)
    Sets whether image is zoomable when mouse wheeling.
    void
    setZoomer(boolean visible)
    Sets whether zoomer is visible or not.
    void
    setZoomer(String inEl, String outEl, boolean disableOnBounds)
    Sets zoomer's options.
    void
    setZoomRatio(double value)
    Sets the ratio of a zoom.
    void
    zoom(double ratio)
    Zooms the image with a relative ratio.

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • Zoomist

      public Zoomist(String src)
      Creates a new instance of Zoomist for the specified source url.
      Parameters:
      src - the source url
  • Method Details

    • setSrc

      public void setSrc(String src)
      Sets the source url of image.
      Parameters:
      src - the source url
    • setSlider

      public void setSlider(boolean visible)
      Sets whether slider is visible or not. If true slider will be visible and initialized with default options. *
      Parameters:
      visible - if true, slider is visible if false, slider is not visible
    • setSlider

      public void setSlider(String el, com.flowingcode.vaadin.addons.zoomist.Zoomist.Direction direction, Double maxRatio)
      Sets slider's options.
      Parameters:
      el - string with CSS selector or querySelector of slider
      direction - direction of the slider
      maxRatio - max ratio of the image
    • isSlider

      public boolean isSlider()
      Returns if slider is visible
      Returns:
      true, slider is visible false, slider is not visible
    • setZoomer

      public void setZoomer(boolean visible)
      Sets whether zoomer is visible or not. If true zoomer will be visible and initialized with default options.
      Parameters:
      visible - if true, zoomer is visible if false, zoomer is not visible
    • setZoomer

      public void setZoomer(String inEl, String outEl, boolean disableOnBounds)
      Sets zoomer's options.
      Parameters:
      inEl - string with CSS selector or querySelector of zoom in element
      outEl - string with CSS selector or querySelector of zoom out element
      disableOnBounds - zoomer will be disabled when image can't be larger or smalle
    • isZoomer

      public boolean isZoomer()
      Returns if zoomer is visible
      Returns:
      true, zoomer is visible false, zoomer is not visible
    • getFill

      public com.flowingcode.vaadin.addons.zoomist.Zoomist.Fill getFill()
      Returns the image fill type.
      Returns:
      the image fill type
    • setFill

      public void setFill(com.flowingcode.vaadin.addons.zoomist.Zoomist.Fill fill)
      Sets the image fill type. Possible values 'cover', 'contain', 'none'.
      Parameters:
      fill - the image fill type
    • setDraggable

      public void setDraggable(boolean draggable)
      Set if image is draggable or not
      Parameters:
      draggable - if true, image is draggable if false, image is not draggable
    • isDraggable

      public boolean isDraggable()
      Returns if image is draggable or not.
      Returns:
      true, image is draggable false, image is not draggable
    • setWheelable

      public void setWheelable(boolean wheelable)
      Sets whether image is zoomable when mouse wheeling.
      Parameters:
      wheelable - if true, image is wheelable if false, image is not wheelable
    • isWheelable

      public boolean isWheelable()
      Returns if image is wheelable or not.
      Returns:
      true, image is wheelable false, image is not wheelable
    • setPinchable

      public void setPinchable(boolean pinchable)
      Sets whether image is pinchable when pinching. This feature only works on mobile device.
      Parameters:
      pinchable - true, image is pinchable false, image is not pinchable
    • isPinchable

      public boolean isPinchable()
      Returns if image is pinchable or not.
      Returns:
      true, image is pinchable false, image is not pinchable
    • setBounds

      public void setBounds(boolean bounds)
      Sets whether image can be drag out of bounds or not.
      Parameters:
      bounds - if true, image can be drag out of bounds if false, image cannot be drag out of bounds
    • isBounds

      public boolean isBounds()
      Returnd if image can be drag out of bounds or not.
      Returns:
      true, image can be drag out of bounds false, image cannot be drag out of bounds
    • setZoomRatio

      public void setZoomRatio(double value)
      Sets the ratio of a zoom.
      Parameters:
      value - the zoom ratio
    • getZoomRatio

      public double getZoomRatio()
      Returns the ratio of a zoom.
      Returns:
      the zoom ratio
    • setMaxRatio

      public void setMaxRatio(double value)
      Sets the max ratio of the image.
      Parameters:
      value - the image max ratio
    • getMaxRatio

      public double getMaxRatio()
      Returns the max ratio of the image.
      Returns:
      the image max ratio
    • setHeight

      public void setHeight(String value)
      Sets the height of the container.
      Parameters:
      value - the height of the container
    • getHeight

      public String getHeight()
      Returns the height of the container.
      Returns:
      the height of the container
    • zoom

      public void zoom(double ratio)
      Zooms the image with a relative ratio.
      Parameters:
      ratio - the ratio of the zooming
    • move

      public void move(double x, double y)
      Moves the image with a relative position.
      Parameters:
      x - x position
      y - y position
    • moveTo

      public void moveTo(double x, double y)
      Moves the image with a absolute position.
      Parameters:
      x - x position
      y - y position
    • reset

      public void reset()
      Resets the image to initial state.
    • getContainerData

      public void getContainerData(com.vaadin.flow.function.SerializableConsumer<ContainerData> consumer)
      Gets the width, height and aspectRatio of the container.
      Parameters:
      consumer - callback with container data
    • addReadyListener

      public com.vaadin.flow.shared.Registration addReadyListener(com.vaadin.flow.component.ComponentEventListener<ReadyEvent> listener)
      Adds a ReadyEvent listener to zoomist.
      Parameters:
      listener - a ready event listener
      Returns:
      a handle for the listener
    • addZoomListener

      public com.vaadin.flow.shared.Registration addZoomListener(com.vaadin.flow.component.ComponentEventListener<ZoomEvent> listener)
      Adds a ZoomEvent listener to zoomist.
      Parameters:
      listener - a zoom event listener
      Returns:
      a handle for the listener
    • addWheelListener

      public com.vaadin.flow.shared.Registration addWheelListener(com.vaadin.flow.component.ComponentEventListener<WheelEvent> listener)
      Adds a WheelEvent listener to zoomist.
      Parameters:
      listener - a wheel event listener
      Returns:
      a handle for the listener
    • addDragStartListener

      public com.vaadin.flow.shared.Registration addDragStartListener(com.vaadin.flow.component.ComponentEventListener<DragStartEvent> listener)
      Adds a DragStartEvent listener to zoomist.
      Parameters:
      listener - a drag start event listener
      Returns:
      a handle for the listener
    • addDragListener

      public com.vaadin.flow.shared.Registration addDragListener(com.vaadin.flow.component.ComponentEventListener<DragEvent> listener)
      Adds a DragEvent listener to zoomist.
      Parameters:
      listener - a drag event listener
      Returns:
      a handle for the listener
    • addDragEndListener

      public com.vaadin.flow.shared.Registration addDragEndListener(com.vaadin.flow.component.ComponentEventListener<DragEndEvent> listener)
      Adds a DragEndEvent listener to zoomist.
      Parameters:
      listener - a drag end event listener
      Returns:
      a handle for the listener
    • addSlideStartListener

      public com.vaadin.flow.shared.Registration addSlideStartListener(com.vaadin.flow.component.ComponentEventListener<SlideStartEvent> listener)
      Adds a SlideStartEvent listener to zoomist.
      Parameters:
      listener - a slide start event listener
      Returns:
      a handle for the listener
    • addSlideListener

      public com.vaadin.flow.shared.Registration addSlideListener(com.vaadin.flow.component.ComponentEventListener<SlideEvent> listener)
      Adds a SlideEvent listener to zoomist.
      Parameters:
      listener - a slide event listener
      Returns:
      a handle for the listener
    • addSlideEndListener

      public com.vaadin.flow.shared.Registration addSlideEndListener(com.vaadin.flow.component.ComponentEventListener<SlideEndEvent> listener)
      Adds a SlideEndEvent listener to zoomist.
      Parameters:
      listener - a slide end event listener
      Returns:
      a handle for the listener
    • addPinchStartListener

      public com.vaadin.flow.shared.Registration addPinchStartListener(com.vaadin.flow.component.ComponentEventListener<PinchStartEvent> listener)
      Adds a PinchStartEvent listener to zoomist.
      Parameters:
      listener - a pinch start event listener
      Returns:
      a handle for the listener
    • addPinchListener

      public com.vaadin.flow.shared.Registration addPinchListener(com.vaadin.flow.component.ComponentEventListener<PinchEvent> listener)
      Adds a PinchEvent listener to zoomist.
      Parameters:
      listener - a pinch event listener
      Returns:
      a handle for the listener
    • addPinchEndListener

      public com.vaadin.flow.shared.Registration addPinchEndListener(com.vaadin.flow.component.ComponentEventListener<PinchEndEvent> listener)
      Adds a PinchEndEvent listener to zoomist.
      Parameters:
      listener - a pinch end event listener
      Returns:
      a handle for the listener
    • addResizeListener

      public com.vaadin.flow.shared.Registration addResizeListener(com.vaadin.flow.component.ComponentEventListener<ResizeEvent> listener)
      Adds a ResizeEvent listener to zoomist.
      Parameters:
      listener - a resize event listener
      Returns:
      a handle for the listener