Buckets:
Quantumbraid/trainingdata / ui /node_modules /react-zoom-pan-pinch /src /components /keep-scale /keep-scale.tsx
| import React, { useContext, useEffect, useRef } from "react"; | |
| import { mergeRefs } from "utils/ref.utils"; | |
| import { Context } from "../transform-wrapper/transform-wrapper"; | |
| export const KeepScale = React.forwardRef< | |
| HTMLDivElement, | |
| React.HTMLAttributes<HTMLDivElement> | |
| >((props, ref) => { | |
| const localRef = useRef<HTMLDivElement>(null); | |
| const instance = useContext(Context); | |
| useEffect(() => { | |
| return instance.onChange((ctx) => { | |
| if (localRef.current) { | |
| const positionX = 0; | |
| const positionY = 0; | |
| localRef.current.style.transform = instance.handleTransformStyles( | |
| positionX, | |
| positionY, | |
| 1 / ctx.instance.state.scale, | |
| ); | |
| } | |
| }); | |
| }, [instance]); | |
| return <div {...props} ref={mergeRefs([localRef, ref])} />; | |
| }); | |
Xet Storage Details
- Size:
- 802 Bytes
- Xet hash:
- 6ed17e98be6e219fa1fe116b5f1fc43a244224c85ef3730a7fc566f603860cc3
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.