Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ngx-pinch-zoom

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-pinch-zoom

Pinch zoom component for Angular.

  • 2.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9K
decreased by-50.34%
Maintainers
1
Weekly downloads
 
Created
Source

Pinch zoom for Angular

The module provides opportunities for image zooming in, zooming out and positioning with use of gestures on a touch screen.

Live demos and source code samples can be found on home page.

🔬️ Help make Pinch zoom better by answering a few questions.

Installation

Install the npm package.

npm i ngx-pinch-zoom

Import module:

import { PinchZoomModule } from 'ngx-pinch-zoom';

@NgModule({
    imports: [ PinchZoomModule ]
})

Usage

For use, put your image inside the <pinch-zoom> container. Please, pay attention to the parameters of your viewport metatag. If you use Pinch Zoom, it is required to limit zooming of a web-page, by entering the following parameters: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">.

<pinch-zoom>
    <img src="path_to_image" /> 
</pinch-zoom>

Properties

nametypedefaultdescription
transition-durationnumber200Defines the speed of the animation of positioning and transforming.
limit-zoomnumber, "original image size""original image size"Limit the maximum available scale. By default, the maximum scale is calculated based on the original image size.
minScalenumber0Limit the minimum acceptable scale. With a value of 1, it is recommended to use this parameter with limitPan
auto-zoom-outbooleanfalseAutomatic restoration of the original size of an image after its zooming in by two fingers.
double-tapbooleantrueZooming in and zooming out of an image, depending on its current condition, with double tap.
disabledbooleanfalseDisable zoom.
disablePanbooleanfalseTurn off panning with one finger.
overflow"hidden", "visible""hidden"hidden - the overflow is clipped, and the rest of the content will be invisible. visible - the overflow is not clipped. The content renders outside the element's box.
disableZoomControl"disable", "never", "auto""auto"Disable zoom controls. auto - Disable zoom controls on touch screen devices. never - show zoom controls on all devices. disable - disable zoom controls on all devices.
zoomControlScalenumber1Zoom factor when using zoom controls.
backgroundColorstring"rgba(0,0,0,0.85)"The background color of the container.
limitPanbooleanfalseStop panning when the edge of the image reaches the edge of the screen.
minPanScalenumber1.0001Minimum zoom at which panning is enabled.
listeners"auto", "mouse and touch""mouse and touch"By default, subscriptions are made for mouse and touch screen events. The value auto means that the subscription will be only for touch events or only for mouse events, depending on the type of screen.
wheelbooleantrueScale with the mouse wheel.
wheelZoomFactornumber0.2Zoom factor when zoomed in with the mouse wheel.
autoHeightbooleanfalseCalculate the height of the container based on the width and height attributes of the image. By default, the width of the container is 100%, and the height is determined after the image information is loaded - this may cause a delay in determining the height of the container. If you want the container to initially have dimensions corresponding to the dimensions of the image, then specify the attributes width and height for the <img> tag. When setting the property value to true, a subscription to the window resize listener will be created.
draggableImagebooleanfalseSets the attribute draggable to the <img> tag.

Methods

namedescription
toggleZoom()Image zooming in and out, depending on its current state.
destroy()Unsubscribe from mouse events and touches, as well as remove added styles from the DOM tree.

See the full documentation and examples on the home page.

Author services

Are you interested in this library but lacks features? Write to the author, he can do it for you.

Sponsors

Tested using Browserstack

Browserstack

Keywords

FAQs

Package last updated on 07 Jul 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc