npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ngx-image-view

v1.0.9

Published

The universal element/image viewer component.

Downloads

24

Readme

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:

import { NgxImageViewModule } from 'ngx-image-view';

@NgModule({
   imports: [NgxImageViewModule]
   
...

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.

<style>
   body {
      padding: 0;
      margin: 0;
   }   
   .view {
      width: 100%;
      height: 100vh;
      box-sizing: border-box;
      background: black;
   }
</style>

<lib-ngx-image-view class="view">
   <img data-allow-drag-preview="false"
        src="https://images.unsplash.com/photo-1510708932124-fed7feb9e1d9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&q=80">
</lib-ngx-image-view>

API

[triggerReset]

Resets the zooming/position for all elements on value change.

<lib-ngx-image-view [triggerReset]="updatingValue">

data-fit-to-parent

Limits the element to have minimal the container height
default: true

<img src="..." data-fit-to-parent="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

<img src="..." data-limit-to-natural="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

<img src="..." data-zoom-to-center="true">

data-allow-zoom

Enable/disable zooming: default: true
When disabled, the element can not be zoomed.

<img src="..." data-allow-zoom="true">

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.

<img src="..." data-allow-drag="true">

data-allow-drag-preview

Enable/disable dragging the preview: default: true
Preview means:

  • element.width === container.width
    for landscape elements
  • element.height === container.height
    for portrait elements
<img src="..." data-allow-drag-preview="false">