MCPcopy Index your code
hub / github.com/react-grid-layout/react-grid-layout / createScaledStrategy

Function createScaledStrategy

src/core/position.ts:308–329  ·  view source on GitHub ↗
(scale: number)

Source from the content-addressed store, hash-verified

306 * ```
307 */
308export function createScaledStrategy(scale: number): PositionStrategy {
309 return {
310 type: "transform",
311 scale,
312
313 calcStyle(pos: Position): React.CSSProperties {
314 return setTransform(pos) as React.CSSProperties;
315 },
316
317 calcDragPosition(
318 clientX: number,
319 clientY: number,
320 offsetX: number,
321 offsetY: number
322 ): PartialPosition {
323 return {
324 left: (clientX - offsetX) / scale,
325 top: (clientY - offsetY) / scale
326 };
327 }
328 };
329}
330
331/** Default position strategy (transform-based) */
332export const defaultPositionStrategy = transformStrategy;

Callers 2

ReactGridLayoutFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…