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 -
Method Summary
Modifier and TypeMethodDescriptioncom.vaadin.flow.shared.RegistrationaddDragEndListener(com.vaadin.flow.component.ComponentEventListener<DragEndEvent> listener) Adds aDragEndEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddDragListener(com.vaadin.flow.component.ComponentEventListener<DragEvent> listener) Adds aDragEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddDragStartListener(com.vaadin.flow.component.ComponentEventListener<DragStartEvent> listener) Adds aDragStartEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddPinchEndListener(com.vaadin.flow.component.ComponentEventListener<PinchEndEvent> listener) Adds aPinchEndEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddPinchListener(com.vaadin.flow.component.ComponentEventListener<PinchEvent> listener) Adds aPinchEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddPinchStartListener(com.vaadin.flow.component.ComponentEventListener<PinchStartEvent> listener) Adds aPinchStartEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddReadyListener(com.vaadin.flow.component.ComponentEventListener<ReadyEvent> listener) Adds aReadyEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddResizeListener(com.vaadin.flow.component.ComponentEventListener<ResizeEvent> listener) Adds aResizeEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddSlideEndListener(com.vaadin.flow.component.ComponentEventListener<SlideEndEvent> listener) Adds aSlideEndEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddSlideListener(com.vaadin.flow.component.ComponentEventListener<SlideEvent> listener) Adds aSlideEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddSlideStartListener(com.vaadin.flow.component.ComponentEventListener<SlideStartEvent> listener) Adds aSlideStartEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddWheelListener(com.vaadin.flow.component.ComponentEventListener<WheelEvent> listener) Adds aWheelEventlistener to zoomist.com.vaadin.flow.shared.RegistrationaddZoomListener(com.vaadin.flow.component.ComponentEventListener<ZoomEvent> listener) Adds aZoomEventlistener to zoomist.voidgetContainerData(com.vaadin.flow.function.SerializableConsumer<ContainerData> consumer) Gets the width, height and aspectRatio of the container.com.flowingcode.vaadin.addons.zoomist.Zoomist.FillgetFill()Returns the image fill type.Returns the height of the container.doubleReturns the max ratio of the image.doubleReturns the ratio of a zoom.booleanisBounds()Returnd if image can be drag out of bounds or not.booleanReturns if image is draggable or not.booleanReturns if image is pinchable or not.booleanisSlider()Returns if slider is visiblebooleanReturns if image is wheelable or not.booleanisZoomer()Returns if zoomer is visiblevoidmove(double x, double y) Moves the image with a relative position.voidmoveTo(double x, double y) Moves the image with a absolute position.voidreset()Resets the image to initial state.voidsetBounds(boolean bounds) Sets whether image can be drag out of bounds or not.voidsetDraggable(boolean draggable) Set if image is draggable or notvoidsetFill(com.flowingcode.vaadin.addons.zoomist.Zoomist.Fill fill) Sets the image fill type.voidSets the height of the container.voidsetMaxRatio(double value) Sets the max ratio of the image.voidsetPinchable(boolean pinchable) Sets whether image is pinchable when pinching.voidsetSlider(boolean visible) Sets whether slider is visible or not.voidsetSlider(String el, com.flowingcode.vaadin.addons.zoomist.Zoomist.Direction direction, Double maxRatio) Sets slider's options.voidSets the source url of image.voidsetWheelable(boolean wheelable) Sets whether image is zoomable when mouse wheeling.voidsetZoomer(boolean visible) Sets whether zoomer is visible or not.voidSets zoomer's options.voidsetZoomRatio(double value) Sets the ratio of a zoom.voidzoom(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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Constructor Details
-
Zoomist
Creates a new instance of Zoomist for the specified source url.- Parameters:
src- the source url
-
-
Method Details
-
setSrc
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 sliderdirection- direction of the slidermaxRatio- 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
Sets zoomer's options.- Parameters:
inEl- string with CSS selector or querySelector of zoom in elementoutEl- string with CSS selector or querySelector of zoom out elementdisableOnBounds- 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
Sets the height of the container.- Parameters:
value- the height of the container
-
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 positiony- y position
-
moveTo
public void moveTo(double x, double y) Moves the image with a absolute position.- Parameters:
x- x positiony- y position
-
reset
public void reset()Resets the image to initial state. -
getContainerData
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 aReadyEventlistener 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 aZoomEventlistener 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 aWheelEventlistener 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 aDragStartEventlistener 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 aDragEventlistener 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 aDragEndEventlistener 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 aSlideStartEventlistener 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 aSlideEventlistener 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 aSlideEndEventlistener 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 aPinchStartEventlistener 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 aPinchEventlistener 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 aPinchEndEventlistener 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 aResizeEventlistener to zoomist.- Parameters:
listener- a resize event listener- Returns:
- a handle for the listener
-