sanichkotikov / pinch-zoom-pan Goto Github PK
View Code? Open in Web Editor NEWA simple module that add pinch-zoom and pan to your HTML element
Home Page: https://sanichkotikov.github.io/react-family-tree-example/
License: MIT License
A simple module that add pinch-zoom and pan to your HTML element
Home Page: https://sanichkotikov.github.io/react-family-tree-example/
License: MIT License
Is this repository still being maintained? I want to ask how to reset zoom in/out ?
Hello.
Using svelte 4 I cannot make this library work, here's the error I'm getting:
D:\project-sveltekit\node_modules\pinch-zoom-pan\lib\index.js:1
import { DEFAULT_STATE, MAX_ZOOM, MIN_ZOOM } from './constants';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1088:15)
at Module._compile (node:internal/modules/cjs/loader:1123:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
here's how it's set up:
ImageZoom.svelte
<script>
import { create } from 'pinch-zoom-pan'
import { onMount } from 'svelte'
export let image
let rootElement
onMount(() => {
const canvas = create({
element: rootElement,
minZoom: 0.5,
maxZoom: 2,
captureWheel: true,
})
return canvas.destroy
})
</script>
<div bind:this={rootElement} class="root">
<div class="point">
<div class="canvas">
<svelte:component this={image} />
</div>
</div>
</div>
<style>
.root {
position: relative;
transform: translateZ(0);
overflow: hidden;
}
.point {
position: absolute;
width: 0;
height: 0;
transform: translate(0, 0) scale(1);
transform-origin: center;
will-change: transform;
}
.canvas {
position: absolute;
transform: translate(-50%, -50%);
}
</style>
Hello,
I am working with this component and I was wondering if it supports the ability to focus on an element within the canvas.
For example, If I click a button I would like to change position of the canvas so that an element will be centered on the canvas.
Please let me know if this is possible, thanks.
Could you please add a way to also pan while zooming using 2 fingers?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.