rotationControl:SetHandler("OnMouseDown",
function(control, button)
if button == MOUSE_BUTTON_INDEX_LEFT then
if GetCursorContentType() ~= MOUSE_CONTENT_EMPTY then
PlaceInWorldLeftClick()
else
if control.canRotate then
control.isRotating = true
BeginItemPreviewSpin()
end
end
end
end)
rotationControl:SetHandler("OnMouseUp",
function(control, button)
if button == MOUSE_BUTTON_INDEX_LEFT then
if control.isRotating then
control.isRotating = false
EndItemPreviewSpin()
end
end
end)
rotationControl:SetHandler("OnEffectivelyHidden",
function(control)
if control.isRotating then
control.isRotating = false
EndItemPreviewSpin()
end
end)
rotationControl:SetHandler("OnUpdate",
function(control)
if control.mouseInside and CanSpinPreviewCharacter() and GetCursorContentType() == MOUSE_CONTENT_EMPTY then
control.canRotate = true
WINDOW_MANAGER:SetMouseCursor(MOUSE_CURSOR_ROTATE)
else
if control.canRotate then
WINDOW_MANAGER:SetMouseCursor(MOUSE_CURSOR_DO_NOT_CARE)
end
control.canRotate = false
end
end)