Class Zoomist

java.lang.Object
com.vaadin.flow.component.Component
com.flowingcode.vaadin.addons.zoomist.Zoomist
All Implemented Interfaces:
AttachNotifier, DetachNotifier, HasElement, 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 Component
This component is a wrapper for Zoomist Component (https://npm.io/package/zoomist)
Author:
Felipe Lang / Flowing Code
See Also:
  • 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, 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 Zoomist.Fill getFill()
      Returns the image fill type.
      Returns:
      the image fill type
    • setFill

      public void setFill(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(SerializableConsumer<ContainerData> consumer)
      Gets the width, height and aspectRatio of the container.
      Parameters:
      consumer - callback with container data
    • addReadyListener

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

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

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

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

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

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

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

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

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

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

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

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

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