ngx-image-view
The universal element/image viewer component.
Compatible with desktop and mobile touch devices.
- Zooming
- Dragging
Installation
yarn add ngx-image-view
npm i -S ngx-image-view
Import in your module:
;
Examples
Full screen image viewer
Panning and zooming will be applied to all elements inside the lib-ngx-image-view
tag.
To prevent for example dragging for one element, use the api property to
configure the element.
API
[triggerReset]
Resets the zooming/position for all elements on value change.
data-fit-to-parent
Limits the element to have minimal the container height
default: true
data-limit-to-natural
Limits the max-size of the element to its natural size.
Usually useful for images
which should stop scaling at 1px = 1px
.
default: true
data-zoom-to-center
Stay centered if width
gets smaller than container width
.
If you want to have exact on-cursor-point zooming, even for images
smaller than the container, you need to disable this, but
consider the side-effect: The element might move aside while
zooming and width/height is still smaller than your box.
default: true
data-allow-zoom
Enable/disable zooming: default: true
When disabled, the element can not be zoomed.
data-allow-drag
Enable/disable dragging: default: true
When disabled, the element can not be dragged. But it still can
be zoomed. The zooming follows the mouse cursor.
data-allow-drag-preview
Enable/disable dragging the preview: default: true
Preview means:
element.width === container.width
for landscape elementselement.height === container.height
for portrait elements