MCPcopy Create free account
hub / github.com/code100x/cms / updateTransform

Function updateTransform

src/components/VideoPlayer2.tsx:191–213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189
190 // Optimized transform update with boundary enforcement
191 const updateTransform = () => {
192 const boundaries = calculateBoundaries();
193 const maxX = (boundaries.width * (transformState.scale - 1)) / 2;
194 const maxY = (boundaries.height * (transformState.scale - 1)) / 2;
195
196 transformState.translateX = Math.min(Math.max(
197 transformState.translateX,
198 -maxX
199 ), maxX);
200
201 transformState.translateY = Math.min(Math.max(
202 transformState.translateY,
203 -maxY
204 ), maxY);
205
206 videoEl.style.transform = `
207 scale(${transformState.scale})
208 translate3d(
209 ${transformState.translateX / transformState.scale}px,
210 ${transformState.translateY / transformState.scale}px,
211 0
212 )`;
213 };
214
215 // Unified pinch handler
216 hammer.on('pinchstart pinchmove', (e) => {

Callers 2

setupZoomFeaturesFunction · 0.85
resetZoomFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected