All Projects → wittlock → Ngx Image Zoom

wittlock / Ngx Image Zoom

Licence: mit
Angular component for zoomable images

Programming Languages

typescript
32286 projects

Labels

Projects that are alternatives of or similar to Ngx Image Zoom

Angularconcepts
Key Angular Concepts using Latest Angular version 5
Stars: ✭ 31 (-63.95%)
Mutual labels:  angular5
Ngx Address
A simple address picker in angular.
Stars: ✭ 44 (-48.84%)
Mutual labels:  angular5
Angular Infinite List
A short and powerful infinite scroll list library for angular, with zero dependencies
Stars: ✭ 77 (-10.47%)
Mutual labels:  angular5
Angular2 Animation Tutorial Example
Angular 2/5 - Router Animation Example & Tutorial
Stars: ✭ 33 (-61.63%)
Mutual labels:  angular5
Laravel5.5 Angular5
Laravel 5.5 + Angular 5 + AdminLTE single page application
Stars: ✭ 40 (-53.49%)
Mutual labels:  angular5
Dialogflow Angular5
💬 Bot in Angular 5 & DialogFlow
Stars: ✭ 52 (-39.53%)
Mutual labels:  angular5
Angular Skeleton App
Angular 7.x navigation skeleton project with styling which get you started faster.
Stars: ✭ 25 (-70.93%)
Mutual labels:  angular5
Ngx Lightbox
Lightbox2 use with angular >= 5
Stars: ✭ 84 (-2.33%)
Mutual labels:  angular5
Angular Contacts Demo
Angular demo(SSR) base on Angular CLI
Stars: ✭ 42 (-51.16%)
Mutual labels:  angular5
Angular2
Angular 2 Seed
Stars: ✭ 75 (-12.79%)
Mutual labels:  angular5
Angular Library Starter Kit
Angular 5 Library Starter Kit based on Angular-CLI
Stars: ✭ 35 (-59.3%)
Mutual labels:  angular5
Ng2 Pdf Viewer
📄 PDF Viewer Component for Angular 5+
Stars: ✭ 997 (+1059.3%)
Mutual labels:  angular5
Ng2 Breadcrumbs
A breadcrumb service for the Angular 7 router
Stars: ✭ 61 (-29.07%)
Mutual labels:  angular5
Angulartics2
Vendor-agnostic analytics for Angular2 applications.
Stars: ✭ 963 (+1019.77%)
Mutual labels:  angular5
Materialtimecontrol
Time component for angular/Material2 (5.0.0-rc0)
Stars: ✭ 81 (-5.81%)
Mutual labels:  angular5
Nebular
💥 Customizable Angular UI Library based on Eva Design System 🌚✨Dark Mode
Stars: ✭ 7,368 (+8467.44%)
Mutual labels:  angular5
Angular Tree Component
A simple yet powerful tree component for Angular (>=2)
Stars: ✭ 1,031 (+1098.84%)
Mutual labels:  angular5
Spring Boot Mongodb Angular Todo App
A Sample App built using Spring Boot, Angular and MongoDB
Stars: ✭ 84 (-2.33%)
Mutual labels:  angular5
Ngx Papaparse
Papa Parse wrapper for Angular
Stars: ✭ 83 (-3.49%)
Mutual labels:  angular5
Drip Ionic3
「水滴打卡」App Open Source Code Base On Ionic V3 Framework
Stars: ✭ 74 (-13.95%)
Mutual labels:  angular5

ngx-image-zoom

npm version

Project status

Breaking changes in version 0.5.0, see changelog for details. This version is only tested with Angular9, I'll try to test and make compatible with a few versions back too for a later version. As far as I can tell 0.5.0 is Ivy compatible too.

Still in early development, more features are planned and incoming. Should be in a working state right now but it's not tested in lots of different setups yet.

Demonstration of available features available here.

About

NgxImageZoom is inspired by angular2-image-zoom and JQuery libraries such as jQuery Zoom and elevateZoom-plus but a pure Angular2+ implementation of similar concepts. This plugin works with both URLs to images and in-line images (Data URI).

Available options

All settings except thumbImage are optional. If no fullImage is provided the thumbImage will be used as the high resolution version as well.

Option Default value Description
thumbImage none (Required) The smaller version of the image that will be shown when there's no interaction by the user.
fullImage none The full resolution version of the image to be used when zooming. If not supplied thumbImage will be used.
magnification 1 The zoom factor to be used by default. 1 means we use the fullImage at its actual resolution.
zoomMode 'hover' The mode of zooming to use, these are explained in a table below.
enableScrollZoom false Boolean that toggles if the mouse wheel should be captured when hovering over the image to adjust magnification.
scrollStepSize 0.1 When using scroll zoom this setting determines how big steps each scroll changes the zoom.
enableLens false If enabled only a small portion around the mouse cursor will actually magnify instead of the entire image area.
lensWidth 100 Width of the lens, if enabled.
lensHeight 100 Height of the lens, if enabled.
circularLens false Make the lens circular instead of square. This will only look good if width and height are equal.
minZoomRatio baseRatio Lower limit on how much zoom can be applied with scrollZoom enabled. See below for details.
maxZoomRatio 2 Upper limit on how much zoom can be applied with scrollZoom enabled. See below for details.

Zoom modes

Mode Description
hover Whenever the mouse cursor moves over the thumbnail it will show the zoomed image until it leaves the thumbnail.
click Similar to hover but it only starts zooming if the user clicks the image. Moving the cursor away from the image disables it again.
toggle A click in the image will zoom at the point of the cursor. Another click will restore the small image.
hover-freeze First click enables hover mode, second click freezes the zoomed image where it is, third click restores thumbnail.

Zoom ratio

The zoom ratio used in the minZoomRatio and maxZoomRatio settings refer to the relative size of the thumbnail and the full size image. The baseRatio default value is the calculated ratio that would make the zoomed image equal in size to the thumbnail. For example, if the full size image is 10x larger than the thumbnail, then minZoomRatio will default to 0.1, as in the full size image can at its smallest be shown at 0.1 times its original size. The default value for maxZoomRatio being 1 means the largest the fullSize image can appear is twice its original size.

Available output

The component outputs the follow events that can be triggered on.

Event name Description
zoomScroll Whenever the user changes the zoom level using the scroll wheel this event will fire with the current zoom ratio (see above).
zoomPosition When the point on where the zoom is focused changes this event emits a Coord event (interface exported from the module) with X/Y in pixels relative thumbnails top left corner. Practically whenever the user moves the mouse cursor over the image.

Installation

To install this library, run:

$ npm install ngx-image-zoom --save

Using this library

From your Angular AppModule:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { NgxImageZoomModule } from 'ngx-image-zoom';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    NgxImageZoomModule // <-- Add this line
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Once the library is imported, you can use its component in your Angular application:

<!-- You can now use NgxImageZoom component in app.component.html -->
<h1>
  {{title}}
</h1>
<lib-ngx-image-zoom
    [thumbImage]=myThumbnail
    [fullImage]=myFullresImage
></lib-ngx-image-zoom>

License

MIT © Mathias Wittlock

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].