@beoe/pan-zoom
Advanced tools
Comparing version
import * as math from "mathjs"; | ||
export declare const identity: math.Matrix; | ||
export declare const identity: math.Matrix<math.MathNumericType>; | ||
export declare function ttm(m: math.Matrix): string; | ||
export declare function transformXY(m: math.Matrix, x: number, y: number): readonly [any, any]; | ||
export declare function getScale(m: math.Matrix): any; | ||
export declare function scale(m: math.Matrix, sf: number): math.Matrix; | ||
export declare function scaleAt(m: math.Matrix, sf: number, x: number, y: number): math.Matrix; | ||
export declare function translate(m: math.Matrix, dx: number, dy: number): math.Matrix; | ||
export declare function fdm(m: DOMMatrix): math.Matrix; | ||
export declare function scale(m: math.Matrix, sf: number): math.Matrix<math.MathNumericType>; | ||
export declare function scaleAt(m: math.Matrix, sf: number, x: number, y: number): math.Matrix<math.MathNumericType>; | ||
export declare function translate(m: math.Matrix, dx: number, dy: number): math.Matrix<math.MathNumericType>; | ||
export declare function fdm(m: DOMMatrix): math.Matrix<math.MathNumericType>; | ||
export declare function tdm(m: math.Matrix): DOMMatrix; |
{ | ||
"name": "@beoe/pan-zoom", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Pan and zoom for SVG images", | ||
@@ -39,5 +39,4 @@ "author": "stereobooster", | ||
"devDependencies": { | ||
"mathjs": "^12.4.0" | ||
"mathjs": "^14.0.0" | ||
}, | ||
"dependencies": {}, | ||
"scripts": { | ||
@@ -44,0 +43,0 @@ "test": "vitest", |
@@ -14,3 +14,3 @@ # @beoe/pan-zoom | ||
| --------- | ----------------------- | ----------------- | --------------- | | ||
| pan | clik + move | click + move | two finger drag | | ||
| pan | click + move | click + move | two finger drag | | ||
| zoom | <kbd>Ctrl</kbd> + wheel | pinch | pinch | | ||
@@ -25,11 +25,10 @@ | reset | double click | double click | double tap | | ||
- all actions are available through gestures, so it works without UI. You can add UI, though. Library exposes methods for this, like `pan(dx, dy)` and `zoom(scale)` | ||
- <kbd>Cmd</kbd> + click - zoom in | ||
- <kbd>Alt</kbd> + click - zoom out | ||
- First double click (tap) - zoom in x2 | ||
## Demo | ||
**TODO**: update demo - this is an old one | ||
[pan-zoom demo](https://beoe.stereobooster.com/other/pan-zoom/) | ||
[](https://app.netlify.com/sites/svg-pan-zoom/deploys) | ||
[pan-zoom demo](https://svg-pan-zoom.stereobooster.com/) | ||
## Usage | ||
@@ -50,3 +49,3 @@ | ||
document.querySelectorAll(".beoe").forEach((container) => { | ||
const element = container.querySelector("svg, img[src$='.svg' i]"); | ||
const element = container.firstElementChild; | ||
if (!element) return; | ||
@@ -53,0 +52,0 @@ new PanZoom({ element, container }).on(); |
Sorry, the diff of this file is not supported yet
575
0.52%23811
-0.2%15
-6.25%182
-0.55%