Research
Recent Trends in Malicious Packages Targeting Discord
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
react-fast-pinch-zoom
Advanced tools
Changelog
1.1.0
peerDependenciesMeta
for npm@7
es2015
target for ESMtype
=> interface
@tsconfig/create-react-app
instead own configdevDependencies
Readme
This is a migration of GoogleChromeLabs/pinch-zoom to React!
Simple image pinch-zoom. Although you can put any element in <PinchZoom/>
.
yarn add pinch-zoom-element
import React, { useRef, useCallback } from "react";
import {
PinchZoom,
applyCssProperties,
getTransform3DValue,
getTransform2DValue,
} from "react-fast-pinch-zoom";
const App = () => {
const ref = useRef(null);
const onTransform = useCallback(({ x, y, scale }) => {
// Use CSS Custom Properties (Variables)
applyCssProperties(ref.current, { x, y, scale });
// Or use literal transform value
// ref.current.style.setProperty('transform',getTransform3DValue({x,y,scale}));
// ref.current.style.setProperty('transform',getTransform2DValue({x,y,scale}));
}, []);
return (
<PinchZoom onTransform={onTransform}>
<img
ref={ref}
alt="two black cats look at you"
src="https://cdn.glitch.com/d824d0c2-e771-4c9f-9fe2-a66b3ac139c5%2Fcats.jpg"
/>
</PinchZoom>
);
};
Now the above can be pinch-zoomed!
const App = () => {
const pinchZoomRef = React.useRef();
return (
<PinchZoom ref={pinchZoomRef}>
<img />
</PinchZoom>
);
};
pinchZoomRef.current.x; // x offset
pinchZoomRef.current.y; // y offset
pinchZoomRef.current.scale; // scale
Set the transform. All values are optional.
pinchZoomRef.current.setTransform({
scale: 1,
x: 0,
y: 0,
});
Scale in/out of a particular point.
const scale = 2;
pinchZoomRef.current.scaleTo(scale, {
// Transform origin. Can be a number, or string percent, eg "50%"
originX: 0,
originY: 0,
// Should the transform origin be relative to the "container", or "content"?
relativeTo: "content",
});
FAQs
[![Code quality](https://github.com/retyui/react-fast-pinch-zoom/actions/workflows/nodejs.yml/badge.svg)](https://github.com/retyui/react-fast-pinch-zoom/actions/workflows/nodejs.yml) [![react-fast-pinch-zoom on npm](https://badgen.net/npm/v/react-fast-pi
The npm package react-fast-pinch-zoom receives a total of 31 weekly downloads. As such, react-fast-pinch-zoom popularity was classified as not popular.
We found that react-fast-pinch-zoom demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
The Socket research team breaks down a sampling of malicious packages that download and execute files, among other suspicious behaviors, targeting the popular Discord platform.
Security News
Socket CEO Feross Aboukhadijeh joins a16z partners to discuss how modern, sophisticated supply chain attacks require AI-driven defenses and explore the challenges and solutions in leveraging AI for threat detection early in the development life cycle.
Security News
NIST's new AI Risk Management Framework aims to enhance the security and reliability of generative AI systems and address the unique challenges of malicious AI exploits.