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-grabbing-box

v1.0.0

Published

vue-grabbing-box is a container component that allows you to grab to change view-box and also with scaling

Downloads

81

Readme

vue-grabbing-box

中文


vue3 support from ^1.0.0

Introdution

This is a container component (Vue component) similar to a canvas box, which displays your content (whether it is an image or any Vue component), and supports features such as:

  • Mobile

    • Single finger canvas drag and drop
    • Double finger scaling (zoom-in zoom-out)
    • You can also expand, shrink, and reset by clicking the button
  • PC

    • Click and hold to drag
    • Scroll wheel up and down to drag up and down
    • Scale by 'Ctrl'+'Wheel'
    • You can also zoom-in, zoom-out, and reset by clicking the button

Try it out:
demo-vue2
demo-vue3

Changelog

read changelog

Install

pnpm add vue-grabbing-box
# or
npm install vue-grabbing-box
# or
yarn add vue-grabbing-box

Usage

Vue@2

demo-vue2

import Vue from 'vue';
import GrabbingBox from 'vue-grabbing-box'; // import as vue2 for default
// or
import GrabbingBox from 'vue-grabbing-box/dist/vue2'; // specify vue2
// recommend, in case of changing default export to vue3
import 'vue-grabbing-box/dist/vue2/index.css'; // from v0.1.0 need to import css file
Vue.use(GrabbingBox);

// or import component directly
import { GrabbingBox } from 'vue-grabbing-box/dist/vue2';
import 'vue-grabbing-box/dist/vue2/index.css';
Vue.use(GrabbingBox);
// or
Vue.component(GrabbingBox.name, GrabbingBox);
<template>
  <grabbing-box>
    <!-- here lays your content -->
  </grabbing-box>
</template>

~~Note: used ElButton in scale button-group~~
(No more using ElButton from v0.1.0)

Vue@3

// for global
import { createApp } from 'vue';
import GrabbingBox from 'vue-grabbing-box/dist/vue3';
import 'vue-grabbing-box/dist/vue3/index.css';
const app = createApp();
app.use(GrabbingBox);
app.mount('#app');

// or in setup script of vue3 component
import { GrabbingBox } from 'vue-grabbing-box/dist/vue3';

API

Attributes

|Property|Type|Default Value|Note| |--|--|--|--| |maxScale|Number|200|max limitation, unit percent| |minScale|Number|20|min limitation, unit percent| |scaleStep|Number|10|unit percent| |initScale|Number|100|unit percent, v1.0.0-alpha.4~| |scaleButtons|Boolean|true|whether show scale button-group,includes + - and reset| |scaleButtonsPosition|String|top right|v0.1.1 specify the position of scale button-group, top \| right \| bottom \| left| |scaleButtonsSpaceX|String|10px|v0.1.1 specify the horizontal space to edge| |scaleButtonsSpaceY|String|20px|v0.1.1 specify the vertical space to edge| |throttleSpan|Number|~~100~~ 50(from v0.1.3)|unit millisecond| |~~scrollSpeed~~|Number|~~3~~ 1(from v0.1.3)|deprecated from v0.1.7 v0.0.6 mouse scroll speed,value range 1~6| |emitClickOnDrag|Boolean|false|v0.1.4 emit click event even if have dragged (just in case of special usage case, usually could ignore this prop #7 no-emit-click)|

Events(from v0.1.7)

|Event Name|Description|Params| |--|--|--| |update|on view change|{ scale, translateX, translateY }| |zoom-in|on zoom in|{ scale, translateX, translateY }| |zoom-out|on zoom out|{ scale, translateX, translateY }| |move|on drag the cavas, or mouse scroll, or touch pad scroll|{ scale, translateX, translateY }| |reset|on reset the view|-|

Develop

# start demo projects(vue2 & vue3)
pnpm dev

# or start demo projects under 'expamples' folder separately
# Note that the GrabbingBox used is from NPM or local files(source files or build result)