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

vue-image-zoomify

v1.1.1

Published

An image zooming feature for Vue, enabling zoom in and out functionalities.

Downloads

228

Readme

vue-image-zoomify

An image zooming feature for Vue, enabling zoom in and out functionalities.

An example gif using the feature.

  • You can zoom in and out of the image by holding down the Ctrl button and using the wheel.
  • This feature can also be enabled without pressing the Ctrl button through the options.
  • This feature demonstrates the act of clicking the zoom in, zoom out, and reset size buttons at the bottom.
  • The bottom buttons are provided by default and can be removed through options. Additionally, these buttons will only be activated when there is an image present.
  • Resize the image to fit the element area.
  • Maintain the original image size while adjusting the width or height to match the element size.
  • Press the fullscreen button to view it larger
  • This is an example of using a custom button.
    If you're not satisfied with the appearance or position of the button, customize it to your liking.

Install the package

npm i vue-image-zoomify@latest
yarn add vue-image-zoomify@latest

Basic Usage

<VueImageZoomify :src="src" />

...

<script>
import { VueImageZoomify } from "vue-image-zoomify";
export default {
  components: { VueImageZoomify },
};
</script>

Props

  • src : { type: String, default: "" }
  • width : { type: String, default: "100%" }
  • height : { type: String, default: "100%" }
  • enableButton: { type: Boolean, default: true }
  • isCtrlPressed: { type: Boolean, default: true }
  • @onZoomIn
  • @onZoomOut
  • @onZoomReset
  • @onToggleFullScreen

Usage Example

<template>
  <div class="wrapper">
    <div style="display: flex; gap: 10px; margin: 10px 0 0 20px">
      <button @click="onChangeImg(1)">IMG 1</button>
      <button @click="onChangeImg(2)">IMG 2</button>
      <button @click="onChangeImg(2)">IMG 3</button>
      <button @click="changeEnableButton()">enableButton</button>
    </div>
    <br />
    <div
      style="
        width: calc(100% - 40px);
        height: 400px;
        border: 1px solid #333;
        border-radius: 10px;
        margin: 0 20px 10px 20px;
        overflow: hidden;
      "
    >
      <VueImageZoomify ref="imgCanvas" :src="imgSrc" :enable-button="enableButton" />
    </div>
    <button v-if="!enableButton" @click="onClickZoom('in')">+</button>
    <button v-if="!enableButton" @click="onClickZoom('out')">-</button>
    <button v-if="!enableButton" @click="onClickZoom('reset')">reset</button>
    <button v-if="!enableButton" @click="onClickZoom('fullsize')">fullsize</button>

  </div>
</template>

<script>
import { VueImageZoomify } from "vue-image-zoomify";
import IMG1 from "@/assets/20240111.jpg";
const imgs = {
  1: IMG1,
  2: "https://th.bing.com/th/id/OIG.l4zSBOrvP_1FquYSRwyw?pid=ImgGn",
  3: "https://th.bing.com/th/id/OIG.PleGemfkpxw4enZbAZd7?pid=ImgGn",
};
export default {
  components: { VueImageZoomify },
  data() {
    return {
      enableButton: true,
      imgSrc: imgs["1"],
    };
  },
  methods: {
    onChangeImg(num) {
      this.imgSrc = imgs[num];
    },
    onClickZoom(val) {
      const zoom = this.$refs.imgCanvas;
      if (val === "in") {
        zoom.onZoomIn();
      } else if (val === "out") {
        zoom.onZoomOut();
      } else if (val === "reset") {
        zoom.onZoomReset();
      } else if (val === "fullsize") {
        zoom.onToggleFullScreen();
      }
    },
    changeEnableButton(){
      this.enableButton = !this.enableButton
    }
  },
};
</script>