Socket
Socket
Sign inDemoInstall

pan-and-zoom

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pan-and-zoom - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

dist/cjs/index.js

69

package.json
{
"name": "pan-and-zoom",
"version": "v1.0.0",
"version": "v2.0.0",
"license": "ISC",
"repository": "https://github.com/Alhadis/PanAndZoom",
"repository": {
"type": "git",
"url": "git+https://github.com/piliugin-anton/PanAndZoom.git"
},
"bugs": {
"url": "https://github.com/piliugin-anton/PanAndZoom/issues"
},
"publishConfig": {
"access": "public",
"branches": [
"master"
]
},
"homepage": "https://github.com/piliugin-anton/PanAndZoom",
"description": "Low-level interface for calculating pan and zoom transformations.",
"keywords": ["pan", "zoom", "affine", "transform", "matrix", "magnify", "math"],
"keywords": [
"pan",
"zoom",
"affine",
"transform",
"matrix",
"magnify",
"math"
],
"author": "John Gardner <gardnerjohng@gmail.com>",
"files": ["pan-and-zoom.*"],
"main": "./pan-and-zoom",
"maintainers": [
"Anton Piliugin <anton.piliugin@icloud.com>"
],
"files": [
"dist"
],
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"browser": "dist/umd/index.js",
"types": "dist/types/index.d.ts",
"exports": {
".": {
"import": "./dist/esm/index.js",
"require": "./dist/cjs/index.js"
}
},
"scripts": {
"prepare": "make"
"lint": "eslint --ext .ts ./src/",
"test": "mocha",
"clean": "node tools/cleanup",
"build": "npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types",
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json",
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
"build:umd": "node tools/cleanup umd && webpack --config config/webpack.config.js",
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
"package": "npm run build && npm pack"
},
"devDependencies": {
"@types/chai": "^4.3.3",
"@types/mocha": "^9.1.1",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"chai": "^4.2.0",
"eslint": "^8.23.0",
"mocha": "^10.0.0",
"ts-loader": "^9.3.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.2",
"webpack": "^5.74.0",
"webpack-cli": "^4.10.0"
}
}

@@ -26,5 +26,5 @@ Pan and Zoom

~~~js
import PanAndZoom from "pan-and-zoom";
import { PanAndZoom } from "pan-and-zoom";
let paz = new PanAndZoom({
const paz = new PanAndZoom({

@@ -35,2 +35,7 @@ // Callback fired after changing a `PanAndZoom' object's properties

el.style.transform = paz; // Calls paz.toString() implicitly
// Or for canvas:
const canvas = document.getElementById("canvas");
const canvasRenderContext2D = canvas.getContext("2d");
canvasRenderContext2D.setTransform(...paz);
},

@@ -43,3 +48,19 @@ });

Or in Node.js:
~~~js
const { PanAndZoom } = require("pan-and-zoom");
const paz = new PanAndZoom({
update(){
console.log(`CSS transform: ${paz}`);
console.log('Canvas transformation matrix:', ...paz);
},
});
paz.zoom = 1.5; // +150% scale
paz.panX = 300; // Move horizontally 300 units
~~~
Properties

@@ -317,3 +338,2 @@ ----------

<a name="debounce"></a>

@@ -320,0 +340,0 @@ ### `debounce(fn)`

pan-and-zoom.js
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