UNPKG

react-moveable

Version:

A React Component that create Moveable, Draggable, Resizable, Scalable, Rotatable, Warpable, Pinchable, Groupable.

54 lines (46 loc) 1.35 kB
import MoveableManager from "../MoveableManager"; import { triggerEvent, fillParams } from "../utils"; import { IObject } from "@daybrush/utils"; export function triggerRenderStart( moveable: MoveableManager<any>, isGroup: boolean, e: any, ) { const params: IObject<any> = fillParams(moveable, e, { isPinch: !!e.isPinch, }); const eventAffix = isGroup ? "Group" : ""; if (isGroup) { params.targets = moveable.props.targets; } triggerEvent(moveable, `onRender${eventAffix}Start`, params); } export function triggerRender( moveable: MoveableManager<any>, isGroup: boolean, e: any, ) { const params: IObject<any> = fillParams(moveable, e, { isPinch: !!e.isPinch, }); const eventAffix = isGroup ? "Group" : ""; if (isGroup) { params.targets = moveable.props.targets; } triggerEvent(moveable, `onRender${eventAffix}`, params); } export function triggerRenderEnd( moveable: MoveableManager<any>, isGroup: boolean, e: any, ) { const params: IObject<any> = fillParams(moveable, e, { isPinch: !!e.sPinch, isDrag: e.isDrag, }); const eventAffix = isGroup ? "Group" : ""; if (isGroup) { params.targets = moveable.props.targets; } triggerEvent(moveable, `onRender${eventAffix}End`, params); }